Hi guys,
I have a Question, can I add a Character or Event only with Javascript?
Add a Character/Event with Javascript
● ARCHIVED · READ-ONLY
-
-
Yes!
And I made a plugin to make that easier:
http://forums.rpgmakerweb.com/index.php?/topic/46535-orange-custom-event-creator/
To add an event based on an actor, you can use the following script call:
$gameMap.createActorAt(actorId, x, y, d, commonEventId, temporary);
where:
actorId -> the number of the actor to add on the map
x and y -> the position
d -> the direction that event will be facing (2 for down, 4 for left, 6 for right, 8 for up)
commonEventId -> a common event to call when the player talk to the actor
temporary -> true if you want the event to disappear when the player leave the map, false if you don't.
You can also specify the spriteset instead of using an actor:
Code:$gameMap.createNormalEventAt(characterName, characterIndex, x, y, d, commonEventId, temporary) -
Thanks Hudell.
And can you tell me, how can I remove/delete an Event or a Character/NPC? -
There's an event command called Erase, it will Erase the event that it is called from. I'm working on a plugin to erase any other event.
If you create an event with my plugin passing false to the temporary param (the default), you need to also call $gameSystem.removeCustomEvent(mapId, eventId); to remove it. Tonight I'll add a better way to handle this.