Main Menu
  • Welcome to The RPG Maker Resource Kit.

Conditional Branch Script

Started by VampireHSS, January 29, 2006, 02:59:15 PM

0 Members and 1 Guest are viewing this topic.

VampireHSS

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

Dwarra?

a little more specific? and if you want a certain conditional branch youll need events not scripts

Tsunokiette

Quote from: VampireHSSCould 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."

VampireHSS

Quoteif $game_party.actors[1].class_name == 'Class Name'
Is it suposed to become like this:
Quoteif $game_party.actors[1].class_name == 003: Mage
????
<3 phenom
<3 Hypnotic

Zeriab

Quote from: VampireHSS
Quoteif $game_party.actors[1].class_name == 'Class Name'
Is it suposed to become like this:
Quoteif $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

VampireHSS

<3 phenom
<3 Hypnotic

Zeriab

Quote from: VampireHSSCould 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:

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

VampireHSS

Quoteif $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

Zeriab

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:

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

VampireHSS

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

Zeriab

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.

VampireHSS

Well... in the condition branch script line i put this:
Quoteif $data_actors[1].class_id == 3
So it is this:
QuoteContitional 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

Zeriab

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

blueXx

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!

VampireHSS

<3 phenom
<3 Hypnotic

Tsunokiette

Quote from: ZeriabAlso 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."

Zeriab

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.