NinjaKittyProductions

Professional Murder Hobos
Veteran
Joined
Jul 9, 2013
Messages
484
Reaction score
473
First Language
English
Primarily Uses
RMMV
If a plugin exists, please point me in the right direction ^_^! I have looked and looked and cannot find anything for what I am wanting.

Here is the deal. We are working on a character that has the ability of telekinesis. We are wanting them to be able to move certain objects on the field (events that is), and move them to somewhere nearby... say within 2 to 3 squares from the original starting point of the event. While we know a whole lot about using script calls for check mouse point, hover, over and move, we cannot figure out how to move an event in-game with a mouse click and drag. Thus we come to you, community. Is this possible or will we need a plugin?
 

standardplayer

Keeper of Kitties
Veteran
Joined
Apr 6, 2016
Messages
702
Reaction score
3,473
First Language
English
Primarily Uses
N/A
I've actually done this before. It's very possible. The code I wrote was temporary, it was just an experiment.
But I wound up putting a 'listener' on scene map update, that used a basic square collision box function I already had to detect the bounds for the clicks.

EDIT: Scene Map update was also where I used the Mouse cursors coordinates to re position the sprite as the cursor moved. I can't fully remember this next part, but I'm pretty sure their movement functions took over, so there was a little bit of 'delay' if I moved the mouse very quickly. I suspect you'd have to temporarily disable or override their movement functions to correct that, if it becomes an issue.

The only nuance was making sure that where I 'dropped' events auto-corrected to the nearest whole numbers for tiles in RM, otherwise they couldn't move after I released.

It's very possible and actually not too complicated, I'll wait to see if someone posts a link to an existing plugin, though
 

NinjaKittyProductions

Professional Murder Hobos
Veteran
Joined
Jul 9, 2013
Messages
484
Reaction score
473
First Language
English
Primarily Uses
RMMV
{MH}That seems a little over my head at the moment. JavaScript is not strong with me <_<.

@standardplayer If someone does not post a plugin or extension, would you mind sharing how you did that step by step?
 

standardplayer

Keeper of Kitties
Veteran
Joined
Apr 6, 2016
Messages
702
Reaction score
3,473
First Language
English
Primarily Uses
N/A
@NinjaKittyProductions sure, I'll give it about a day or so ^^ If I check back and don't see any responses, I'll do some tests, remember how I did it all and then write a step by step

EDIT: @NinjaKittyProductions Alright, so I had a little bit of time here and there last night, and starting putting together a concept. I wanted to not deal with that delayed drag that happened to me last time, so I approached it a little differently.

Before I actually show any code, I'd like to explain what is happening and why, and make sure this is doing what you want it to do.

Here's the thing. You'd have to do a bit more work if you wanted to get the sprite to smoothly move along with the cursor. A Game Character's movement is actually initiated by incrementation. If you manually change their ._x property, they animate; they walk to that x location. The don't just appear there. You'll notice that when you manually change their x or y in this way, they also move at their current move speed.

Furthermore, unless you're using some special movement script, events won't activate with the regular Action Button trigger, or be able to respond to regular move commands if they are not properly within the tile grid. i.e. If you set their x to 4.3 and then do $gameMap.event(x).moveStraight(d), that event won't move. They'll turn in whatever direction you say, but they won't move, not with vanilla movement, anyway.

So I just went ahead coded my example so that the event moves between tiles, without animating as it's being dragged. You could still add step animation to it for this portion, btw.

Finally, the current code will only allow telekinesis if
1) an object that holds a .active boolean is currently set to true
2) the event has a specific notetag in it's notebox.

Anyway, here's a quick video of what I've worked on so far, pretty cut and dry.

 
Last edited:

standardplayer

Keeper of Kitties
Veteran
Joined
Apr 6, 2016
Messages
702
Reaction score
3,473
First Language
English
Primarily Uses
N/A
@standardplayer that looks fantastic! From what I can tell, you can move the event only a few squares at a time from its original position.


Yeah, currently it's set to 2 as it's distance limit. Alright, I'll go back, comment the code and I'll explain what's happening.


EDIT alright, so first, I've attached a copy of the mini plugin I wrote to test this.
The code is commented, although there isn't a whole lot to comment on.

I don't know all the specifics of when/where you want telekinesis to be active. I'm also not huge fan of plugin commands, I really don't think they're easier to use than script calls, and they're certainly more limiting. For that reason, I'm just going to give you the script calls.

So here are the script calls you'd need to get this working.

tks.distance = x //Where x is the distance you want the object to be able to move from it's origin
tks.active = true //This allows telekinesis to happen. If this is set to false, telekinesis can't happen.

Also, for an object to be moveable by telekinesis, it needs to have
<sp_tk> in it's notebox.


Like I said, I don't know all the specifics of what you'd need, but I went ahead and made it so you can only move an event based off of it's original x and y when the map was loaded. This is to prevent someone from picking up an object, moving it as far as the limit allows, then dropping it and picking it up again, only to move it outside of it's original bounds.
 

Attachments

  • spTelekinesis.js
    3.7 KB · Views: 26
Last edited:

NinjaKittyProductions

Professional Murder Hobos
Veteran
Joined
Jul 9, 2013
Messages
484
Reaction score
473
First Language
English
Primarily Uses
RMMV
I tried the plugin and it seems to work flawlessly.
There were only a couple of things that stood out. 1)My characters moved while I tried to move the object. No biggie as I came up with a couple of Common Events that put a stop to that ^_^. 2) The distance X didn't seem to work but I really only need to move it only 2 squares at a time anyway so all is good.

Anyway, this was an awesome little plugin and I really appreciate you taking the time to make it ^_^. I hope others find this plugin useful as there are all sorts of ways to use it... from freeing up clutter, unblocking a passage/etc., puzzle-solving... really anything you can do with an event that needs to move ^_^

 

Chadoumaru

Villager
Member
Joined
Oct 18, 2020
Messages
11
Reaction score
0
First Language
Spanish
Primarily Uses
RMMV
Hello, @standardplayer. I am creating a game with puzzles and riddles, and one of these is a puzzle in which the player has to build fangs by moving the pieces with the mouse and placing them in their respective places. But I don't know how to do it, so I looked for a way to do it and I found this forum in which you make a plugin for NinjaKittyProductions. And it's what I was looking for. Can I use the plugin for my game?
 

standardplayer

Keeper of Kitties
Veteran
Joined
Apr 6, 2016
Messages
702
Reaction score
3,473
First Language
English
Primarily Uses
N/A
Hi @chadomaru, I'm at work ATM, but when I get home I'd be happy to work on this with you. @NinjaKittyProductions has exclusive rights to what I made for another 6 months or more, sharing it is at their discretion. However, I'd be happy to work on something specific to your situation. Send me a DM if you're still interested!
 

Latest Threads

Latest Profile Posts

oneOfUs.jpg
Streaming more Poppet Quest game even in about 12 minutes.
Some dog owners really impress me. I'm pushing 2-3 metric tons of garbage containers that destroy everything they hit. What do you think is going to happen to your tiny dog when I run it over? And why are you crossing my path to argue with me? Have you never been hit by 200kgs of garbage?

Lesson for you folks. Never mess with an angry garbage container. Or its driver.
I didn't dispose of a file properly and now my whole game won't start: I get a script error in the Scene Manager stage of game launch. What to do? Transfer it all to a new project? That's going to be tedious. Fortunately I am only nine workdays into it.
Makin' stuff on a broken laptop yay

Forum statistics

Threads
131,680
Messages
1,222,165
Members
173,424
Latest member
filfes
Top