Hi people!
Recently have dove into the wonderful world of RMMZ and having a blast. Absolute beginner at this stage mostly working on the maps, menus, databases for items and weapons and slowly working on scripting in events, quests and specific zone/map features.
My Java script knowledge is a bit sketch as most of my previous programming experience (self taught) has been dabbling in various C languages, so I have a few things I’m trying to implement in my first game that I’m having trouble finding in the software and/or finding help writing code for.
What I’m trying to do is have HP regen halted while in a certain maps only (dungeons) and have it work normally otherwise. I’d like this to either toggle on/off when entering/leaving these areas or to have that specific map have a state of no regen constantly. Not sure if the best way to achieve this.
I found this code doing some Google searching
const disableMapRegen = Game_Battler.prototype.regenerateHp;
Game_Battler.prototype.regenerateHp = function() {
if (!$gameParty.inBattle()) return;
disableMapRegen.apply(this);
};
Which turns off regen like expected but it’s global and not just in the map I’ve chosen. With my lack of JavaScript knowledge Im not exactly sure how to change it to work like I want and still lack the knowledge to write a script from scratch myself. I’ve been reading other peoples code to try and understand syntax and how the code functions, to some success (can generally make out what the code is *doing* but syntax is my Achilles heel right now)
Would someone be kind enough to either help with coding this, show me if this is possible in the editor and/or possibly point me to a resource that can help me learn more about the different code elements to better understand things like functions, tags, syntax etc?
Many thanks in advance!
Caco.
Recently have dove into the wonderful world of RMMZ and having a blast. Absolute beginner at this stage mostly working on the maps, menus, databases for items and weapons and slowly working on scripting in events, quests and specific zone/map features.
My Java script knowledge is a bit sketch as most of my previous programming experience (self taught) has been dabbling in various C languages, so I have a few things I’m trying to implement in my first game that I’m having trouble finding in the software and/or finding help writing code for.
What I’m trying to do is have HP regen halted while in a certain maps only (dungeons) and have it work normally otherwise. I’d like this to either toggle on/off when entering/leaving these areas or to have that specific map have a state of no regen constantly. Not sure if the best way to achieve this.
I found this code doing some Google searching
const disableMapRegen = Game_Battler.prototype.regenerateHp;
Game_Battler.prototype.regenerateHp = function() {
if (!$gameParty.inBattle()) return;
disableMapRegen.apply(this);
};
Which turns off regen like expected but it’s global and not just in the map I’ve chosen. With my lack of JavaScript knowledge Im not exactly sure how to change it to work like I want and still lack the knowledge to write a script from scratch myself. I’ve been reading other peoples code to try and understand syntax and how the code functions, to some success (can generally make out what the code is *doing* but syntax is my Achilles heel right now)
Would someone be kind enough to either help with coding this, show me if this is possible in the editor and/or possibly point me to a resource that can help me learn more about the different code elements to better understand things like functions, tags, syntax etc?
Many thanks in advance!
Caco.