Check how many times state was applied?

Icenick

Veteran
Veteran
Joined
Mar 28, 2012
Messages
410
Reaction score
61
First Language
English
Primarily Uses
Im trying to have my weapon teach the actor a skill if the weapon is equipped and applied a specific state X times.

Im sure theres a better way but im trying to have a custom apply effect on state that checks if the actor has the weapon equipped and if switch 20 is off, if so it calls a common event. Once you learn the skill the switch being on will stop it from calling it.

Maybe I have the wrong scripts :S

STATE
Code:
<Custom Apply Effect>
if ($gameActors.actor(1).hasEquipped(16) && $gameSwitches.value(20) == false ) {
$gameTemp.reserveCommonEvent(6);
}
</Custom Apply Effect>
COMMON EVENT
Code:
Control Variables: 0010 += 1

if 0010 >= 20
Change Skill: Actor1, +Skill
Text: LEARNT!
Control Switches: 20 = ON
 

HumanNinjaToo

The Cheerful Pessimist
Veteran
Joined
Apr 18, 2013
Messages
1,226
Reaction score
603
First Language
English
Primarily Uses
RMMV
What plugins are you using?

If using Yanfly skill learn system plugin, you can make a skill notetag:
Learn Require Switch: x

This would allow the skill to appear in the actors 'learn skill' menu. Player would just need to buy the skill at that point, with whatever cost you have set.
 

Icenick

Veteran
Veteran
Joined
Mar 28, 2012
Messages
410
Reaction score
61
First Language
English
Primarily Uses
What plugins are you using?

If using Yanfly skill learn system plugin, you can make a skill notetag:
Learn Require Switch: x

This would allow the skill to appear in the actors 'learn skill' menu. Player would just need to buy the skill at that point, with whatever cost you have set.
Im using that plugin for magic skills, but im trying to make a system that learns special skills from weapons and armor.
Ideally with different ways to learn a skill, this one in particular requires you to inflict psn state 25 times and have the weapon equipped, at that point the skill would automatically be learnt.
 

HumanNinjaToo

The Cheerful Pessimist
Veteran
Joined
Apr 18, 2013
Messages
1,226
Reaction score
603
First Language
English
Primarily Uses
RMMV
Well I assumed you were using the variable to see how many times the state had been applied. Then when the variable gets to whatever you want it to be, you would turn on the switch that controls the skill being learned within your common event. Then the skill would appear in the actors 'skill learn' menu.

So you are saying you also need the weapon to be equipped to be able to use the new skill? or to learn the new skill, in conjunction with applying the state?

If you need to have the weapon equipped to use the new skill, does it need to be a particular weapon? or a weapon type? If it is weapon type, then there is a box to check in the skill database for that.

If you are wanting the skill to be learned without having to go to the actors 'skill learn' menu, then I think you could use a script call in your common event:

$gameActors.actor(actorId).learnSkill(x);
 

Icenick

Veteran
Veteran
Joined
Mar 28, 2012
Messages
410
Reaction score
61
First Language
English
Primarily Uses
Well I assumed you were using the variable to see how many times the state had been applied. Then when the variable gets to whatever you want it to be, you would turn on the switch that controls the skill being learned within your common event. Then the skill would appear in the actors 'skill learn' menu.

So you are saying you also need the weapon to be equipped to be able to use the new skill? or to learn the new skill, in conjunction with applying the state?

If you need to have the weapon equipped to use the new skill, does it need to be a particular weapon? or a weapon type? If it is weapon type, then there is a box to check in the skill database for that.

If you are wanting the skill to be learned without having to go to the actors 'skill learn' menu, then I think you could use a script call in your common event:

$gameActors.actor(actorId).learnSkill(x);
One of my party members will learn skills through gear. Instead of having it all done through JP or AP, I wanted to add some variety to the requirements of certain skills. Progress can only be achieved if the gear is currently being worn.

For example some skills will require X Kills or use the skill X times; this one in particular requires the character to inflict the psn state 25 times while having the poison dagger equipped.

Equip a poison dagger to learn the skill psn stab skill, while dagger is equipped the actor can use the skill at will, changing weapon will remove the skill. If you achieve the requirements you can permanently learn psn stab allowing you to no longer need the dagger equipped.

Ideally I would have a message in battle when the conditions are met indicting to the player that the skill is now learnt. Common events work great for that but I suppose I can just use a script to display text and perhaps an animation and sound, although I dont know how to do that.

The main issue im having is I dont know how to check if the character has a specific weapon equipped, and of course once its learnt, I can turn on a switch to no longer track progress.
 

HumanNinjaToo

The Cheerful Pessimist
Veteran
Joined
Apr 18, 2013
Messages
1,226
Reaction score
603
First Language
English
Primarily Uses
RMMV
I copied this from the script call list:

# Check for Name/ID of Player Equipment
# ----------------------------------------------
$game_actors[X].equips[Y].id unless $game_actors[X].equips[Y] == nil
# Returns the ID of the equipment on actor X, equipped in slot Y

$game_actors[X].equips[Y].name unless $game_actors[X].equips[Y] == nil
# Returns the name of the equipment on actor X equipped in slot

You could use a conditional branch to check if the particular weapon is equipped by the particular actor.
 

Icenick

Veteran
Veteran
Joined
Mar 28, 2012
Messages
410
Reaction score
61
First Language
English
Primarily Uses
I copied this from the script call list:

# Check for Name/ID of Player Equipment
# ----------------------------------------------
$game_actors[X].equips[Y].id unless $game_actors[X].equips[Y] == nil
# Returns the ID of the equipment on actor X, equipped in slot Y

$game_actors[X].equips[Y].name unless $game_actors[X].equips[Y] == nil
# Returns the name of the equipment on actor X equipped in slot

You could use a conditional branch to check if the particular weapon is equipped by the particular actor.
I dont know how that script is to be used. I got an error when I tried;
Code:
<Custom Apply Effect>
if ($game_actors[1].equips[1].id) {
$gameTemp.reserveCommonEvent(6);
}
</Custom Apply Effect>
You gave me a good idea but it didnt work either for reason im not sure. If I just do this to call Common Event
Code:
<Custom Apply Effect>
$gameTemp.reserveCommonEvent(6);
</Custom Apply Effect>
Then have it do everything in the common event, first check if switch is still off, then check if weapon is equipped, then add +1 to variable, finally learn skill and turn switch on to end the loop.
Code:
If Switch 20 is off                        // starts off so it should be good.
    If Actor has equipped PSN Dagger    // most consistent way to see if weapon is equipped.
        Control Variables X +1          // add 1 to variable.
            If Variable X >= 25         // if and when it hits 25.
                Add PSN Stab            // learn skill
                Text: YOU DID IT!        // show text
                Control Switch 20 is ON   // turns on switch 20 to never trigger this again.
        End
    End
End
I dont know why but it doesnt work like this either :S
 

HumanNinjaToo

The Cheerful Pessimist
Veteran
Joined
Apr 18, 2013
Messages
1,226
Reaction score
603
First Language
English
Primarily Uses
RMMV
Sorry I should have just posted a link to the master script call list.

Code:
if ($gameActors.actor(actorId).equips()[n]) {
return $gameActors.actor(actorId).equips()[n].id;
};
if ($gameActors.actor(actorId).equips()[n]) {
return $gameActors.actor(actorId).equips()[n].name;
};
I think the common event is not working because it would only add +1 to the variable each time the dagger is equipped. So the player would unequip then reequip the psn dagger 25 times to get the variable to 25.

EDIT: I don't know, it's hard for me to wrap my brain around a what goes on in the event without having the program opened up in front of me, and I'm at work for a few more hours yet.
 

Icenick

Veteran
Veteran
Joined
Mar 28, 2012
Messages
410
Reaction score
61
First Language
English
Primarily Uses
Sorry I should have just posted a link to the master script call list.

Code:
if ($gameActors.actor(actorId).equips()[n]) {
return $gameActors.actor(actorId).equips()[n].id;
};
if ($gameActors.actor(actorId).equips()[n]) {
return $gameActors.actor(actorId).equips()[n].name;
};
I think the common event is not working because it would only add +1 to the variable each time the dagger is equipped. So the player would unequip then reequip the psn dagger 25 times to get the variable to 25.

EDIT: I don't know, it's hard for me to wrap my brain around a what goes on in the event without having the program opened up in front of me, and I'm at work for a few more hours yet.
Thanks! I had a look at it before and I cant really make heads or tails of it.

Im sorry im really not understanding how to use the script :S
Tried this and nothing...
Code:
<Custom Apply Effect>
if ($gameActors.actor(1).equips()[n]) {
return $gameActors.actor(1).equips()[n].1;
$gameTemp.reserveCommonEvent(6);
};
</Custom Apply Effect>
No worries thanks for the help, going to give it a break for the evening, my head hurts trying to figure this out :( lol
 

HumanNinjaToo

The Cheerful Pessimist
Veteran
Joined
Apr 18, 2013
Messages
1,226
Reaction score
603
First Language
English
Primarily Uses
RMMV
It will work as a script call within your common event. Yanfly action sequences sometimes use slightly different JavaScript terms so to use it in the action sequence it will need to be tweaked a bit.
 

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

Latest Threads

Latest Profile Posts

Don't forget, aspiring writers: Personality isn't what your characters do, it is WHY they do it.
Hello! I would like to know if there are any pluggings or any way to customize how battles look?
I was thinking that when you start the battle for it to appear the eyes of your characters and opponents sorta like Ace Attorney.
Sadly I don't know how that would be possible so I would be needing help! If you can help me in any way I would really apreciate it!
The biggest debate we need to complete on which is better, Waffles or Pancakes?
rux
How is it going? :D
Day 9 of giveaways! 8 prizes today :D

Forum statistics

Threads
106,051
Messages
1,018,549
Members
137,836
Latest member
T62352536256t362
Top