Skill replaces skill when state is applied?

Morpheus

Jack-of-Trades
Veteran
Joined
Mar 14, 2012
Messages
232
Reaction score
85
First Language
english
Primarily Uses
N/A
Only one I could find is the Skill Replaces Skill script but I would need one that changes the skill depending on if a state is applied, as the actor can transform the attacks would have a different animation.
 

Aesica

undefined
Veteran
Joined
May 12, 2018
Messages
1,531
Reaction score
1,424
First Language
English
Primarily Uses
RMMV
Edit: Crap, just realized I ended up on the non-MV boards somehow. I'm not sure how much of this translates over to VXA or whatever this is for, so I'll leave it up anyway just in case yanfly has a non-MV equivalent of this. Sorry. :(

- - -

You can do that with Yanfly's skill core plugin using these note tags:

On the skill to swap out while the state is active:
<Custom Show Eval>
if (!user.hasSkill(NEW_SKILL_ID)) user.learnSkill(NEW_SKILL_ID);
visible = !user.isStateAffected(STATE_ID);
</Custom Show Eval>

On the skill to swap in while the state is active:
<Custom Show Eval>
visible = user.isStateAffected(STATE_ID);
</Custom Show Eval>

Replace NEW_SKILL_ID with the id of the skill that's going to replace the existing skill. Note that the actor will be taught this new skill permanently, but it'll never show unless the required state is active.

Replace STATE_ID with the state that's supposed to trigger the switch.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,425
Reaction score
7,710
First Language
German
Primarily Uses
RMMV
how much of this translates over to VXA
it doesn't, because the coding language is completely different - RGSS3 instead of Javascript.
And the notetag is completely dependent on a plugin as notes do nothing by default - there are notetags in VXA as well, but they also depend on the scripts installed in that editor.

@Morpheus an alternative that doesn't use any script or plugin would be to have the state seal the old skill and add a new skill by features of the state. Unfortunately that would not completely hide or replace the old skill, only disable it. For a true replace you'll need a script.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,108
Reaction score
13,713
First Language
English
Primarily Uses
RMMV
Something like this?

 

Morpheus

Jack-of-Trades
Veteran
Joined
Mar 14, 2012
Messages
232
Reaction score
85
First Language
english
Primarily Uses
N/A
Something like this?

I'll try it out. I see it's your script, so, off the top of your head do you know the command to add/remove a skill?
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,108
Reaction score
13,713
First Language
English
Primarily Uses
RMMV
It's just learn_skill(id) or forget_skill(id)
where id is the skill id, with no leading zeros.

(that wasn't off the top of my head - if I'd done that I would have gotten it wrong :D )
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,599
Reaction score
6,552
First Language
Indonesian
Primarily Uses
RMVXA
it doesn't, because the coding language is completely different - RGSS3 instead of Javascript.
And the notetag is completely dependent on a plugin as notes do nothing by default - there are notetags in VXA as well, but they also depend on the scripts installed in that editor.
Challenge accepted I will make this possible.

Code:
class RPG::Skill
  
  def custom_show_eval
    unless @custom_show_eval
      script = "return true"
      load = false
      note.split(/[\r\n]+/).each do |line|
        case line 
        when /<custom show eval>/i
          script = ""
          load = true
        when /<\/custom show eval>/i
          load = false
        else
          if load
            script += line
          end
        end
      end
      name = "custom_show_eval_ex"
      eval("create_method(:#{name}) {#{script}}")
      @custom_show_eval = true
    end
    custom_show_eval_ex
  end
  
  def create_method(name, &block)
    self.class.send(:define_method, name, &block)
  end
  
end

class Window_SkillList
  alias skill_included? include?
  def include?(item)
    return skill_included?(item) && item.custom_show_eval
  end
end
This code enable you to show/hide skill based on script condition.
This notetag translates into
On the skill to swap out while the state is active:
<Custom Show Eval>
if (!user.hasSkill(NEW_SKILL_ID)) user.learnSkill(NEW_SKILL_ID);
visible = !user.isStateAffected(STATE_ID);
</Custom Show Eval>
Code:
<custom show eval>
return !state?(STATE_ID)
</custom show eval>
And this notetag translates into
On the skill to swap in while the state is active:
<Custom Show Eval>
visible = user.isStateAffected(STATE_ID);
</Custom Show Eval>
Code:
<custom show eval>
return state?(STATE_ID)
</custom show eval>
 

Morpheus

Jack-of-Trades
Veteran
Joined
Mar 14, 2012
Messages
232
Reaction score
85
First Language
english
Primarily Uses
N/A
It's just learn_skill(id) or forget_skill(id)
where id is the skill id, with no leading zeros.

(that wasn't off the top of my head - if I'd done that I would have gotten it wrong :D )
Okay, it works however the thing we didn't account for was if the player has even learned the skill yet. Like let's say one skill that might change is unlocked at level 30 but the player can transform at level 15, if the player hasn't learned the skill yet then it gives them the skill.
Any idea of a workaround? Currently I'm using a common event to check all of this but the event will be quite long.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,108
Reaction score
13,713
First Language
English
Primarily Uses
RMMV
learn_skill(skill2.id) if @skills.include?(skill1.id)
forget_skill(skill1.id)

you don't need to do a test when forgetting, as if it's not learned, it just won't do anything.

So the above will learn skill 2 if skill 1 is learned, and will then forget skill 2.
 

Aesica

undefined
Veteran
Joined
May 12, 2018
Messages
1,531
Reaction score
1,424
First Language
English
Primarily Uses
RMMV
it doesn't, because the coding language is completely different - RGSS3 instead of Javascript.
And the notetag is completely dependent on a plugin as notes do nothing by default - there are notetags in VXA as well, but they also depend on the scripts installed in that editor.
I knew the language was different, but wasn't sure how much of a similarity existed between yanfly's note tags here vs MV. I know Yanfly did his thing before MV came around, but wasn't sure how much was directly ported over (and thus, similar tag usage) vs how much was brand new for MV.

Also, one could argue that MV's note tags are mostly reliant on plugins as well, since most plugin devs make their own note tag parsing functions for a number of reasons (case insensitivity, <tag></tag> style, etc)

Anyhow, hopefully I'm not derailing too much. Good luck to the OP. :)
 

Morpheus

Jack-of-Trades
Veteran
Joined
Mar 14, 2012
Messages
232
Reaction score
85
First Language
english
Primarily Uses
N/A
learn_skill(skill2.id) if @skills.include?(skill1.id)
forget_skill(skill1.id)

you don't need to do a test when forgetting, as if it's not learned, it just won't do anything.

So the above will learn skill 2 if skill 1 is learned, and will then forget skill 2.
Sorry it took awhile to reply back, I had to mess around with some settings to get this to do what I wanted as my actors will have varying levels of transformations but it all worked out in the end, thank you SO much for the script and the very fast help!
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,425
Reaction score
7,710
First Language
German
Primarily Uses
RMMV
similarity existed between yanfly's note tags here vs MV.
you misunderstood how those notetags work.
There are two different types of notetags (both in Ace and MV) - text-type notetags and eval-type notetags.
Text notetags would be handled completely by the script or plugin, and those could be identical depending on how the script or plugin was written.

Eval-type notetags (or 'lunatic' notetags as yanfly called them) however are only passed through the script or plugin and given to the language interpreter. They always have to be code-snippets in the language that the entire engine is written about, because the script or plugin does nothing with them, it just sends them on to the engine.

And that is why those notetags can never be transferred between Ace and MV without rewriting them into a different code language.
 

Aesica

undefined
Veteran
Joined
May 12, 2018
Messages
1,531
Reaction score
1,424
First Language
English
Primarily Uses
RMMV
you misunderstood how those notetags work.
There are two different types of notetags (both in Ace and MV) - text-type notetags and eval-type notetags.
Err technically, they're both the same type of note tag, and its just the plugin/script/whatever that decides what the contents mean. There's nothing stopping a plugin creator from utilizing note tags that contain both standard text and eval snippets in the same tag, like so:

<Replace Attack>25, user.hp / user.mhp < 0.5</Replace Attack>

I mean yeah, I *know* the code portions of what I posted won't work with VXA and I should've probably been clearer with my "oops" edit. What I meant was that, if Yanfly had a VXA version of his skill core plugin with similar note tag functionality, the note tag contents could've been adapted for ruby or whatever it uses.
 

MushroomCake28

KAMO Studio
Global Mod
Joined
Nov 18, 2015
Messages
3,729
Reaction score
4,685
First Language
English
Primarily Uses
RMMZ
@Aesica @Andar Interesting conversation on notetags between VXA and MV, but let's try to stay on topic in this thread for OP. Thank you.
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.
Can someone recommend some fun story-heavy RPGs to me? Coming up with good gameplay is a nightmare! I was thinking of making some gameplay platforming-based, but that doesn't work well in RPG form*. I also was thinking of removing battles, but that would be too much like OneShot. I don't even know how to make good puzzles!
one bad plugin combo later and one of my followers is moonwalking off the screen on his own... I didn't even more yet on the new map lol.
time for a new avatar :)

Forum statistics

Threads
106,018
Messages
1,018,358
Members
137,803
Latest member
andrewcole
Top