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:
|
Just remember that if you open something, you must close it - correctly.
Code:
( ... ) |
Code:
sub EVENT_DEATH_COMPLETE { Code:
perl -c checkcode.pl |
Something simple yet effective here, seems like you wanted a percent chance for it to spawn, this would do the trick. In this version its just a basic percent chance a mob splits into two.
Code:
sub GET_RANDOM_NUMBER |
Quote:
|
Quote:
Also, having read atrayas post just now, I see I missed you stated you wanted a 20% chance (4:1 odds), thus change: Code:
if(quest::ChooseRandom(0..3) == 0) { Code:
if(quest::ChooseRandom(0..4) == 0) { |
This snippet goes in the particular NPC's quest file, correct?
|
If I wanted this to apply to all mobs I would just stick it in my Global.pl right?
|
All times are GMT -4. The time now is 12:37 PM. |
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.