- Joined
- Aug 11, 2005
- Messages
- 101
ok well im just learning how to code JASS and i have a question. basically i made a local string array called f that has like values for 0 1 and 2 and they all equal a different word. anyway i made it so that it messages all players that "you bought a "+f[GetRandomInt(0,2) ] anyway it all works fine and dandy but how can i call up the random number that it picked? like i said i just started learning JASS and i dont know all the functions yet so help would be appreciated. what this trigger is supposed to do is pick a random fruit(f) and than tell you how much it costs f is the fruit and g is the cost:
is what i have so far and i want it to say to the player after that "This was "+g[the random number that was created for f] hope that wasnt too confusing XD
Code:
function fruit takes nothing returns nothing
local string array f
local integer array g
set f[0]=" Apple "
set f[1]=" Orange "
set f[2]=" Banana "
set g[0]= 0.50
set g[1]= 0.60
set g[2]= 0.45
call DisplayTextToForce( GetPlayersAll(), "You bought a "+f[GetRandomInt(0,2)] )