Changing features in-game

Thank you Fomar 🙂 I'm not going to spend much more time on this tonight, but I'll play around with your snippet and will come back if I still have issues.

BTW - what if I wanted to CHANGE a feature, rather than adding or removing one?
Sorry you'd have to remove it and add a new version.

Code:
f = $game_actors[1].features_with_id(code, id)g = f.select {|ft| ft.value == 1.0}$game_actors[1].del_features += g
And then add it again with a new value:
Code:
f = RPG::BaseItem::Feature.new(code, data_id, value)$game_actors[1].add_features.push(f)
Only thing to watch is this will override feautres added by states but I don't think it's likely states will have the features you want to change on the fly.
I am not sure whether changing features in objects is a good idea.

At least, when I was writing an API for it, I ran into various issues. Maybe I over-thought the problem and fomar's solution is optimal. Not sure.

If you want features to be temporary, use states. Use permanent states or passive states that can be removed using event calls.

That's what states are for: "changing" features on your actors by simply adding or removing them. You can manage the state easily through the database editor and no need for sketchy script calls that are brute-forcing an array of features that could be obtained from arbitrary sources.
mmm ... so in this case I could add a state that has an equip lock to my character, and remove it when I add her to the party the second time? That's much more simple. Thanks - I'll give that a go first, and if it doesn't work, I'll use the script mod 🙂


This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/changing-features-in-game.15183/