New NPC on death?

Get Help on scripting in POL with configurations, config setups, script trouble shooting, etc.
Post Reply
Havoc
Neophyte Poster
Posts: 34
Joined: Mon Feb 13, 2006 1:35 pm

New NPC on death?

Post by Havoc »

Once an NPC dies, say, a zombie, how could you make it turn into a skeleton?
I know it's a bit of a novice question, I apologize for being a noob :)

It would be cool if the zombie had a random chance of either just dying or turning into a skeleton, but beggars can't be choosers.
Yukiko
Distro Developer
Posts: 2826
Joined: Thu Feb 02, 2006 1:41 pm

Post by Yukiko »

Under POL 0.95 and converted 0.95 to 0.97 Distro death.src in \pol\scripts\misc is the script that fires when an NPC dies.

It's fairly easy to spawn a skeleton at the dead zombie's location.

Assuming you want a corpse of the zombie to remain on the ground and simply spawn a skeleton you can add the following code just before the endprogram statement in death.src

Code: Select all

if(GetObjProperty(corpse, "npctemplate") == "zombie")
     CreateNPCFromTemplate("skeleton", corpse.x, corpse.y, corpse.z, 0, corpse.realm);
endif
I am pretty sure that will work fine. If you are running pre-0.96 POL you will have to remove the 'corpse.realm' parameter from the CreateNPCFromTemplate function call.
Gnafu
Grandmaster Poster
Posts: 136
Joined: Thu Feb 02, 2006 7:29 am

Post by Gnafu »

I'm using a cprop on the NPC
Example

Zombie has the "spawnondead" cprop set to "scheleton"
the death script will create another npc using the template "scheleton".

In this way you can modify the npctemplate to spawn while playing simply setting the cprop without recompiling every time.

It's funny to see players becoming mad when dead rats starts to raise scheletons... :D
Post Reply