Page 1 of 4

Shields not turning off

Posted: Thu Dec 05, 2013 11:52 pm
by BotHunter
Hey all!
I have this problem with my shields where when you destroy the shield bubble, it remains there for a while before it disappears. What I want is when you destroy the shield bubble, it immediately disappears and then, after 30 seconds or so, it reappears. What am I doing wrong?

Here is the code:

Code: Select all

ObjectTemplate.create Bundle US_Shield_Generator
ObjectTemplate.setHasCollisionPhysics 1
ObjectTemplate.hasDynamicShadow 1

rem objectTemplate.aiTemplate US_Shield_Generator_ai
rem -------------------------------------
ObjectTemplate.addTemplate lodUS_Shield_Generator

rem -------------------------------------
objectTemplate.loadSoundScript Sounds/windmill.ssc




LodSelectorTemplate.create DistanceSelector US_Shield_GeneratorSelector
LodSelectorTemplate.addLodDistance 200


ObjectTemplate.create LodObject lodUS_Shield_Generator
ObjectTemplate.lodselector US_Shield_GeneratorSelector
ObjectTemplate.addTemplate US_Shield_GeneratorInterior
ObjectTemplate.addTemplate US_Shield_GeneratorExterior
ObjectTemplate.addTemplate US_Shield_Generator_Bottom_rot_Shadow

ObjectTemplate.create Bundle US_Shield_GeneratorInterior
ObjectTemplate.geometry Base_m1
ObjectTemplate.addTemplate US_Shield_Generator_Bottom_rot
ObjectTemplate.setPosition 0/0/0
ObjectTemplate.addTemplate US_Shield_Generator_Top_rot
ObjectTemplate.setPosition 0/0/0
ObjectTemplate.addTemplate ShieldDomespawner
ObjectTemplate.setPosition 0/0/0



ObjectTemplate.create SimpleObject US_Shield_GeneratorExterior
ObjectTemplate.geometry US_Shield_Generator_l1



ObjectTemplate.create RotationalBundle US_Shield_Generator_Bottom_rot
ObjectTemplate.geometry Bottom_rot
ObjectTemplate.hasDynamicShadow 1
ObjectTemplate.setHasCollisionPhysics 1
ObjectTemplate.setMinRotation 0/0/0
ObjectTemplate.setMaxRotation 0/0/0
ObjectTemplate.setPivotPosition 0/0/0
ObjectTemplate.setMaxSpeed 110/0/0
ObjectTemplate.setAcceleration 10/0/0
ObjectTemplate.setContinousRotationSpeed 12/0/0

ObjectTemplate.create RotationalBundle US_Shield_Generator_Bottom_rot_Shadow
ObjectTemplate.geometry Bottom_rot
ObjectTemplate.hasDynamicShadow 1
ObjectTemplate.setHasCollisionPhysics 0
ObjectTemplate.createInvisible 1
ObjectTemplate.setMinRotation 0/0/0
ObjectTemplate.setMaxRotation 0/0/0
ObjectTemplate.setPivotPosition 0/0/0
ObjectTemplate.setMaxSpeed 110/0/0
ObjectTemplate.setAcceleration 10/0/0
ObjectTemplate.setContinousRotationSpeed 12/0/0


ObjectTemplate.create RotationalBundle US_Shield_Generator_Top_rot
ObjectTemplate.geometry Top_rot
ObjectTemplate.hasDynamicShadow 1
ObjectTemplate.setHasCollisionPhysics 1
ObjectTemplate.setMinRotation 0/0/0
ObjectTemplate.setMaxRotation 0/0/0
ObjectTemplate.setPivotPosition 0/0/0
ObjectTemplate.setMaxSpeed 110/0/0
ObjectTemplate.setAcceleration 10/0/0
ObjectTemplate.setContinousRotationSpeed -12/0/0








ObjectTemplate.create Obstacle ShieldBlock
ObjectTemplate.geometry shield_down
ObjectTemplate.setHasCollisionPhysics 1
ObjectTemplate.createInvisible 1
ObjectTemplate.loadSoundScript Sounds/Landmine.ssc
ObjectTemplate.Damage 0




rem *** ShieldDome ***
ObjectTemplate.create PlayerControlObject ShieldDome
ObjectTemplate.setNetworkableInfo Shield_Bubble_Info
ObjectTemplate.geometry None
ObjectTemplate.saveInSeparateFile 1
ObjectTemplate.cullRadiusScale 3
ObjectTemplate.addArmorEffect 321 e_White_rays_01 0/8.31/0
ObjectTemplate.hasMobilePhysics 1
ObjectTemplate.hasCollisionPhysics 1
ObjectTemplate.hasResponsePhysics 0
ObjectTemplate.speedMod 0
ObjectTemplate.hasArmor 1
ObjectTemplate.hitPoints 320
ObjectTemplate.maxHitPoints 320
ObjectTemplate.material 51
ObjectTemplate.drag 1.0
ObjectTemplate.inertiaModifier 0/0/0
ObjectTemplate.mass 20
ObjectTemplate.criticalDamage 360
ObjectTemplate.setSoldierExitLocation -2.5/0/0 0/0/0
ObjectTemplate.damageFromWater 0
ObjectTemplate.setMinimapIcon "empty.tga"
ObjectTemplate.timeToLiveAfterDeath 0

rem ----------------------------------
ObjectTemplate.addTemplate ShieldBlock

ObjectTemplate.addTemplate e_glowShield
ObjectTemplate.SetPosition 0/-4/0
rem ----------------------------------



rem *** claymorespawner2 *** 
ObjectTemplate.create ObjectSpawner ShieldDomespawner
ObjectTemplate.setObjectTemplate 1 ShieldDome
ObjectTemplate.setObjectTemplate 2 ShieldDome
ObjectTemplate.minSpawnDelay 30
ObjectTemplate.maxSpawnDelay 30
ObjectTemplate.timeToLive 99999
ObjectTemplate.distance 99999
ObjectTemplate.spawnOffset 0/0/0
ObjectTemplate.team 2
ObjectTemplate.MaxNrOfObjectSpawned 1




Re: Shields not turning off

Posted: Thu Dec 05, 2013 11:59 pm
by Vilespring

Code: Select all

ObjectTemplate.timetoliveafterdeath 0
throw this in somewhere.

Re: Shields not turning off

Posted: Fri Dec 06, 2013 12:33 am
by BotHunter
Allready did:

Code: Select all

ObjectTemplate.drag 1.0
ObjectTemplate.inertiaModifier 0/0/0
ObjectTemplate.mass 20
ObjectTemplate.criticalDamage 360
ObjectTemplate.setSoldierExitLocation -2.5/0/0 0/0/0
ObjectTemplate.damageFromWater 0
ObjectTemplate.setMinimapIcon "empty.tga"
ObjectTemplate.timeToLiveAfterDeath 0

Re: Shields not turning off

Posted: Fri Dec 06, 2013 12:53 am
by Vilespring
OH. :shock:

Re: Shields not turning off

Posted: Fri Dec 06, 2013 3:26 am
by BotHunter
It's annoying. maybe APTHUN could figure it out?

Re: Shields not turning off

Posted: Fri Dec 06, 2013 7:04 am
by Apache Thunder
I see a potential issue with with your LodObject. Currently you have it using a DistanceSelector which expects only two child objects on the lodObject. But I see that you have 3, I don't think this is normal and it's probably screwing up the LodObject. Generally a third child object is used as the wreck geometry. Since the lod Object is part of a bundle and not a PCO, then this geometry would never be shown.

Here's my code alterations of the code you posted. Mostly cleaned things up. But I moved the spawner to the main bundle instead of it being a child object of one of the bundles of the lodObject. Might reduce the chance of problems. Also, since you appear to have mobile physics enabled for the shield PCO. I added the "ObjectTemplate.noCollisionAsDestroyed" command. So collision physics for the object should stop as soon as it dies. (though I don't think this command works on objects with mobile physics turned off)

I moved the "US_Shield_Generator_Bottom_rot_Shadow" object to the interior bundle. If for some odd reason it works better on your lodObject instead, move it back. :P

I also added the v_arg1 stuff to make this more multiplayer friendly since you have a spawner tied to a static object.

Code: Select all

ObjectTemplate.create Bundle US_Shield_Generator
ObjectTemplate.hasCollisionPhysics 1
ObjectTemplate.hasDynamicShadow 1
objectTemplate.loadSoundScript Sounds/windmill.ssc
rem objectTemplate.aiTemplate US_Shield_Generator_ai
rem ----------------------------------------------------
ObjectTemplate.addTemplate lodUS_Shield_Generator
rem ----------------------------------------------------
if v_arg1 == host
ObjectTemplate.addTemplate ShieldDomespawner
else
endIf


ObjectTemplate.create LodObject lodUS_Shield_Generator
ObjectTemplate.hasCollisionPhysics 1
rem --------------------------------------------------
ObjectTemplate.addTemplate US_Shield_GeneratorInterior
ObjectTemplate.addTemplate US_Shield_GeneratorExterior
rem --------------------------------------------------
ObjectTemplate.lodselector US_Shield_GeneratorSelector

LodSelectorTemplate.create DistanceSelector US_Shield_GeneratorSelector
LodSelectorTemplate.addLodDistance 200


ObjectTemplate.create Bundle US_Shield_GeneratorInterior
ObjectTemplate.geometry Base_m1
ObjectTemplate.hasCollisionPhysics 1
rem ----------------------------------------------------
ObjectTemplate.addTemplate US_Shield_Generator_Bottom_rot_Shadow
ObjectTemplate.addTemplate US_Shield_Generator_Bottom_rot
ObjectTemplate.addTemplate US_Shield_Generator_Top_rot


ObjectTemplate.create SimpleObject US_Shield_GeneratorExterior
ObjectTemplate.geometry US_Shield_Generator_l1



ObjectTemplate.create RotationalBundle US_Shield_Generator_Bottom_rot
ObjectTemplate.geometry Bottom_rot
ObjectTemplate.hasDynamicShadow 1
ObjectTemplate.hasCollisionPhysics 1
rem ----------------------------------------------------
ObjectTemplate.setMaxSpeed 110/0/0
ObjectTemplate.setAcceleration 10/0/0
ObjectTemplate.setContinousRotationSpeed 12/0/0


ObjectTemplate.create RotationalBundle US_Shield_Generator_Bottom_rot_Shadow
ObjectTemplate.geometry Bottom_rot
rem ----------------------------------------------------
ObjectTemplate.hasDynamicShadow 1
ObjectTemplate.createInvisible 1
ObjectTemplate.setMaxSpeed 110/0/0
ObjectTemplate.setAcceleration 10/0/0
ObjectTemplate.setContinousRotationSpeed 12/0/0


ObjectTemplate.create RotationalBundle US_Shield_Generator_Top_rot
ObjectTemplate.geometry Top_rot
ObjectTemplate.hasDynamicShadow 1
ObjectTemplate.hasCollisionPhysics 1
rem ----------------------------------------------------
ObjectTemplate.setMaxSpeed 110/0/0
ObjectTemplate.setAcceleration 10/0/0
ObjectTemplate.setContinousRotationSpeed -12/0/0



ObjectTemplate.create Obstacle ShieldBlock
ObjectTemplate.geometry shield_down
ObjectTemplate.hasCollisionPhysics 1
ObjectTemplate.createInvisible 1
ObjectTemplate.loadSoundScript Sounds/Landmine.ssc
ObjectTemplate.damage 0



rem *** ShieldDome ***
ObjectTemplate.create PlayerControlObject ShieldDome
ObjectTemplate.setNetworkableInfo Shield_Bubble_Info
ObjectTemplate.geometry None
ObjectTemplate.saveInSeparateFile 1
ObjectTemplate.cullRadiusScale 3
ObjectTemplate.addArmorEffect 320 e_White_rays_01 0/8.31/0
ObjectTemplate.hasMobilePhysics 1
ObjectTemplate.hasCollisionPhysics 1
ObjectTemplate.hasResponsePhysics 1
ObjectTemplate.speedMod 0
ObjectTemplate.hasArmor 1
ObjectTemplate.hitPoints 320
ObjectTemplate.maxHitPoints 320
ObjectTemplate.material 51
ObjectTemplate.drag 1.0
ObjectTemplate.inertiaModifier 0/0/0
ObjectTemplate.mass 20
ObjectTemplate.criticalDamage 100
ObjectTemplate.hpLostWhileCriticalDamage 5
ObjectTemplate.setSoldierExitLocation -2.5/0/0 0/0/0
ObjectTemplate.damageFromWater 0
ObjectTemplate.setMinimapIcon "empty.tga"
ObjectTemplate.timeToLiveAfterDeath 0
ObjectTemplate.fadeAtTimeToLiveAfterDeath 0
ObjectTemplate.noCollisionAsDestroyed 1
rem ----------------------------------
ObjectTemplate.addTemplate ShieldBlock
ObjectTemplate.addTemplate e_glowShield
ObjectTemplate.setPosition 0/-4/0
rem ----------------------------------
ObjectTemplate.addTemplate DummyEngine

ObjectTemplate.create Engine DummyEngine
ObjectTemplate.hasMobilePhysics 1
rem -------------------------------------
ObjectTemplate.setMinRotation 0/0/-1
ObjectTemplate.setMaxRotation 0/0/1
ObjectTemplate.setMaxSpeed 0/0/1
ObjectTemplate.setAcceleration 0/0/1
ObjectTemplate.setInputToRoll c_PIThrottle
ObjectTemplate.setAutomaticReset 1
ObjectTemplate.setEngineType c_ETCar
ObjectTemplate.setTorque 0
ObjectTemplate.setDifferential 0
ObjectTemplate.setNumberOfGears 1



ObjectTemplate.create ObjectSpawner ShieldDomespawner
ObjectTemplate.setObjectTemplate 2 ShieldDome
ObjectTemplate.minSpawnDelay 30
ObjectTemplate.maxSpawnDelay 30
ObjectTemplate.timeToLive 30
ObjectTemplate.distance 999
ObjectTemplate.damageWhenLost 0
ObjectTemplate.spawnOffset 0/0/0
ObjectTemplate.setTeam 2
ObjectTemplate.holdObject 1
ObjectTemplate.naxNrOfObjectSpawned 1
Note that if you are using death bubbles to kill the shield PCO, it's going to be buggy in multiplayer and that might also be the cause of your collision issue. But I don't know how the whole thing is setup so just warning you about that in the event you planned on using deathbubbles to remove PCOs from a map.

I noticed you had "ResponsePhysics" turned off. Are you intending to keep the shield object stationary? If so I've added a dummy engine and used the hold object command on the spawner to keep it in place. I'ved turned ResponsePhysics on. Leaving it off could cause issues with it not responding to projectiles. Though I've never had a PCO with this command turned off, so I'm not entirely sure what this command actually does. :P

You also had the armor effect and critical damage set higher then the max HP on the PCO. You also didn't specify the hpLostWhileCriticalDamage command. If you had intended for this PCO to self destruct on it's own, then set the critical damage to match the hitpoints number. I wasn't sure if you wanted it too or not, so I set it to 100. So it won't go critical until it goes down to 100 HP.

Re: Shields not turning off

Posted: Fri Dec 06, 2013 8:53 pm
by BotHunter
Wow! you did a lot! :D The reason I had mobileP turned on was to try to help with the shadows on the two rotational bundles. this is the same reason I added the US_Shield_Generator_Bottom_rot_Shadow to the main LOD. Other then the shields not turning off, I have had no problems with them in multiplayer. I added an armor effect to the shield bubble, which turns off after about to tank round shots, signifying that the shield is actually dead. then, about 30-10 seconds later, it actually turns off. this is what is annoying me. WHY DOES IT NOT TURN OFF WHEN IT IS DEAD????
Thanks for the reply and all the work you put into it :)

Re: Shields not turning off

Posted: Fri Dec 06, 2013 8:55 pm
by BotHunter
Apache Thunder wrote:You also had the armor effect and critical damage set higher then the max HP on the PCO
this is so I could always have the effect on the shield going while the shield was on.

I will post a video in a bit.

Thanks :)

Re: Shields not turning off

Posted: Fri Dec 06, 2013 10:22 pm
by BotHunter
Quick vid:



when the effect turns off, I think its dead.

Re: Shields not turning off

Posted: Sat Dec 07, 2013 12:10 am
by Apache Thunder
The armor effect will only turn off if there's another armor effect set on a lower HP number. Otherwise the armor effect will remain until the object is removed from the map. ;)

Also, I fixed your YouTube BBCode. Our BBCode won't work if you have "https://" in the URL. Make sure it's only "http://" Most forums BBCode doesn't support the secured URL connection that Youtube now uses for logged in users.

Perhaps the problem is how you have critical Damage coded. Try setting criticalDamage to zero. Also post the coding for your effect. There might be an issue with that that is causing it to stop prematurely. The effect is ending before the actual death of the PCO occurs. If the PCO died, the timeToLiveAfterDeath setting would remove it from the map immediately based on how you had it coded. So at this point I the issue is with your effect bundle/emitter coding.

As for the shadow. Remember that dynamic shadows for a PCO only refresh when the object moves. Rotation on a child object doesn't count as movement so even if the main object has mobile physics the shadow won't rotate with the object unless the object is moving on the map. If you just have a simple shadow that's static, then this won't be an issue. However if you want it to move with your rotational bundle, you'll need to cast the shadow using a AnimatedMesh with an animation state. AnimatedMeshes I have found ignore this rule and their shadows will update even if they are completely stationary on the map. (since I had enabled dynamic shadows on control point flags and they animate despite the flag being on a stationary object.)

If you need the shadow to vanish with the PCO dies, then put the shadow geometry on the PCO. It will vanish when the PCO does.