need help plz

Non-platform specific questions.

need help plz

Postby sirmashni1 » Wed Aug 05, 2009 5:48 pm

how we can add a % for exemple if you have 50% to miss attack or for critical hit?
sirmashni1
 
Posts: 18
Joined: Fri Mar 20, 2009 6:47 pm
Score: 0 Give a positive score

Re: need help plz

Postby skydereign » Wed Aug 05, 2009 9:47 pm

In the code have this.
Code: Select all
int chance = rand(2);
if(chance==1)
{
    // attack
}

rand(2) can give 0 or 1, making it a fifty percent chance. If you need help with the attack, I will need info about the attack itself.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: need help plz

Postby sirmashni1 » Wed Aug 05, 2009 10:01 pm

its ok thx! :D
sirmashni1
 
Posts: 18
Joined: Fri Mar 20, 2009 6:47 pm
Score: 0 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron