Author Topic: Shieldflare  (Read 5491 times)

Offline teleguy

  • Posts: 363
  • Cookies: 53
Shieldflare
« on: June 04, 2009, 01:51:11 PM »
Is it possible to make shields glow on their own constantly for a certain amount of time?

Offline MLeo

  • Retired Staff
  • Posts: 3636
  • Cookies: 833
  • Software Simian
    • the Programming Pantheon
Re: Shieldflare
« Reply #1 on: June 04, 2009, 01:56:32 PM »
In theory, the glow decay should partially control that, but I believe it doesn't do anything. The only other viable method is through an invisible torpedo positioned just outside a shield vector, pointing inwards, that can only hit the ship in question and (eventually) doesn't do any damage. Terribly hackish, but it's the only method I could come up with (last time it was asked).
I still can't read peoples minds, nor can I read peoples computers, even worse, I can't combine the two to read what is going wrong with your BC install...

"It was filed under 'B' for blackmail." - Morse, Inspector Morse - The dead of Jericho.

Offline teleguy

  • Posts: 363
  • Cookies: 53
Re: Shieldflare
« Reply #2 on: June 04, 2009, 02:08:02 PM »
Sounds extremely complicated. There has to be a torpedo for every shield arc. How exactly would I do that?

Offline MLeo

  • Retired Staff
  • Posts: 3636
  • Cookies: 833
  • Software Simian
    • the Programming Pantheon
Re: Shieldflare
« Reply #3 on: June 04, 2009, 02:13:30 PM »
Like I said, it has been asked before, there may even be some code floating about.

First you define 6 vectors (for the 6 shield arcs), which denote a "normal" for a shield arc. For each vector, you create, position and prepare a torpedo, and let it go. The impact of that torpedo can be nullified through a simple FoundationTech yield.

Positioning is by scaling that arcs vector by the radius of the ship times 1.1, preparation is making sure it can only be hit by the ship itself (is fairly easy to do, EnableCollisionsWith) and that it is relative to the ship (AttachObject), and that it faces the ship (which is the opposite vector for that arc).
I still can't read peoples minds, nor can I read peoples computers, even worse, I can't combine the two to read what is going wrong with your BC install...

"It was filed under 'B' for blackmail." - Morse, Inspector Morse - The dead of Jericho.

Offline teleguy

  • Posts: 363
  • Cookies: 53
Re: Shieldflare
« Reply #4 on: June 04, 2009, 03:59:20 PM »
I've found the thread you mentioned. http://bc-central.net/forums/index.php/topic,4534.0.html
I'll take a closer look later.

Meanwhile I tried the glow decay but apperently it has no effect, there are no console errors either.

Code: [Select]
for pShield in range(App.ShieldClass.NUM_SHIELDS):
maxshield = pShields.GetMaxShields

(pShield)
rate = pShields.GetProperty

().GetShieldChargePerSecond(pShield)
glow = pShields.GetShieldGlowDecay()
pShields.GetProperty().SetShieldGlowDecay

(1000000)
pShields.SetCurShields(pShield, maxshield)



Offline teleguy

  • Posts: 363
  • Cookies: 53
Re: Shieldflare
« Reply #5 on: June 04, 2009, 04:23:05 PM »
Would it perhaps be possible to attach a Nanofx atmosphere to a ship?

Offline MLeo

  • Retired Staff
  • Posts: 3636
  • Cookies: 833
  • Software Simian
    • the Programming Pantheon
Re: Shieldflare
« Reply #6 on: June 04, 2009, 04:29:04 PM »
That's a sphere, shields are not (neccesairly). And it's static, always the same.
I still can't read peoples minds, nor can I read peoples computers, even worse, I can't combine the two to read what is going wrong with your BC install...

"It was filed under 'B' for blackmail." - Morse, Inspector Morse - The dead of Jericho.

Offline USS Frontier

  • Posts: 176
  • Cookies: 562
Re: Shieldflare
« Reply #7 on: June 04, 2009, 04:43:46 PM »
A Nanofx atmosphere is more than a sphere...
It's a couple of Sun and Planet objects.

What you want exactly?  Just to make a ship "glow" a little?
"Revenge is a dish best served cold"
                    -Old Klingon Proverb
GravityFX Download
Galaxy Charts Download

Offline teleguy

  • Posts: 363
  • Cookies: 53
Re: Shieldflare
« Reply #8 on: June 04, 2009, 04:50:56 PM »
Yes, something like this or this...


Offline USS Frontier

  • Posts: 176
  • Cookies: 562
Re: Shieldflare
« Reply #9 on: June 04, 2009, 05:00:57 PM »
Hmmm ok.

I asked because I know a easy way to make a "glow" in a ship, but it still would be a sphere.
It works by creating a torpedo which only purpose is to glow, and attach it to the center of the ship you want. I made something like this in GravityFX. It can be easily modified to use a torpedo with the size, color, textures and flares as you want (and actually color and size are already).
So the restrictions you would had in the effect would be those of a torpedo... Like the fact it is a sphere.

It might work for pulses as well, but I never tried it.
"Revenge is a dish best served cold"
                    -Old Klingon Proverb
GravityFX Download
Galaxy Charts Download

Offline teleguy

  • Posts: 363
  • Cookies: 53
Re: Shieldflare
« Reply #10 on: June 05, 2009, 10:59:12 AM »
That sounds promising. Is it possible to make the glow semi transparent? I tried to do that with a gravity torpedo (GladSingularity) but no matter how I set the alpha in the plugin there was no visible effect.

Offline LJ

  • Retired Staff
  • Posts: 1661
  • Cookies: 1139
Re: Shieldflare
« Reply #11 on: June 05, 2009, 01:26:38 PM »
Could'nt just load a glowing sphere model, scale it and attach it to the ship?

Offline USS Frontier

  • Posts: 176
  • Cookies: 562
Re: Shieldflare
« Reply #12 on: June 05, 2009, 02:15:01 PM »
Yeah, technically you should be able to make it semi-transparent changing the alpha component of all colors (core color, glow color and flare color). But still depending on size of core and glow, and the flares, the semi-transparent effect might not be easily visible... So you just gotta mess around with the values in the good old trial and error lol

LJ, that would require modeling skills I don't have lol
Since a semi-transparent sphere would be needed, and as far as I know, making such models for BC isn't exactly easy.
Plus, it would require more system resources than a simple, flare-less torpedo wouldn't it?
And finally, with the torpedo we can also easily control size, color and glow (pulse rate and size) :P
"Revenge is a dish best served cold"
                    -Old Klingon Proverb
GravityFX Download
Galaxy Charts Download

Offline MLeo

  • Retired Staff
  • Posts: 3636
  • Cookies: 833
  • Software Simian
    • the Programming Pantheon
Re: Shieldflare
« Reply #13 on: June 05, 2009, 03:02:51 PM »
Won't work. If you encapsulate a transparent object over another object, that other object will be invisible, even if you put it outside the transparent model, but behind it, you won't see it.
I still can't read peoples minds, nor can I read peoples computers, even worse, I can't combine the two to read what is going wrong with your BC install...

"It was filed under 'B' for blackmail." - Morse, Inspector Morse - The dead of Jericho.

Offline LJ

  • Retired Staff
  • Posts: 1661
  • Cookies: 1139
Re: Shieldflare
« Reply #14 on: June 05, 2009, 10:12:24 PM »
could you attach it in the following order:

ship -> glowing thing -> ship

I dare say the render tree doesn't do cycle checking - it might work :-)

Offline MLeo

  • Retired Staff
  • Posts: 3636
  • Cookies: 833
  • Software Simian
    • the Programming Pantheon
Re: Shieldflare
« Reply #15 on: June 06, 2009, 06:44:47 AM »
I don't think that has anything to do with it, when transparent, they should render the background over the ship.
I still can't read peoples minds, nor can I read peoples computers, even worse, I can't combine the two to read what is going wrong with your BC install...

"It was filed under 'B' for blackmail." - Morse, Inspector Morse - The dead of Jericho.

Offline LJ

  • Retired Staff
  • Posts: 1661
  • Cookies: 1139
Re: Shieldflare
« Reply #16 on: June 06, 2009, 09:18:50 AM »
Won't work. If you encapsulate a transparent object over another object, that other object will be invisible, even if you put it outside the transparent model, but behind it, you won't see it.
hmm..
I don't think that has anything to do with it, when transparent, they should render the background over the ship.


I wouldn't be surprised if BC uses a object based implementation of the painters algorithm.  It couldn't hurt to try subverting the render queue tho :-p  Its better than punishing the physics engine with a torpedo. :P

Offline Bren

  • DS9FX Team
  • Posts: 750
  • Cookies: 33
  • 6EQUJ5
Re: Shieldflare
« Reply #17 on: June 09, 2009, 12:15:10 PM »
if you reverse the vertex order of the sphere, the side opposite the camera will render, and the ship will render over that.

No problem.
"The sky calls to us, if we do not destroy ourselves, we will, one day, venture to the stars." - Carl Sagan

Klingon Academy now works on XP/Vista/Win 7 thanks to one dude's patches, click here for details. I highly recommend it!

Offline teleguy

  • Posts: 363
  • Cookies: 53
Re: Shieldflare
« Reply #18 on: June 18, 2009, 11:47:08 AM »
Quote
I've found the thread you mentioned. http://bc-central.net/forums/index.php/topic,4534.0.html
I tried to give that a go however I've run into some problems.

This is my function:

Code: [Select]
def pShieldGlow(pObject, pEvent):
pPlayer = MissionLib.GetPlayer()
pGame = App.Game_GetCurrentGame()
pEpisode = pGame.GetCurrentEpisode()
        pShip = App.Game_GetCurrentPlayer()
pShipID = App.NULL_ID
idTarget = pShipID
pHull = pPlayer.GetHull()
radius = pHull.GetRadius()*1.5
kPoint = App.TGPoint3()
kPoint.SetXYZ(0, radius, 0)
kVector = App.TGPoint3()
kVector.SetXYZ(0, -radius, 0)


pTorp = ftb.Tech.ATPFunctions.FireTorpFromPointWithVector(kPoint,

kVector, "Blood Photon", idTarget, pShipID, 50, TGOffset = None)
pShip.AttachObject(pTorp)

And that's what the console says:



EDIT: Figured it out. However when a fire the torpedo the game crashes. How do I add the torpedo script? I tried Tactical.Projectiles.PhotonTorpedo, PhotonTorpedo and the name that shows up ingame.

EDIT2: Ok, firing torpedoes works but they are neither interacting with the ships hull nor the shields.

Offline USS Frontier

  • Posts: 176
  • Cookies: 562
Re: Shieldflare
« Reply #19 on: June 18, 2009, 12:54:36 PM »
When you pass the ID of the target (idTarget) to the FireTorpFromPointWithVector function, it expects that it is a valid ID (meaning the ID of a ship that exists).
And quoting your code:
Code: [Select]
pShipID = App.NULL_ID
idTarget = pShipID
So yeah, it'll never work like that lol. You gotta pass a valid ID  (like pTargetShip.GetObjID(), assuming pTargetShip to be a ShipClass obj).
The same applies to the parameter pShipID you're passing, tho if I remember correctly it might not be as necessary as the target ID.

Also, why are you doing this:
Code: [Select]
pPlayer = MissionLib.GetPlayer()
# ...
        pShip = App.Game_GetCurrentPlayer()
???
pPlayer and pShip will be the same object: the player ship.


About the pcTorpScriptName parameter (which in your code is "Blood Photon"), it should be the torpedo script (module) string, like "Tactical.Projectiles.<script name>".


EDIT: lol just now saw your edits :P
Anyway... How do you mean they're not interacting with the hulls/shields? You want your torp to "hit" the shields to show the shield effect?
If that's the case, try these 2 things: make that the ship isn't the torp's parent but the target,  also try to make it without attaching the torpedo to the ship (i've tried that before and the torpedo never detonated).
"Revenge is a dish best served cold"
                    -Old Klingon Proverb
GravityFX Download
Galaxy Charts Download