Ferry66 3 Posted January 15, 2017 Is it possible to bind the remaining percentage of MP (or TP for that matter) to a state? For example: a mage uses all of its MP and automatically gets the ''Exhausted'' state which will immobilize him, or a warrior uses gets to 50% of its TP and gets a state that lowers its damage. Share this post Link to post Share on other sites
Tarq 746 Posted January 16, 2017 Hmm, have you tried running a conditional via common events? (I get the feeling common events might only run on the map screen though. Unsure) If the above doesn't work you'll probably have to delve into the script editor. Just put the same conditional: if $game_actors[x]. mp == x $game_actors[x].state?[x] (actually think this one is for checking not applying but you'll find the right one via google) end but stick it in turn end processing found Game_Battle or something. (Sorry, can't be more accurate, in work so don't have the editor in front of me) 1 Share this post Link to post Share on other sites
Ferry66 3 Posted January 16, 2017 Hmm, have you tried running a conditional via common events? (I get the feeling common events might only run on the map screen though. Unsure) If the above doesn't work you'll probably have to delve into the script editor. Just put the same conditional: if $game_actors[x]. mp == x $game_actors[x].state?[x] (actually think this one is for checking not applying but you'll find the right one via google) end but stick it in turn end processing found Game_Battle or something. (Sorry, can't be more accurate, in work so don't have the editor in front of me) Please do elaborate. I am in need of both a script that adds a state on a % of mp/tp and one that removes said state when over this %. Tried using several scripts like $game_party.battle_members.each {|a| a.add_state(x)} but they don't do the trick. Share this post Link to post Share on other sites
Tarq 746 Posted January 17, 2017 Hmm, that script call looks more or less how I remember it. I've got an old project where I did something along these lines so I'll edit this later with the right script call. As for removing it it would be much the same. In pseudocode it would look like: If hp <= 50% add state else remove state end To give you an idea of how this would work (assuming the snippet is placed in turn end processing): Turn1: Actor starts with full hp. Takes 70% damage. State applied on turn end. Turn2: Actor has 30% hp. Actor heals by 30%. State removed on turn end. Turn3 Actor has 60% hp..... and so on. --------------------------------------------------------------------------------------------------------------------------------------------------------------------- Yup that script call is correct. so yours should look something like: if $game_actors[1].hp <= $game_actors[1].mhp / 2$game_party.battle_members.each {|a| a.add_state(1)} else $game_party.battle_members.each {|a| a.remove_state(1)}end And you'll want to place it around line 300 of BattleManager (assuming you haven't made any changes there already) Now, since your game probably has more than one party member your condition (the bit directly after 'if') will need to be a bit different. You might be able to hardcode it by simply copying that for each member (ie. ...actors[2], ...actors[3]) but I think each would interfere with each other. Something worth testing but I think someone better at this stuff is going to have to step in at this point. 1 Share this post Link to post Share on other sites
Cookie Ninja 374 Posted January 18, 2017 May I suggest another syntax, the way I read your code Tarq: if actor 1 has less then half hp add state to ALL battle members. $game_party.battle_members.each { |actor| if [1, 3, 5].include?(actor.id) && actor.hp <= actor.mhp / 2 actor.add_state(1) else actor.remove_state(1) end if [2, 3, 4].include?(actor.id) && actor.mp == 0 actor.add_state(2) else actor.remove_state(2) end } This way you can simply add actor id to the corresponding array. I haven't tested it but I think only some minor modification may be needed. 1 Share this post Link to post Share on other sites
Tarq 746 Posted January 18, 2017 I thought as much Cookie (I've never had to mess around with multiple party members before) Let us know how you get on Ferry. If there's no problems we can close this. Share this post Link to post Share on other sites
Ferry66 3 Posted January 18, 2017 May I suggest another syntax, the way I read your code Tarq: if actor 1 has less then half hp add state to ALL battle members. $game_party.battle_members.each { |actor| if [1, 3, 5].include?(actor.id) && actor.hp <= actor.mhp / 2 actor.add_state(1) else actor.remove_state(1) end if [2, 3, 4].include?(actor.id) && actor.mp == 0 actor.add_state(2) else actor.remove_state(2) end } This way you can simply add actor id to the corresponding array. I haven't tested it but I think only some minor modification may be needed. Been trying using this: def $game_party.battle_members.each { |actor| if [1,2, 3, 4].include?(actor.id 1) && actor.mp <= actor.mmp / 2 actor.add_state(31) else actor.remove_state(31) end But it doesn't apply the state. What do? Share this post Link to post Share on other sites