Troop Script Call Help

Joined
Apr 17, 2013
Messages
283
Reaction score
5
First Language
English
Primarily Uses
I was wondering if there's a command or script line that would allow the game to check what troop you're fighting for different results.

For example, if I used a move called "Bargain" on a troop of rats. The game would reply with the character saying "These rats don't understand me."

And if I'm fighting a thief and I use the move "Bargain". The game would reply with something else because of a different troop.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
$game_troop.troop_id will give you the troop id from the database.


$game_troop.troop.name will give you the name.
 
Joined
Apr 17, 2013
Messages
283
Reaction score
5
First Language
English
Primarily Uses
So this would work for a conditional branch I assume?
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
No. If you wanted to see if you were battling troop 1, you'd do this:

Code:
$game_troop.troop_id == 1
as a Script in the Conditional Branch
 
Joined
Apr 17, 2013
Messages
283
Reaction score
5
First Language
English
Primarily Uses
No. If you wanted to see if you were battling troop 1, you'd do this:

$game_troop.troop_id == 1as a Script in the Conditional Branch
I set the script to happen when I used the move and it crashed the game.

Am I doing something wrong?
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
Sorry - I assumed troop_id was an attr_reader.


If it still gives you an error, can you tell us what the error message is? If it doesn't give you an error but still doesn't work, post a screenshot of how you've got the skill and the common event set up so we can take a look.
 
Last edited by a moderator:
Joined
Apr 17, 2013
Messages
283
Reaction score
5
First Language
English
Primarily Uses
Sorry - I assumed troop_id was an attr_reader.

If it still gives you an error, can you tell us what the error message is? If it doesn't give you an error but still doesn't work, post a screenshot of how you've got the skill and the common event set up so we can take a look.
http://www.mediafire.com/view/esm0wocbj71rmb4/commonevent.PNG

The skill when used, starts the common event which uses this line of script. What I'm wanting is for it to check the troop/enemy and give different dialog depending on what it is.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,676
First Language
German
Primarily Uses
RMMV
Did you change the default battle system?


And is that CE called inside a battle?


That call will only work if the skill is used during battles, because if the skill is used outside of battle the troop is not defined...
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
is it still giving you the error? Did you make the fix indicated by Hime?
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD

Forum statistics

Threads
105,868
Messages
1,017,074
Members
137,578
Latest member
JamesLightning
Top