RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
Conditional Branch Script

0 Members and 1 Guest are viewing this topic.

**
Rep:
Level 89
Developer
Could someone make me a Conditional Branch Script: If hero 001 class is 003
Please
<3 phenom
<3 Hypnotic

*
Rep:
Level 97
Secret Santa 2013 ParticipantSecret Santa 2012 Participant2011 Most Successful Troll
a little more specific? and if you want a certain conditional branch youll need events not scripts

*
Full Metal Mod - He will pillage your women!
Rep:
Level 93
The RGSS Dude
Quote from: VampireHSS
Could someone make me a Conditional Branch Script: If hero 001 class is 003
Please


if $game_party.actors[1].class_name == 'Class Name'

end

that should work
"The wonderful thing about Tiggers
Is Tiggers are wonderful things
Their tops are made out of rubber
Their bottoms are made out of springs

They’re bouncy, trouncy, flouncy, pouncy
Fun, fun, fun, fun, fun!
But the most wonderful thing about Tiggers
Is I’m the only one, I’m the only one."

**
Rep:
Level 89
Developer
Quote
if $game_party.actors[1].class_name == 'Class Name'

Is it suposed to become like this:
Quote
if $game_party.actors[1].class_name == 003: Mage

????
<3 phenom
<3 Hypnotic

*
? ? ? ? ? ? ? ? ? The nice kind of alien~
Rep:
Level 92
Martian - Occasionally kind
Quote from: VampireHSS
Quote
if $game_party.actors[1].class_name == 'Class Name'

Is it suposed to become like this:
Quote
if $game_party.actors[1].class_name == 003: Mage

????

No, It's supposed to be like this:

if $game_party.actors[1].class_name == "Mage"

end

**
Rep:
Level 89
Developer
It's not working
<3 phenom
<3 Hypnotic

*
? ? ? ? ? ? ? ? ? The nice kind of alien~
Rep:
Level 92
Martian - Occasionally kind
Quote from: VampireHSS
Could someone make me a Conditional Branch Script: If hero 001 class is 003
Please


Meh, I haven't read the post properly. What you asking for is to check if hero number 001 in the database have the class set to 003, right? If so what you want is this:

Code: [Select]
if $data_actors[1].class_id == 3
  #write code here
end

**
Rep:
Level 89
Developer
Quote
if $data_actors[1].class_id == 3
  #write code here
end

What do you mean by "write code here" ? Is it suposed for me to do anything there?
<3 phenom
<3 Hypnotic

*
? ? ? ? ? ? ? ? ? The nice kind of alien~
Rep:
Level 92
Martian - Occasionally kind
Yes, sorry if it was obvious what you should do. You are supposed to write whatever you want to happen when the conditions are fulfilled. Also if you want something else to happen if the condition is not fulfilled use this:

Code: [Select]
if $data_actors[1].class_id == 3
 
else
 
end


@Tsu I think you are forgetting that the first hero is $game_party.actors[0], not 1.

Edit: Corrected the note to Tsu

**
Rep:
Level 89
Developer
Oh, now I'm understanding. LOL  :oops:
It doesn't work. It says syntax error
<3 phenom
<3 Hypnotic

*
? ? ? ? ? ? ? ? ? The nice kind of alien~
Rep:
Level 92
Martian - Occasionally kind
What exactly have you written? (Remember casing is important!)

Also if you used my note to Tsu, that would explain the error, because it was wrong. I have corrected it I think.

**
Rep:
Level 89
Developer
Well... in the condition branch script line i put this:
Quote
if $data_actors[1].class_id == 3

So it is this:
Quote
Contitional Branch: Script: if $data_actors[1].class_id == 3
Message: Done
else
Message: NOOOOOOOOOOOOOOOOO
end


This is what I've done to test it.
<3 phenom
<3 Hypnotic

*
? ? ? ? ? ? ? ? ? The nice kind of alien~
Rep:
Level 92
Martian - Occasionally kind
I totally misunderstood what you meant.  :whoa:

No wonder you get a syntax error.
In the script you want to end up with a boolean. If you write true you will get the message "Done" shown. If you writefalse you will get the message "NOOOOOOOOOOOOOOOOO" shown.
Don't worry, the fix is easy. Just delete the if. This should fix the matter.

Edit: Just enter $data_actors[1].class_id == 3

******
Rep:
Level 91
i am wondering:
if you need to condition the job therefore it is changed in the game correct?
if not just work as you setted it in the db
if i am right, after the change make a variable operation
(1 = warrior, 2 = something else 3= mage, like their position in the database)

then you can conditional "if variable(jobs) = 3 then"
and that will solve everything
holy shit my sig was big!

**
Rep:
Level 89
Developer
THANKS Zeriab
<3 phenom
<3 Hypnotic

*
Full Metal Mod - He will pillage your women!
Rep:
Level 93
The RGSS Dude
Quote from: Zeriab
Also if you used my note to Tsu, that would explain the error, because it was wrong. I have corrected it I think.


In response to teh note, the $game_party.actors array actualy starts at 1 as opposed to 0, that's one way enterbrain found they could screw with us lol. :lol:
"The wonderful thing about Tiggers
Is Tiggers are wonderful things
Their tops are made out of rubber
Their bottoms are made out of springs

They’re bouncy, trouncy, flouncy, pouncy
Fun, fun, fun, fun, fun!
But the most wonderful thing about Tiggers
Is I’m the only one, I’m the only one."

*
? ? ? ? ? ? ? ? ? The nice kind of alien~
Rep:
Level 92
Martian - Occasionally kind
I know. That's why I always test if $something[1] really is number one.
It might have something to do with hashes starting at 1 and arrays at 0 or the other way around, but when you don't have to declare the type a common good thing to do is to test if what you think you get really is what you get.