Frost Walker Spell script help

Hi everyone,

TLDR - I have successfully implemented the Frost Walker enchantment from minecraft but the scripting I used is inefficient and glitchy. I would like an experienced opinion on how to improve this.​

Abalue here with my first post on this forum. I've joined seaking some helpful advice for event scripting in my first rpg maker project. The project, as all good first rpg maker projects should be, is a massive and way too out of scope Metroidvania/rpg adventure where the player learns many spells that are equally as helpful outside of battle as they are in. One such spell is modelled after the "Frost Walker" enchantment from minecraft where, water surrounding the player will freeze allowing them to walk on it.

2023-11-09_03.10.39.png

Image of frostwalker spell in minecraft

I have successfuly achieved this in RPG Maker MV however, there are a few problems I have with my method and would like a more experienced opinion on how best to overcome these. I will explain how I have implemented it first here, but feel free to skip to the next paragraph to see what the problems are first. All my spells call a certain common event that casts the spell out of combat. The "Frost Feet" spell calls a common event that turns on a control switch. There is another common event that triggers parallel when this switch is on and runs the scripting. The scripting in the parallel common event searches the room for events by name and teleports them to underneath the player (5 in total for directly on top of the player and the 4 cardinal directions too). The 5 map events have two event pages, one for the off-state where they are invisible but are running parallel to check if they are on a region (regions are painted on the map so I can choose what tiles can freeze) and the on-state where they also run in parallel to check what region they are on but have an icy image that the player can walk on.

There are 2 problems I have with this method. The first, and probably my biggest grievance with this method is, that I have to copy the 5 map events into every region I make so that when the script is called they can be moved. Even if they are on a map with no water to be used on. Ideally I would only have to have one instance of each event so I don't have to create multiple of them every time there might be freezable water as the game consists of lots of small zelda-esque maps rather than a few larger ones. Secondly, whenever one of the map events moves from a valid region tile to an invalid non-freezable tile, there are a few frames where the ice event page is still active. This looks visually displeasing but isn't the end of the world. Perhaps it would allow the player to move onto a tile they should be able to at all briefly and make them get stuck there but I haven't tested it enough to confirm this.
I've left a short video demonstration of it working in game and you can see the problems there too:




Hope this post isn't too lengthy for what is expected on this forum. I am happy to post my current eventing and scripts if it helps as well.

Thanks for reading and any help that you can provide,
Abalue.
Hi Abalue,

Instead of copying events into every region for your Frost Walker spell, you might want to consider event cloning. Tsukihime has an event wrapper script that allows you to create events via scripting, which could potentially streamline your process. If you're not keen on scripting, there's also molegato's event transmuter script that enables cloning events from other maps without scripting, which could solve your problem of duplicating events across multiple regions.

Additionally, for your second issue with the brief active state of ice tiles, consider adding a conditional branch that checks the player's current region ID before setting the event page active, this could prevent the ice event from showing up on non-freezable tiles.
@Making_JRPGs_with_AI
This information is grossly incorrect. Tsukihime event wrapper plugin is for VX Ace and will not work with MV, among other issues with this response.

Considering just yesterday you were not even familiar with the basic asset standards of RPG Maker, yet today you seem not only familiar with RPG Maker's script calls and plugin developers, I have to ask if you are using AI to generate your responses to help requests?
Tsukihime has an event wrapper script...there's also molegato's event transmuter script
Just as a point of terminology, MV and MZ use plugins, not scripts.

The first thing you reference is a script for RPG Maker VX Ace, which has nothing to do with the OP using RPG Maker MV. And the second thing you reference doesn't appear to exist, nothing like it comes up on a Google at all.

1699584449849.png


The first, and probably my biggest grievance with this method is, that I have to copy the 5 map events into every region I make so that when the script is called they can be moved.
You can use an event spawner plugin. There are several options if you Google it.

Secondly, whenever one of the map events moves from a valid region tile to an invalid non-freezable tile, there are a few frames where the ice event page is still active.
You can use a conditional branch to see whether the tile should go there before you move it. If you post your event code, we might be able to help more specifically.
Just as a point of terminology, MV and MZ use plugins, not scripts.

The first thing you reference is a script for RPG Maker VX Ace, which has nothing to do with the OP using RPG Maker MV. And the second thing you reference doesn't appear to exist, nothing like it comes up on a Google at all.

View attachment 283275
There is a Molegato event "transmutter" script. It's for VX Ace. It doesn't look like molegato ever made MV or MZ plugins.

As for the OP's issue, I would use a tilechanger plugin, but I guess it could be done with events. Since you're already using events, I would second the event spawner suggestion.
As for the OP's issue, I would use a tilechanger plugin
I agree, that's how I'd go about it, too - but as you say, they're already using events, and the setup/syntax for tile changing is rather more complex.
Just as a point of terminology, MV and MZ use plugins, not scripts.

The first thing you reference is a script for RPG Maker VX Ace, which has nothing to do with the OP using RPG Maker MV. And the second thing you reference doesn't appear to exist, nothing like it comes up on a Google at all.
I'll try not to mix up the terminology. I thought they were sort of interchangable.

And I'll be sure to check which version of RPG Maker I'm looking at in future.

Apologies for saddening you again 🙁
Just as a point of terminology, MV and MZ use plugins, not scripts.

The first thing you reference is a script for RPG Maker VX Ace, which has nothing to do with the OP using RPG Maker MV. And the second thing you reference doesn't appear to exist, nothing like it comes up on a Google at all.

View attachment 283275


You can use an event spawner plugin. There are several options if you Google it.


You can use a conditional branch to see whether the tile should go there before you move it. If you post your event code, we might be able to help more specifically.

Thanks for your reply! I was away and couldn't access my project to share code. However, I'm back now and will post it in this reply.

#1.
I'll check out some relevant plugins. I've been going for a 'minimal plugin approach' for this project just to force myself to learn advanced scripting. I have used a couple already so far though.

#2.
I did think about this, however if the event does not teleport it will be left on the tile it was on before and still be active if its on a valid region.

Here is some snippets from my code:

Ice Tile Event
=============================
[Event Page 1]
If: $gameMap.regionId($gameMap._events[this._eventId]._x, $gameMap._events[this._eventId]._y) === 8

Control Self Switch: A = ON​
=============================

This is the same for event page 2 except it turns control switch A off in the else statement.

'Frost Feet cast Common' Event
=============================
Code:
findEventByName = function(event_name) {
    var myEvent = $gameMap.events().find(ev => {
        return ev.event().name == event_name;
    })
    return myEvent;
}

findEventByName("ice_right").setPosition($gamePlayer.x+1, $gamePlayer.y)
findEventByName("ice_middle").setPosition($gamePlayer.x, $gamePlayer.y)
findEventByName("ice_left").setPosition($gamePlayer.x-1, $gamePlayer.y)
findEventByName("ice_top").setPosition($gamePlayer.x, $gamePlayer.y-1)
findEventByName("ice_bottom").setPosition($gamePlayer.x, $gamePlayer.y+1)
Wait: 10 frames

=============================

I was worried about lag so put a 10 second delay between each check for moving the tiles. This is set to trigger - parallel and switch on when the spell is cast and transfer events turn it off when moving between most rooms.
Wait: 10 frames
Just for the record: you should always have at least some wait frames on parallel events. Otherwise the code is being processed every single frame of the game, and since RPG Maker games are single threaded processes, that means all the processing only gets 1 core, 1 thread of you CPU, which means things can bottle neck real fast if you aren't utilizing wait frames.

So in short: good call.

A quick correction, I assume just a typo on your part, but 10 frames is not 10 seconds, by the way. The game (logic) runs at 60 frames per second, and therefore, 10 frames = 1/6th of a second.


If you are going for minimal plugins, I would just use some of the "robust utility plugins" (as I would call them); these are plugins that just add new utility to your the development of your game by adding general purpose tools, they are not plugins that add very specific mechanics. For example, event spawner plugins don't directly add a new function to the game directly, only provides you the tools to facilitate new mechanics (or other functions). These will often need some script call functions to make the most of their functionality, so you'll still be learning scripting along the way :LZSwink:
Just for the record: you should always have at least some wait frames on parallel events. Otherwise the code is being processed every single frame of the game, and since RPG Maker games are single threaded processes, that means all the processing only gets 1 core, 1 thread of you CPU, which means things can bottle neck real fast if you aren't utilizing wait frames.

So in short: good call.

A quick correction, I assume just a typo on your part, but 10 frames is not 10 seconds, by the way. The game (logic) runs at 60 frames per second, and therefore, 10 frames = 1/6th of a second.


If you are going for minimal plugins, I would just use some of the "robust utility plugins" (as I would call them); these are plugins that just add new utility to your the development of your game by adding general purpose tools, they are not plugins that add very specific mechanics. For example, event spawner plugins don't directly add a new function to the game directly, only provides you the tools to facilitate new mechanics (or other functions). These will often need some script call functions to make the most of their functionality, so you'll still be learning scripting along the way :LZSwink:
I thought that was the case for parallels but wasn't sure about the exact numbers of it, i.e. if it was just a measure for lower end computers. Good to know. And yes it was a 'I wrote one thing down whilst meaning another' mistake for the seconds vs frames typo.

I found an event spawning plugin by Galv and I've made good use of their projectile plugin so am more than happy to use another one of theirs. I've seen YanFly scripts pop up all over the place but got paywalled by one (I'm not against paying for a product but not early into a project I may not likely finish) and ended up managing to quickly script some of their core plugins myself. Seems they provide 'bread and butter' utility functions for the RPG Maker MV community and will likely pick some of their plugins up later.

I have an idea how to solve my problem currently by moving some of the functionality of the common event into the now plugin spawned events.

Thanks for your useful tips!
I've seen YanFly scripts pop up all over the place but got paywalled by one (I'm not against paying for a product but not early into a project I may not likely finish) and ended up managing to quickly script some of their core plugins myself. Seems they provide 'bread and butter' utility functions for the RPG Maker MV community and will likely pick some of their plugins up later.
Pretty much every Yanfly plugin has a free alternative, usually multiple free alternatives, if you don't want to spend money, especially for MV which has thousands of plugins and has been around longer.
I was worried about lag so put a 10 second delay between each check for moving the tiles.
A quick correction, I assume just a typo on your part, but 10 frames is not 10 seconds, by the way. The game (logic) runs at 60 frames per second, and therefore, 10 frames = 1/6th of a second.
Amusingly, it tells you every time you enter the command 😉

1700009551314.png


You're free to Google it as I once did, but I believe I recall from a thread that the minimum number of frames to move between tiles (at the default movement speed) is 6.

Edit: Nope, I was wrong, this is the interpreter. What you have is right.
Update:
I managed to find a solution that works in the end closer what I had originally. What @ATT_Turan said about checking to whether or not to move the tile based on the region worked however instead of switching the event based on what region it is on instead set it to what region it 'should be' at based on the location of the player. This way even if the event gets left behind it doesn't matter since it will be in the off state due to the players position!

As mentioned earlier the first problem was resolved just using event spawner plugins. I also ended up throwing all the scripting into a miniature plugin although I'm sure what I've done is breaking multiple conventions of RPG Maker plugin creation since it is my first time making one.

I suppose it would be good to know if there is a way to tag this post as solved now? I can edit the title maybe to say it so?
I suppose it would be good to know if there is a way to tag this post as solved now?
Report the first post and say it's solved.
This thread is being closed due to being solved. If you need it reopened, report it to let us know why. Thank you!

Original thread: https://forums.rpgmakerweb.com/threads/frost-walker-spell-script-help.162766/