PenUltima Online Forum Index Official Core: 096.7
Official Core: 097 2008-02-26
Donate towards the POL web hosting bill!
 POL Home   FAQ   Search    Memberlist   Usergroups    Register    Profile   Log in to check your private messages   Log in
New NPC on death?

 
Post new topic   Reply to topic    PenUltima Online Forum Index -> Scripting Help
Display posts from previous:   

Author Message
Havoc



Joined: 13 Feb 2006
Posts: 7

PostPosted: Sun Nov 04, 2007 8:24 pm    Post subject: New NPC on death? Reply with quote

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 Smile

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.

Author Message
Yukiko



Joined: 02 Feb 2006
Posts: 1094
Location: Southern Central USA

PostPosted: Fri Nov 09, 2007 4:55 am    Post subject: Reply with quote

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:

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.

Author Message
Gnafu



Joined: 02 Feb 2006
Posts: 88
Location: Livorno, Italy

PostPosted: Thu Nov 29, 2007 8:40 am    Post subject: Reply with quote

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... Very Happy

Post new topic   Reply to topic    PenUltima Online Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 




Powered by phpBB © 2001, 2005 phpBB Group :: Theme & Graphics by GHS & Scott E. Royalty