Ondeath scripting for creatures?

Post » Fri May 13, 2011 10:41 am

In our module, we are planning on having some npcs that turn out to be cyborgs wearing holographic projectos that make them appear human.

On death, no matter how they die, we want a special effect (like sparks inside a smoke puff) play, and the model be replaced with a terminator robot model.

Can someone help me figure out how to set this up globally, but only on specific npcs?
User avatar
Bryanna Vacchiano
 
Posts: 3425
Joined: Wed Jan 31, 2007 9:54 pm

Post » Fri May 13, 2011 5:35 pm

Great minds do seem to think alike. If you have a finite number of NPCs, can you create one terminator equivalent for each one? Then for each cyborg NPC, set its "linked reference" to its terminator. Then you need a script on each cyborg which is like (not tested, but I just did this today for a similar effect)

ref rMyTermbegin ondeath   set rMyTerm to GetLinkedReference   ; you don't want an explosion, but search for an appropriate shimmer effect   ; this will hide the blink-in and blink-out   placeatme FakeMediumExplosion   placeatme rMyTerm   disableend


We need to be careful with "placeatme", but if each cyborg only converts into a terminator once, there is no risk of an infinite number of copies.
User avatar
+++CAZZY
 
Posts: 3403
Joined: Wed Sep 13, 2006 1:04 pm

Post » Fri May 13, 2011 4:47 pm

I think you can just find an effect like he said, like an explosion and place it at your NPC. Then disable them and replace them with another NPC, possibly just with sandbox packages. If they are hostile to the player and will attack on sight this wont be an issue. If you need them to literally change appearing but ultimately be the same person as before, I don't think you can change model directories on the fly.

We need to be careful with "placeatme", but if each cyborg only converts into a terminator once, there is no risk of an infinite number of copies.


This wouldnt never be an issue as the OnDeath block only runs once when the associated NPC dies.
User avatar
Naazhe Perezz
 
Posts: 3393
Joined: Sat Aug 19, 2006 6:14 am

Post » Fri May 13, 2011 9:49 am

If you need them to literally change appearing but ultimately be the same person as before, I don't think you can change model directories on the fly.


I have done a "trick" for this. I wanted this effect of switching model for one NPC only. I created the "old look" NPC and the "new look" NPC separately. Then I created a faction which has both NPCs. In all the dialog condition sheets, instead of using "GetIsId " I used "GetInFaction ". This works; it means that whenever the body switch happens, it has no effect on any of the dialog. For a large number of such NPCs it may be complex, but for one it worked.
User avatar
Marguerite Dabrin
 
Posts: 3546
Joined: Tue Mar 20, 2007 11:33 am

Post » Fri May 13, 2011 6:36 am

whats the best script command to kill an npc?

Also, is it possible to move an npc via script once they are dead?

I was thinking of spawning the bots in a separate area with a 0x0 sandbox idle package, then when the player kills the 'person', the bot is killed too, then play the effect, THEN move the bot to the 'person' location, THEN disable the 'person'.

That way I get a dead 'bot lying on the floor.
User avatar
Emily Graham
 
Posts: 3447
Joined: Sat Jul 22, 2006 11:34 am

Post » Fri May 13, 2011 8:41 am

"kill" is the best way to kill. "moveto" or "placeatme" is the best command to move a dead NPC, depending on whether you want it placed at the same coordinates as an existing creature. There is some rule for deciding when dead bodies disappear (when you leave the area? not sure) and you probably can't move them after that. I have seen mods where they create a special area to store NPC's who aren't in use. I think using "disable" is better, since you don't have to create the special area.
User avatar
leigh stewart
 
Posts: 3415
Joined: Mon Oct 23, 2006 8:59 am


Return to Fallout: New Vegas