Script help on actors and skills.

Lordkazar

Villager
Member
Joined
Dec 23, 2013
Messages
24
Reaction score
1
First Language
English
Primarily Uses
I could use help on another script if any one has time please.
I think I'm getting better, but then I run into another one that stumps me.


If : Script: $gameActors.actor(5).Skill($gameVariables.value(11), true)

$gameActors.actor(5).Skill($gameVariables.value(11), true)

So I want it to check if actor #5 has Skill #x where x is Variable#11.



Thanks
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
And what's happening when you try? Are you getting an error message? We need to know what it says.

$gameActors.actor(5).isLearnedSkill($gameVariables.value(11))returns true if the actor has the skill whose id is in variable 11, and false if they don't.
You don't need to pass true into it.


Here's a good way to start learning - if it's something you can do via event command, look at the rpg_objects.js file at the Game_Interpreter class. With your cursor on that line, search for the name that appears on the event command button. In this case, it's in Conditional Branch, so I searched for Conditional Branch. The 'cases' listed in that function all correspond to the different options you can choose for Conditional Branch. Case 4 is Actor, and underneath that you'll find Skill, which returns actor.isLearnedSkill(n)
 

Lordkazar

Villager
Member
Joined
Dec 23, 2013
Messages
24
Reaction score
1
First Language
English
Primarily Uses
Here is a picture of the way i had it, and the error.

Thanks for the advice Shaz. I will try actor.isLearnedSkill(n) and look into that file for reference.

 
 

Lordkazar

Villager
Member
Joined
Dec 23, 2013
Messages
24
Reaction score
1
First Language
English
Primarily Uses
the formula sees skills added by level up, but it does not seem to reconize a skill added from an equipped item as a learned skill. is that a bug or is there a differnt way or formula for that?
 

And what's happening when you try? Are you getting an error message? We need to know what it says.
 

Code:
$gameActors.actor(5).isLearnedSkill($gameVariables.value(11))
returns true if the actor has the skill whose id is in variable 11, and false if they don't.


You don't need to pass true into it.

Here's a good way to start learning - if it's something you can do via event command, look at the rpg_objects.js file at the Game_Interpreter class. With your cursor on that line, search for the name that appears on the event command button. In this case, it's in Conditional Branch, so I searched for Conditional Branch. The 'cases' listed in that function all correspond to the different options you can choose for Conditional Branch. Case 4 is Actor, and underneath that you'll find Skill, which returns actor.isLearnedSkill(n)
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,674
First Language
German
Primarily Uses
RMMV
the formula sees skills added by level up, but it does not seem to reconize a skill added from an equipped item as a learned skill. is that a bug or is there a differnt way or formula for that?
That is because skills added by equipping items aren't learned, they vanish as soon as the item is unequipped. It's a different way to store the skills on the actor, and it's intentional as different.
Can you tell us what you want the code to use for in your game? there are usually several ways to do something with different advantages and disadvantages, but without knowing your intention we can't give better help.
 

Lordkazar

Villager
Member
Joined
Dec 23, 2013
Messages
24
Reaction score
1
First Language
English
Primarily Uses
I am trying to do a open world game and i want to have objects in the game that can only be removed if the user has a certain skill no matter how they attained that skill, and also have various interactions changed by those skills.
 

YuuHkiSay

Villager
Member
Joined
Jan 25, 2016
Messages
6
Reaction score
0
First Language
English
Primarily Uses
This may be kinda late, but I figured i'd put this in case others saw this.


You can use the Conditional Branch to check if an Actor has equipped a piece of equipment and add a skill to that actor's learnedSkills list. You just have to make a Common Event with the Trigger set to Parallel and have a Switch set to ON for it to do anything.


Then in whatever Event you're wanting to check the Actors' learnedSkills, just have a Conditional Branch check if the skill is learned.


That should get what you're looking for.

Blah.png
 

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

Latest Threads

Latest Posts

Latest Profile Posts

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
How many parameters is 'too many'??

Forum statistics

Threads
105,862
Messages
1,017,049
Members
137,570
Latest member
fgfhdfg
Top