romoku

Veteran
Veteran
Joined
May 8, 2012
Messages
33
Reaction score
7
First Language
Hungarian
Primarily Uses
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.
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
14,289
Reaction score
15,406
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).
 

romoku

Veteran
Veteran
Joined
May 8, 2012
Messages
33
Reaction score
7
First Language
Hungarian
Primarily Uses
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:

RHachicho

Veteran
Veteran
Joined
Jan 16, 2016
Messages
294
Reaction score
131
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. 
 

Sekunri

Creator of Worlds
Veteran
Joined
Jan 12, 2014
Messages
132
Reaction score
76
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.
 

Harosata

Dramatic Lightning's BFF
Veteran
Joined
Aug 20, 2015
Messages
250
Reaction score
84
First Language
English
Primarily Uses
RMMV
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:

Latest Threads

Latest Profile Posts

Just laid down a sick nasty new post in the MagiCats! Infinite Sadness thread! Lemme give ya a big ol' hug for it.

bg6.jpg
Wheel of Attacks.png

MORE GAMBLING THEMED ATTACKS!

I AM UNABLE TO STOP!
Is it ok to repost stuff that i've posted to threads in the status feed?
If so, here's art of Shiloh, the main protagonist of the game i'm making:20220807_181702.jpg
They are meant to be ambiguous in gender, like Frisk from Undertale or Gogo from FFVI. I haven't decided what their age will be yet. Any ideas?
Please comment what you think about the art and design!
ScreenShot_8_10_2022_7_15_21.png
Looks like Mike's got a new party member in Robbi...

Calf survival story with a happy ending.

Forum statistics

Threads
124,461
Messages
1,163,834
Members
163,281
Latest member
incabalamo
Top