Switch/Case
Zephirius
Member Posts: 419
I'm really confused as to why when I use Random(3), it consistently only spits out option 1 - the mindflayer.
Would someone show me the correct structure to code a true Random(3). Thanks
Code so far -
Would someone show me the correct structure to code a true Random(3). Thanks
Code so far -
location lSummon = GetLocation(GetWaypointByTag("SUMMON_LOC")); switch (Random(3)) { case 0: DelayCommand(3.0, CreateObjectVoid(OBJECT_TYPE_CREATURE, sFlayer, lSummon)); break; case 1: DelayCommand(3.0, CreateObjectVoid(OBJECT_TYPE_CREATURE, sIronGolem, lSummon)); break; case 2: DelayCommand(3.0, CreateObjectVoid(OBJECT_TYPE_CREATURE, sSilverback, lSummon)) ;break; }
0
Comments
FWIW If you are always going to have only 3 options try switch (d3()) instead of switch (Random(3)). You'll have to change your case statements as d3() returns 1, 2 or 3 though.
TR