Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Reply to this topicStart new topic
> Probability (luck) script call
Dogghy
post Nov 3 2011, 05:14 AM
Post #1


Level 1
Group Icon

Group: Member
Posts: 10
Type: None
RM Skill: Undisclosed




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.

This post has been edited by Dogghy: Nov 3 2011, 05:16 AM
Go to the top of the page
 
+Quote Post
   
Night_Runner
post Nov 4 2011, 05:46 PM
Post #2


Level 50
Group Icon

Group: +Gold Member
Posts: 1,525
Type: Scripter
RM Skill: Undisclosed




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


__________________________
K.I.S.S.
Want help with your scripting problems? Upload a demo! Or at the very least; provide links to the scripts in question.

Most important guide ever: Newbie's Guide to Switches
Go to the top of the page
 
+Quote Post
   
Dogghy
post Nov 5 2011, 04:12 AM
Post #3


Level 1
Group Icon

Group: Member
Posts: 10
Type: None
RM Skill: Undisclosed




Thank you !
Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 23rd May 2013 - 05:31 AM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker