Jump to content
New account registrations are disabed. This website is now an archive. Read more here.
Sign in to follow this  
BabaDaba

Condition problem

Recommended Posts

Hye, i just started to use RMXP for about a week, and i having a great time until this problem occur.

 

My problem is, how to make an event that only can be triggered only when your party/actor is at certain level?

 

example: I wanted to make an area is accessible if only my party/actor level is level 10 or above.

 

elok.jpg

these is what the event that works, that transfer me to the next map without level restriction

 

xjadi.jpg

this is what i am trying to do, putting level restriction.

 

im not sure about what im doing, is this totally wrong, or i got idea there. please help me with this.

Share this post


Link to post
Share on other sites

If you want an average based on the party's level, use this in a 'Script...' event:

a = 0
for i in 0...$game_party.actors.size
a += $game_party.actors[i].level
end
b = $game_party.actors.size
$game_variables[1] = a / b

 

And this will set your party's average level in variable 1.

Granted, you want to use this code snippet right before checking the variable.

 

Now, if you want just a particular actor, you go to the fourth tab of the conditional branch, select 'script', and put this in:

$game_actors[x].level >= y

TO use this, x will equal the actor's id number, and the y is the level it must be equal to or greater than.

Share this post


Link to post
Share on other sites
If you want an average based on the party's level, use this in a 'Script...' event:

a = 0
for i in 0...$game_party.actors.size
a += $game_party.actors[i].level
end
b = $game_party.actors.size
$game_variables[1] = a / b

 

And this will set your party's average level in variable 1.

Granted, you want to use this code snippet right before checking the variable.

 

I have no problem with the second code..but with the first code, could you explain more detail?..If i put the the code in the 'script...' event, how do i put the script in conditional branch? can i make the NPC to say "you can not proceed unless your party is at level x" and if my party meet the condition, the NPC says something like "you may proceed, may the force be with you" screen shot would be great..thank you for your time

Share this post


Link to post
Share on other sites

With the first one, you use the script command, then use the conditional branch. Such as:

 

Script Command: (The code i showed)

Conditional Branch comparing variable 1 with X; X being the level you want the party's average at.

Share this post


Link to post
Share on other sites

Why are you using scripts?

 

It can be easily done via this event coding:

 

@>Text: Where do you want to go?
@>Show Choices: Fantasy Island, Nothing
: When [Fantasy Island]
  @>Control Variables: [0001: Level] = [PLAYER]'s Level
  @>Conditional Branch: Variable [0001: Level] >= 10
  @>Text: Okay, Have a nice trip
  @>Transfer Player:[003: Fantasy Island], (012,012)
  @>
:  Else
  @>Text: You must be at least level 10 to do that.
  @>
:  Branch End
  @>
: When [Nothing]
  @>Text: Okay, bye
  @>
: When [Cancel]
  @>Text: Okay, bye
  @>
: Branch End
@>

 

To make it for every player, make 4 variables which you then use the variable command above to store all 4 levels, then go to the conditional branch and add another one with the same else conditioner until you have done all 4 players. Once that is done, make sure to place the teleport event into the last conditional branch.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...