Death by having full MP

Discussion in 'RGSS3 Script Requests' started by romoku, Jan 18, 2017.

  1. romoku

    romoku Veteran Veteran

    Messages:
    33
    Likes Received:
    7
    First Language:
    Hungarian
    Greetings!
    I recently came across a problem in my project. I was searching for a script which made it possible for specific actors to die if they reach 100% mana. However i could not find anything. I never touched the world of scripts myself so i would like to have a little help. What i need is a script, which creates a new death state and applies it to specific actors if their mana is full. They can die by regular means aswell this would be just an extra thing too look out for. Because in my game the mages has sort of like a brain capacity which is gradually filled up by casting spells and if their "mana" reaches a 100% their brain would fry therefore they would be killed. I tried making it work inside the game via variables and switches and stuff but with nothing coming out as a result. Hope anyone can help. Thank you for your time, have a safe night.
     
    #1
  2. bgillisp

    bgillisp Global Moderators Global Mod

    Messages:
    11,020
    Likes Received:
    10,813
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    RMVXA
    I've moved this thread to RGSSx Script Requests. Please be sure to post your threads in the correct forum next time. Thank you.



    RGSS3 Scripts is for completed scripts you wrote.


    That being said, this is going to be complicated to write, as the engine defaults to giving all enemies full MP, and all players start with full MP as weill be default. So what you propose would kill everyone upon creation by the engine. That means you'll need a script to rewrite how MP is handled when the enemy and player is created by the engine, and then one to handle the state.


    It might work easier if you did it in reserve, as in full mana means fine, and 0% means you fried yourself. I think there might be scripts for adding a state when you are at or below x MP that you can use in that case (I tried to write one for at or below x mana, but its buggy as can be. If you can get it to work, feel free to use it, as I had to stop work on it as I don't need it for my project right now).
     
    #2
  3. romoku

    romoku Veteran Veteran

    Messages:
    33
    Likes Received:
    7
    First Language:
    Hungarian
    ohh dang sorry will look around better next time :)  Yeah but everything i found was for the whole party. And with a bit more diverse cast where some dont use magic its kind of hard to make it happen. Well another dead idea then...


    EDIT
    I found a thread which even includes specific actors so i think its solved :)
     
    Last edited by a moderator: Jan 18, 2017
    #3
  4. RHachicho

    RHachicho Veteran Veteran

    Messages:
    262
    Likes Received:
    125
    Location:
    Basildon, United Kingdom
    First Language:
    English
    Hmm .. I really like this idea. Do you think it work well to make physical skills also cost mp .. so you have a fighter/mage that builds up mana as they cast but can then discharge it through physical skills into an enemy. So in order to be most effective they need to alternate physical and magical skills XD. 


    It would be very powerful .. but you could also add other caveats like their physical skills cost items too .. or drain their hp XD. 


    Sorry you just kinda fed my imagination a bit .. There was a class i was kind of wondering how to do mechanics for. Now I'm sure. I think I wont do it quite the same way but I think when she hits 100% man she goes insane and starts attacking her allies lol. 
     
    #4
  5. Sekunri

    Sekunri Creator of Worlds Veteran

    Messages:
    132
    Likes Received:
    72
    Location:
    South Carolina, USA
    First Language:
    English
    Primarily Uses:
    RMMV
    This is in VX so unfortunately my memory of scripts available is near non-existant however you could always use the Troops Page to put a condition for reaching max mp for specific actors. Least I think you can. Good luck, it sounds interesting mechanics wise.

    Also doing it this way only affects Actors so it'll be as if enemies have perfect awareness of their mana. You'll want to lower your teams MP manually after inn-stays and at game initialization if you use this way though. Which sucks but its a way to test things until a script is made.
     
    #5
  6. Harosata

    Harosata Dramatic Lightning's BFF Veteran

    Messages:
    226
    Likes Received:
    63
    First Language:
    English
    Primarily Uses:
    RMVXA
    You think it be solved, I think there be time to still solve it.


    class Game_BattlerBase

    def refresh
    state_resist_set.each {|state_id| erase_state(state_id) }
    @hp = [[@hp, mhp].min, 0].max
    @mp = [[@mp, mmp].min, 0].max
    @hp == 0 ? add_state(death_state_id) : remove_state(death_state_id)
    end

    end


    This is the default refresh method.  See how it applies death at 0 hp?


    First, you can write this method for class Game_Actor < Game_Battler (as Game_Battler builds on Game_BattlerBase) so that the modified refresh will work on party members.  Next, you would add a line like @mp == mmp ? add_state(death_state_id) : remove_state(death_state_id) .  This line is a shorthand for if-else statement and it's basically saying add state if true and remove if false.  Also, since you are looking for specific characters, you would also need a condition like if or case (or create an array and use .include?) and check for .id .


    As people pointed out, the crux of your 100% MP death is how often 100% MP comes up.  So you'll have to change methods that restore MP or don't touch MP.  For example:


    class Game_Battler < Game_BattlerBase

    def revive
    @hp = 1 if @hp == 0
    end

    end

    Code:
    class Game_BattlerBase
    
    def recover_all
      clear_states
      @hp = mhp
      @mp = mmp
    end
    
    end

    revive is designed to get out of the death state and recover all is commonly used in Inns.  So pretty much I'll design this for Game_Actor and make it so that if the actor has a certain id, it'll make @mp equal to a different number.
     
    Last edited by a moderator: Jan 18, 2017
    #6

Share This Page