Help - Search - Members - Calendar
Full Version: Probability (luck) script call
RPG RPG Revolution Forums > Scripting > Script Development and Support > RGSS2
Dogghy
Hi fellas!

I wanna do something like the following with the "call script" command:

If the player have >= 50% MP can do an action, otherwise he can't.

And the last one is:

If the player have >= 50% luck (not intended as STATS) can find an item, otherwise he can't

I really dunno how to write these things in that commad.
Can someone help me?
Thank you for your patient.
Night_Runner
To access a player you can either use
CODE
$game_party.members[0]

Where 0 means the first member in the party. or
CODE
$game_actors[1]

Where 1 means the first actor in the database

So in the conditional branch you can run the script:
CODE
$game_party.members[0].sp >= $game_party.members[0].maxsp / 2

or
CODE
if $game_party.members[0].sp >=
   $game_party.members[0].maxsp / 2
p 'Over half SP'
else
p 'Under half SP'
end




And I'm not really sure how you planned on implementing luck, if you wanted to use variables I suppose you could do something like
CODE
Control Variables: [0001: Actor1 LUCK] = 50
Control Variables: [0002: Actor1 MAXLUCK] = 100

Using the control variable command and then with code
CODE
luck = $game_variables[1]
maxluck = $game_variables[2]
if luck >= maxluck / 2
p 'Feeling Lucky!'
else
p 'Feeling Unlucky'
end

Or once again if it were in a conditional branch
CODE
$game_variables[1] >= $game_variables[2] / 2
Dogghy
Thank you !
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.