HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Random Dice rolling

04-11-2004, 11:20 PM#1
macho271
This is only an example

Ok, the thing I want is:
1/6 chance to win.. like a dice

ok the code I used but did'nt work:
If
random iteger number between 1 and 6 Equal to 6
then do
add 50 of triggering player current gold
else do
display to player group triggering player the text: Sorry, you lost

ok.. what happens is that when the player "looses" he gets much money..! Dont understand a shit

And one more thing..
Can I add something like "and" in actions.. like on "then do
add 50 of triggering player current gold" and "display message...." ?

Or do i have to make a new trigger and insted of give the money, I must run the trigger?
04-11-2004, 11:39 PM#2
AnarkiNet
use "if/then/else (multiple functions)" trigger action
04-11-2004, 11:47 PM#3
The Gearhead
Try defining the random integer, then doing the if then else using that variable which has been randomized. I think I remember a problem I had with random integers before, which produced repeating results. If all else fails, the best way to get the game to generate a random number is to increase the number of digits and then reduce it. I, for example, used a variable real number, which was something like "Set Deatheffect_real random percentage" then I used fractions to decide values because it was "real".

For your situation, I'd generate a random percentage (0-100) and then make it so that only if the random number is over 5/6 x 100 will it do anything.
04-12-2004, 08:21 PM#4
macho271
Ehhm, Dont know whats wrong but the income seems to double each time I run my trigger..

Even if its win or loose

I think it worked a little bit, because its random if the text : you won, or the text you lost. shows up, but i cant figure out why the current gold doubles every time! :<
04-12-2004, 09:06 PM#5
The Gearhead
You are using "Multiple Functions" correct?
04-13-2004, 07:19 AM#6
macho271
i think i used it correctly..! :P
04-13-2004, 06:45 PM#7
macho271
erhm..
2 more questions..
Can I use a Dialog in a multiplayer game, and the game dont pause for the other players?
I thougth about another solution to pick choices.. and that was to write it in text message

2..
Are there any IRC channels where you can get instant help?
server and channel name?
04-13-2004, 08:01 PM#8
The Gearhead
In a multiplayer game, when a dialog appears the game continues to play. (Hence the enormous amount of patience it takes to use a voting dialog... if somebody is "afk")
04-14-2004, 03:33 PM#9
macho271
ok, il copy - paste my betting trigger--

DB 10 Gold2
Events
Player - Player 1 (Red) types a chat message containing bet 10 as An exact match
Conditions
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Triggering player) Current gold) Greater than or equal to 10
Then - Actions
Player - Add (((Triggering player) Current gold) - 10) to Player 1 (Red) Current gold
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Random integer number between 1 and 6) Equal to 6
Then - Actions
Player - Add 50 to (Triggering player) Current gold
Game - Display to (Player group((Triggering player))) the text: Congratulations
Else - Actions
Game - Display to (Player group((Triggering player))) the text: Sorry, you Lost. Pl...
Else - Actions
Game - Display to (Player group((Triggering player))) the text:sorry, you dont have 10 gold'


The problem is that everytime i run the bet trigger the money doubles..
or gold! :P
cant understand why the money doubles :<
04-14-2004, 06:54 PM#10
Ligature
You put "Add (((Triggering player) Current gold) - 10) to Player 1 (Red) Current gold" when you meant "Add (-10) to Player 1 (Red) Current gold"
04-14-2004, 08:48 PM#11
macho271
you know i cant choose (-10) ?
Value + 1..! I must insert value if I want to have minus..!
i tried 0 - 10.. :P
04-14-2004, 10:25 PM#12
The Gearhead
You don't have to insert a value. You do not need to use the arithmetic or mathematical functions. Simply enter an integer value in the field below. There are three radio buttons (round ones)... The top is a variable, middle is a function such as arithmetic, integer A, etc, and the bottom is a plain integer. Integers in WC3 can be negative and positive, no special stuff required.