Indie Dev

Hello Guest!. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, sell your games, upload content, as well as connect with other members through your own private inbox!

Set move route via script for event (solved)

Status
Not open for further replies.
Hello,

I appreciate and thank you for any help you all can give me.

So this is the basic. I created a bomb event on a map that moves to my players coordinates while
its invisible by the press of a button. The bomb then moves up, down, left or right based on the player direction then becomes visible, explodes yadi yada. Everything works fine but I want to run this event by way of common event so I don't have to copy and paste the script over and over again. I don't know the script call to move events to player x,y location or up, down, left or right.
 

CT_Bolt

Global Moderator
Staff member
Resource Team
Xy$
0.02
I don't know the script call to move events to player x,y location or up, down, left or right.
I wrote a small plugin to help you along on your game making adventure. (cute)
JavaScript:
function setBomb(eventId){
  var x = $gamePlayer._x; var y = $gamePlayer._y;
  switch ($gamePlayer._direction){case 2:y=y+1; break; case 4:x=x-1; break; case 6:x=x+1; break; case 8:y=y-1; break;}
  $gameMap._events[eventId].locate(x,y);
}
Place the attached .js file in plugins folder.
(or paste the code above into a new ".js" file and place in the file in plugins folder)
Add the plugin using the plugin manager.

Call the script using the following script call:
JavaScript:
setBomb(n);
n is the eventId of the bomb;

Let me know if that helps. (cool)(thumbsup)
 

Attachments

Last edited:
Status
Not open for further replies.
Top