Help Replicating Field Skills: Move

DarkEspeon

Veteran
Veteran
Joined
Apr 9, 2017
Messages
86
Reaction score
14
First Language
Russian
Primarily Uses
RMMV
Hello! Field skills are special kind of skills that can be used outside battles to interact with certain tiles/events. Kind of like HM in Pokemon! I am trying to replicate a field skill "Move" from Golden Sun! How do I do that? So far I came across Yanfly's Map Select Skill plugin, that will allow me to choose this skill on map. However here come the problems: I do not know how to disable that skill from using it in battles and I do not know how to actually link the skill with an event and make it work! Please, help me!

About the field skill, let me explain what it is: "Move" works as if you're just pushing something, but it's more "long-range" and practical. Skill "Move" is a special skill that some characters know from the beginning, and with it you can move certain events around with ease. "Move" cannot be used in battle and it costs 1MP each time you use it in the field. It works only on specific events and it can move an event in all 4 directions. The range of this skill is 2 tiles in a straight line, so if between a player and an event is maximum 1 empty tile - it will work. After activation of the skill, if the skill found an event that can be moved the player can freely choose what direction to move it to, as long as it's not going into a wall or out of bounds or a certain region.
 
Last edited:

Nutty171

Adept at ineptitude
Veteran
Joined
Mar 3, 2017
Messages
479
Reaction score
551
First Language
English
Primarily Uses
RMMV
Not sure if I understand your question, but from what I gather you're trying to make a skill that can only be used outside of battle, right? There's a setting for that in the database: Occasion.png
EDIT: Just read your question more carefully. To have the effect triggered, you make a common event that does what you want the skill to do, and then, as you can see on the right side of the screenshot, you can have the skill trigger a common event.
 

Philosophus Vagus

The drunken bird dog of rpg maker
Veteran
Joined
May 22, 2017
Messages
263
Reaction score
4,035
First Language
English
Primarily Uses
RMMV
I'm not sure how you would interact with events from a distance, though I've seen some plugins before that allow you to have on-map projectiles that erase events when hit, maybe look into one of them and see if you can set it up to run a common event or something on hit rather than damaging it or however it works by default. Probably runs an event page upon execution already, so then you'd just have to change what it does from damaging/vanishing to pushing or pulling it across the map instead, for which there are several tutorials but I think they are all player-direction based so making the object capable of multi-directional movement regardless of the player's approach might take a bit more than a normal push object event as well come to think of it.

Sorry I wasn't more help, I might look up one of those plugins myself and play with it later though if no one else comes along, because it sounds like a nice little idea for making puzzles and such, but it also sounds like a **** ton of conditional branches and a lot of checks and balances to make sure you don't accidentally wedge a moveable event into the wrong place and break the game.
 

DarkEspeon

Veteran
Veteran
Joined
Apr 9, 2017
Messages
86
Reaction score
14
First Language
Russian
Primarily Uses
RMMV
@Nutty171 Okay, thanks for that. Now, how should I check if the event is eligible for being moved? All I can do right now is check where player is facing. I need to know: A) If there are any events in front of or one tile away from the player; b) If the closest event can be moved; C) If I can move it somewhere I want or not; I suppose this would have to do something with Notes or event names and regions, but I am not suuuuuuuuure...

@Philosophus Vagus If you try something and it works - let me know. I'm genuinely stumped.
 
Last edited:

Nutty171

Adept at ineptitude
Veteran
Joined
Mar 3, 2017
Messages
479
Reaction score
551
First Language
English
Primarily Uses
RMMV
@DarkEspeon This would be really complex without scripts probably, which I can't do. You can check the location of each event, and the player, and with that you can check to see if the events are movable... I'd just request a script tbh, even though I prefer to use eventing. :/
 

DarkEspeon

Veteran
Veteran
Joined
Apr 9, 2017
Messages
86
Reaction score
14
First Language
Russian
Primarily Uses
RMMV
Yeah, there isn't much I can do without scripting. Is there a place where people can help me with them? I know there are Plugin requests, but I haven't seen a single Script request thread.
 

DarkEspeon

Veteran
Veteran
Joined
Apr 9, 2017
Messages
86
Reaction score
14
First Language
Russian
Primarily Uses
RMMV

Nutty171

Adept at ineptitude
Veteran
Joined
Mar 3, 2017
Messages
479
Reaction score
551
First Language
English
Primarily Uses
RMMV
Mmm. Yeah, you're right. I'd probably contact a mod about this.
 

waynee95

Lunatic Coder
Veteran
Joined
Jul 2, 2016
Messages
645
Reaction score
542
First Language
German
Primarily Uses
RMMV
Scripts were the "Plugins" for RPG Maker before MV.

For MV there are only Plugins.

Then there's the Script Command for events. This enables you to write small code chunks or use a one-liner like $gameParty.gold(). These one-liner are called Scriptcalls.
 

DarkEspeon

Veteran
Veteran
Joined
Apr 9, 2017
Messages
86
Reaction score
14
First Language
Russian
Primarily Uses
RMMV
@waynee95 I see. Well, I joined in during the rise of RMMV, so I never actually used the previous versions.
So, is there a way to use these Script Commands to make what I need? Are they even of any use here? My mind drifts off to parallel events for each movable event and to a crapton of variables used for each of them. And it's not guaranteed that it'll work...
 

waynee95

Lunatic Coder
Veteran
Joined
Jul 2, 2016
Messages
645
Reaction score
542
First Language
German
Primarily Uses
RMMV
I guess this could be achieved with eventing and maybe the use of some helper plugins like SRD's Collision Checker.
 

DarkEspeon

Veteran
Veteran
Joined
Apr 9, 2017
Messages
86
Reaction score
14
First Language
Russian
Primarily Uses
RMMV
I guess this could be achieved with eventing and maybe the use of some helper plugins like SRD's Collision Checker.
Got a link? I'll check out the collision detection thing.
And some help on eventing would be nice to be honest. After all, I still have no idea how to check if there are any movable objects in front of you.
 

DarkEspeon

Veteran
Veteran
Joined
Apr 9, 2017
Messages
86
Reaction score
14
First Language
Russian
Primarily Uses
RMMV
The CC plugin seems interesting, but to be honest it's of no use here, sadly. It can only check if the space in front of you is clear, and it can't differentiate between events and plain tiles. The logic parts are nice (AND&OR), but not including NOT in the bunch was a big missed steak. This plugin is very helpful in case you need to move something. Well, to get to that part I still need to check if there is a movable event in front of me...

And pickup&throw... Well, it's fun for sure, but it's of no use here, sadly. And I can't understand the language used there either. But from what I see it can't help me here.
 

Fornoreason1000

Black Sheep
Veteran
Joined
Mar 1, 2014
Messages
200
Reaction score
93
First Language
English
Primarily Uses
RMMV
I think i just did it with events :p

its length and kinda hacky but easy once set up. bascilly you set the skill so 1. it only works in the menu 2. it calls the common event for processing. there are quite a few script calls. mostly to work around the engine UI limitations.

the Event you want to be Movable will have "Movable" written in the events Note section. it is case sensitive.

Now for our fugly common event!! be prepared.
1. script Call:
Code:
$gameVariables.selectedEventIndex = 0;
$gameVariables.movableEvents = [];
$gameVariables.movableEvents =  $gameMap.events().filter(function(e){ return e.event().note == "Movable"});
console.log($gameVariables.movableEvents);
$gameVariables.selectedEvent = $gameVariables.movableEvents[$gameVariables.selectedEventIndex];
2. Conditional Branch (A): script
if
Code:
$gameVariables.movableEvents.length == 0
1. Play Se ("Buzzer1")
2. Show Text( "Nothing can be Moved!")
3. Jump To Label: Exit
End :

3. Loop
1. Script Call
Code:
$gameVariables.selectedEvent._stepAnime = true;
2.show Choices[Move,Next,Previous,Cancel]
1.Move:
Break Loop

2.Next:ScriptCall:
Code:
$gameVariables.selectedEventIndex++;
$gameVariables.selectedEvent._stepAnime = false;
if($gameVariables.selectedEventIndex >= $gameVariables.movableEvents.length) {$gameVariables.selectedEventIndex = 0;}
$gameVariables.selectedEvent = $gameVariables.movableEvents[$gameVariables.selectedEventIndex];
3.Previous:ScriptCall:
Code:
$gameVariables.selectedEventIndex--;
$gameVariables.selectedEvent._stepAnime = false;
if($gameVariables.selectedEventIndex < 0) {$gameVariables.selectedEventIndex = $gameVariables.movableEvents.length - 1;}
$gameVariables.selectedEvent = $gameVariables.movableEvents[$gameVariables.selectedEventIndex];
4.Cancel:
Jump To Label: Exit
EndChoices
End Loop;

4. Loop //not again :(
1.Show Choices(up,Left,RightDown Cancel)
1. Up: ScriptCall
Code:
$gameMap.refreshIfNeeded();
this._character = $gameVariables.selectedEvent;
this._character.forceMoveRoute({ list: [{code: 4, params: []},{code:0,params:[]}], wait: true, repeat: false, skippable:true});
this.setWaitMode('route');
2. Left: ScriptCall
Code:
$gameMap.refreshIfNeeded();
this._character = $gameVariables.selectedEvent;
this._character.forceMoveRoute({ list: [{code: 2, params: []},{code:0,params:[]}], wait: true, repeat: false, skippable:true});
this.setWaitMode('route');
3. Right: ScriptCall
Code:
$gameMap.refreshIfNeeded();
this._character = $gameVariables.selectedEvent;
this._character.forceMoveRoute({ list: [{code: 3, params: []},{code:0,params:[]}], wait: true, repeat: false, skippable:true});
this.setWaitMode('route');
4.Down: ScriptCall:
Code:
$gameMap.refreshIfNeeded();
this._character = $gameVariables.selectedEvent;
this._character.forceMoveRoute({ list: [{code: 1, params: []},{code:0,params:[]}], wait: true, repeat: false, skippable:true});
this.setWaitMode('route');
5. Cancel: Jump To Label: Exit
End Choices
End Loop

5.Label: Exit

6. Scriptcall
Code:
$gameVariables.selectedEvent._stepAnime = false;
$gameParty.leader().mp + 2;
$gameVariables.movableEvents = [];
$gameVariables.movableEvents.selectedEventIndex = 0;
 

DarkEspeon

Veteran
Veteran
Joined
Apr 9, 2017
Messages
86
Reaction score
14
First Language
Russian
Primarily Uses
RMMV
I think i just did it with events :p

its length and kinda hacky but easy once set up. bascilly you set the skill so 1. it only works in the menu 2. it calls the common event for processing. there are quite a few script calls. mostly to work around the engine UI limitations.

the Event you want to be Movable will have "Movable" written in the events Note section. it is case sensitive.

Now for our fugly common event!! be prepared.
1. script Call:
Code:
$gameVariables.selectedEventIndex = 0;
$gameVariables.movableEvents = [];
$gameVariables.movableEvents =  $gameMap.events().filter(function(e){ return e.event().note == "Movable"});
console.log($gameVariables.movableEvents);
$gameVariables.selectedEvent = $gameVariables.movableEvents[$gameVariables.selectedEventIndex];
2. Conditional Branch (A): script
if
Code:
$gameVariables.movableEvents.length == 0
1. Play Se ("Buzzer1")
2. Show Text( "Nothing can be Moved!")
3. Jump To Label: Exit
End :

3. Loop
1. Script Call
Code:
$gameVariables.selectedEvent._stepAnime = true;
2.show Choices[Move,Next,Previous,Cancel]
1.Move:
Break Loop

2.Next:ScriptCall:
Code:
$gameVariables.selectedEventIndex++;
$gameVariables.selectedEvent._stepAnime = false;
if($gameVariables.selectedEventIndex >= $gameVariables.movableEvents.length) {$gameVariables.selectedEventIndex = 0;}
$gameVariables.selectedEvent = $gameVariables.movableEvents[$gameVariables.selectedEventIndex];
3.Previous:ScriptCall:
Code:
$gameVariables.selectedEventIndex--;
$gameVariables.selectedEvent._stepAnime = false;
if($gameVariables.selectedEventIndex < 0) {$gameVariables.selectedEventIndex = $gameVariables.movableEvents.length - 1;}
$gameVariables.selectedEvent = $gameVariables.movableEvents[$gameVariables.selectedEventIndex];
4.Cancel:
Jump To Label: Exit
EndChoices
End Loop;

4. Loop //not again :(
1.Show Choices(up,Left,RightDown Cancel)
1. Up: ScriptCall
Code:
$gameMap.refreshIfNeeded();
this._character = $gameVariables.selectedEvent;
this._character.forceMoveRoute({ list: [{code: 4, params: []},{code:0,params:[]}], wait: true, repeat: false, skippable:true});
this.setWaitMode('route');
2. Left: ScriptCall
Code:
$gameMap.refreshIfNeeded();
this._character = $gameVariables.selectedEvent;
this._character.forceMoveRoute({ list: [{code: 2, params: []},{code:0,params:[]}], wait: true, repeat: false, skippable:true});
this.setWaitMode('route');
3. Right: ScriptCall
Code:
$gameMap.refreshIfNeeded();
this._character = $gameVariables.selectedEvent;
this._character.forceMoveRoute({ list: [{code: 3, params: []},{code:0,params:[]}], wait: true, repeat: false, skippable:true});
this.setWaitMode('route');
4.Down: ScriptCall:
Code:
$gameMap.refreshIfNeeded();
this._character = $gameVariables.selectedEvent;
this._character.forceMoveRoute({ list: [{code: 1, params: []},{code:0,params:[]}], wait: true, repeat: false, skippable:true});
this.setWaitMode('route');
5. Cancel: Jump To Label: Exit
End Choices
End Loop

5.Label: Exit

6. Scriptcall
Code:
$gameVariables.selectedEvent._stepAnime = false;
$gameParty.leader().mp + 2;
$gameVariables.movableEvents = [];
$gameVariables.movableEvents.selectedEventIndex = 0;
Holy crap, in the name of God, Arceus and Akatosh, this is amazing. I'm so testing it when I get back home!

Edit: Okay, it works wonders! There are some changes I'd like to see though, just small ones. Do you mind if I list them?
1) I'd like to be able to move only the closest of all events that are 1-3 tiles away from you, in a straight line(player.x/player.y plus/minus 1-3)
2) If possible, I want that MP to drain from a certain character, not the leader.

(Also why is it $gameParty.leader().mp + 2, and not - 1?)
 
Last edited:

Fornoreason1000

Black Sheep
Veteran
Joined
Mar 1, 2014
Messages
200
Reaction score
93
First Language
English
Primarily Uses
RMMV
its 2 becuase the cost of the skill i made was 2 MP. the part at the end its used for cancelling. thats an error on my part. basscially if you entering the move but canceled before moving it gives the MP back. you can remove it if you want.

1. the 1-3 tiles thing is done with a another script call, then using array.filter on $gameVairables.movableEvents again, basially filter out all events further than 3 tiles.

2. you can, can't say I know of the top of my head.
 
Last edited:

DarkEspeon

Veteran
Veteran
Joined
Apr 9, 2017
Messages
86
Reaction score
14
First Language
Russian
Primarily Uses
RMMV
its 2 becuase the cost of the skill i made was 2 MP. the part at the end its used for cancelling. thats an error on my part. basscially if you entering the move but canceled before moving it gives the MP back. you can remove it if you want.

1. the 1-3 tiles thing is done with a another script call, then using array.filter on $gameVairables.movableEvents again, basially filter out all events further than 3 tiles.

2. you can, can't say I know of the top of my head.
Oh, I see now! Yeah, I'll remove it, don't wanna any MP being refunded tbh.

1) I'm not good with JS at all, but a quick glance at the function 'filter' gives me an idea, that I should write something like this:
$gameVariables.movableEvents.filter( function (value) { return (player.posx - this.posx <= 3) } ); //in case we are looking to the right
I'm pretty sure this is wrong though. And even then, this will return ALL events in required positions, not the closest one. Hmmm...

2) Maybe it can be done with something like character[id]? Because all characters in the database have specific ID, so maybe it can be used?
 

Fornoreason1000

Black Sheep
Veteran
Joined
Mar 1, 2014
Messages
200
Reaction score
93
First Language
English
Primarily Uses
RMMV
For you JS Code.


Dont use "this" , the this keyword when used in Events refers to Game_Interpreter(A JS object that parse event commands and runs them), not the event it was called in! this is a very common very easy mistake to make. This is becuase Events dont run event code, the interpreter does.

console.log(this) //when in a script call
-> Game_Interpreter

Filter iterates through each element checking if the callback function returns true, if true the new Array will contain that element. where you have "value" is what will be considered the current event in that iteration.There is an optional second parameter that assigns the value of "this" inside the call back but we don't need it.

The second problem is you only cheking in one direction on one axis (X Axis). this means all events to the left of you and all events in front are included regardless of their Y axis. calculate the distance like this d = Math.sqrt((x1 - x2)^2 + (Y1 - Y2)^2).
if you suck at math fortuanley $gameMap has an inbult distance fucntion.


so your code should look like this
Code:
$gameVariables.movableEvents.filter( function(event) {
var d = $gameMap.distance($gamePlayer.x, event.x, $gamePlayer.y, event.y);
return d <= 3;
});
please note for somereason whenever i put code aross two lines it treats each line as a seperate instruction.not sure if this is true for you.

For grabbing the character ID ithink you could do it by checking charcter states. basically, add a state, call commomn event, common event checks for stat\. when finished remove state. done:) But if you don't need MP refunding you might aswell as leave it out entirely since thats all i needed the actor for.
 
Last edited:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

I keep trying to explain to clients that the huddle masses behind the old K-Mart are a Fallout Reenactment group. Somehow I don't think they believe me. :LZSskeptic:
Hey people! What do you think about a core plugin? This will save some lines of code that I repeatedly use in all my plugins...
Wondering if I should make my enemies scale in my non-linear rpg. I'm leaning towards yes, but I don't want to use Yanfly's plugin...
French folk trying to pronounce English words. I loved how the man pronounced squirrel as 'square friend'.
Therapist: any questions? Me: Yeah, are there actually people who think Hotel California is about drugs and not fame or are people just trying to upset me?
Therapist: They WHAT?

Forum statistics

Threads
94,592
Messages
922,148
Members
124,462
Latest member
souldoood
Top