Posted: Mon Nov 02, 2009 10:59 am Post subject:
How to destroy an object when an object is created
Is there a precedent in the game (schemas, xml, etc.) for destroying an object when another object is spawned/created (like at a factory)?
I have created a new super unit using the NOD's Avatar as a template. All was well until I decided that I didn't want it to spawn a husk. I was spawning the normal Avatar's husk but that seemed silly so I excluded the logic for that and found that when the avatar dies it just disappears. This is aesthetically unacceptable for obvious reasons.
First, I created a new unit for the husk, then following the trail from OCL, found out that when the avatar dies, it spawns the husk, which, when captured, in turn spawns the new avatar. I figured I could have my unit's husk go ahead and spawn, then somehow shorten the lifetime of the husk to 2 or 3 seconds (the amount of time it takes the die animation to complete). Unfortunately, I have been, thus far, unable to locate a way to adjust this parameter without affecting husks globally (husk lifetime is determined by an xml file in GlobalData). Maybe there are more individual husk parameters elsewhere that I've missed?
Of all the modules and tags for all the different events that happen or are possible in the game, I figure it is likely that a module exists that deals with the destruction of an object on the map when another object is created/present/spawned. Have any of you come across or remember from playing through the game of any such device?
Thanks in advance for any help! _________________ "Whenever you find yourself on the side of the majority, its time to pause and reflect." QUICK_EDIT
or you could use the a normal slowdeath for your mech, so it would die and then slowly sink into the ground and disappear, like every other unit. _________________
@ Ju-Jin
Entering a value to replace a global bit of data has been how I got this far!! lolzz. Seriously though, there is no parameter in the husk's xml to change. Its only a reference to ''GenericHuskLifetimes.xml''. Upon entering that xml, we find that there is still no module with data in it to change that could govern an individual unit's husk but it instead governs the lifetime of husks for ALL units that create them upon their death.
@Stygs
Slowdeath would entail that damage has been taken, right? Then I'd need a mechanism to somehow deal damage to a specific unit but only in the moments just after creation.... Am I making this more complicated than it should be? _________________ "Whenever you find yourself on the side of the majority, its time to pause and reflect." QUICK_EDIT
Uh, only Juggernaut, Avatar und Tripod usw husk's, all other units just switch into the RUMBLE conditionstate and a removed using the slowdeath module, so you just could remove the husk for your mech and have him die like an normal unit. Of course, if a engineer should be albe to repair the husk, this solution would be useless :/
you could simple copy that code into your own husk and remove the xi:include part from it and it would be indepedant from the other husks lifetime. _________________
Yea, I meant the three from each faction from 'ALL'.
I tried copying the code into my unit's xml first. It was the most logical. I had no effect. I suppose I'll try again. Maybe I had some typos since I wasn't just copy/pasting.
Also, removing the unit's husk logic makes it simply disappear from the mapupon death. I was looking for something more pleasing to the eye... The death animation for the mech apparently begins with the creation of the husk. The animation logic in the husk (and so the husk) takes over after the mech is destroyed. The death animation (the husk falling to the ground) is played only once.
I think you're right, though. I should just have to copy it to my unit's xml and update the lifetime. I don't get it. _________________ "Whenever you find yourself on the side of the majority, its time to pause and reflect." QUICK_EDIT
All mech have also a death animation in their code - ist just that they are removed from the world and raplaced with a husk as soon as they die, hence you only see the "husk" animation.
Heres a example how you would make the Nod Avatar die normal, without a husk:
Remove the CreateObjectDie and DestroyDie moduletags (ModuleTag_CreateObjectDie & ModuleTag_DestroyDie) from the Avatar to prevent it from disapearing and spawning a husk when dead.
Now simply add:
I've figured it. I updated the husk's lifetime with a define modifier referenced from another xml. As far as the die animation, as I said the Avatar has no proper animation for death because it is removed from the map upon death and is replaced immediately with the husk and then, subsequently, the husk's opening animation which is the husk falling from the standing position to the ground. The same setup is found with the tripod and the juggernaught.
The OCL references the husk's animation and not the selectable avatar unit. Thanks for the help man... _________________ "Whenever you find yourself on the side of the majority, its time to pause and reflect." QUICK_EDIT
I simply wanted the Avatar to die without leaving a husk that can be captured by an engineer. Removing the husk code has the effect of causing the avatar to vansih after it is killed. Adding any death animation references is useless as the avatar unit has none, the husk does.
Anyways, I've figured it out, so thanks again. _________________ "Whenever you find yourself on the side of the majority, its time to pause and reflect." QUICK_EDIT
The Avatar allready has a death anim build in (its basicly the same as the husk has), its just that its not triggered since the Avatar is replaced by the husk. You could simply remove the husk and a a slow death module to the avatar and he would play his death anim. _________________
I've found an alternative though, that iis preferable to the death animation I think. The husk sits there for fifteen seconds or so making it impossible to build another super unit until the husk dies.
I'm gonna give the death animation route another go just for curiosity sake.
You da man Stygs. _________________ "Whenever you find yourself on the side of the majority, its time to pause and reflect." QUICK_EDIT
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum