View Single Post
  #1  
Old 10-03-2016, 03:42 PM
lordnivek1
Sarnak
 
Join Date: Feb 2013
Posts: 65
Default Chance to spawn NPC on another NPC's death

So I am teaching myself how to code perl. I have zero background in any coding at all. Was wondering if someone could take a look at this and tell me how this looks. The bases is there is a 20% chance when a mob dies that another mob will spawn at its location. The mob that spawns will be 1 of 3 different possibilities.

Code:
 
sub EVENT_DEATH_COMPLETE 
{
    my $random = int(rand 4);
    if($random == 0);
    {
    my @npc_type_id = ('123', '124', '125')
    my $random = int(rand 2);
    my $npc = $npc_type_id[$random];
        quest::say("I am free of this mortal cell! Prepare for my wrath!")
	quest::spawn($npc, 0, 0, $x, $y, $Z, $H)
    {
}
Reply With Quote