Forum Moderators: coopster

Message Too Old, No Replies

Perform action rarely if action is true

         

dkin

10:54 am on Jan 16, 2005 (gmt 0)

10+ Year Member



what I am trying to do is say we have 2 warriors

X

and

Y

when X attacks Y and wins I want there to be a chance that he will randomly be awarded a row from another database, I want this to be very rare, say 1 in 150, and if possible have something like if X's rank is low award him a row with a low rank, the higher the players rank the better the row they are awarded.

And everytime he wins I would like a random amount of Y's gold to be taken from him and given to X.

If he loses the battle neither actions are executed and he walks away with his head down :D.

If this makes no sense it is because it is 6 am and I have not slept yet, if it does make sense thank you for reading.

Thanks yall

eaden

10:59 am on Jan 16, 2005 (gmt 0)

10+ Year Member



Say you want to do something 1 in 150 times randomly:

if(rand(1,150) == 1) {
// this will happen 1 in 150 times.
}

dkin

8:04 pm on Jan 16, 2005 (gmt 0)

10+ Year Member



how would I go about awarding him a certain amount of money?

eaden

1:29 am on Jan 17, 2005 (gmt 0)

10+ Year Member



depends on how you store "him".

If it's in SQL you can update the row :

update table set field=field+10 where id=2