• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Very easy trigger i can't get right

Status
Not open for further replies.
Idk how to post an image so here i write the script:
So i made a variable Drop3=Real=Initial Value 0.00

Event
Unit-A unit dies
Conditions (none)
Actions
Set Drop3 = (Real number between 1 and 3)
wait 0.1 game-time seconds
If (Drop3 equal to 2) then do ( Unit - Create 1 footman for P1 at center of region 01),else ( Unit - Create 1 rifleman for P1 at center of region 01)

the problem is that the in game chance of creating a footman is null,though it should be 33%
what am i mistaking?
 
Level 11
Joined
Nov 15, 2007
Messages
800
Use an integer instead of a real. With real numbers, the chance isn't between 1 and 3, it's between 1.00 and 3.00 - which means it can be 1.00, 1.01, 1.02, 1.03, ... 2.98, 2.99, 3.00, making it a .5% chance. Or if you want to be lazy and not change your variables you can just do between .01 and .03 :)
 
Level 11
Joined
Aug 11, 2009
Messages
605
Real variables counts 0.00, so its acutally 1/300 chance that you get a Footman. Change the variable to an Integer or use the convert to integer or something like that when setting Drop3's value :) that should fix it

edit: or like the post above I might have counted it wrong hehe :p
 
Status
Not open for further replies.
Top