Advanced: Creating Events During Gameplay?

Status
Not open for further replies.

Dymdez

Newbie-in-Chief
Veteran
Joined
Feb 4, 2014
Messages
752
Reaction score
154
First Language
English
Primarily Uses
Not sure how to phrase this but does anyone know of any ways or scripts that allow the player to create an event during gameplay? I want to have my player use an item that would create an event on the tile in front of the direction he's facing. The event could be pre-designed on some other map and called through a common event or something. Does anything like this exist?

Thanks

Dym
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
Yanfly has a clone event script... you can set-up all possible item events on a sample map, then clone it when needed
 

Dymdez

Newbie-in-Chief
Veteran
Joined
Feb 4, 2014
Messages
752
Reaction score
154
First Language
English
Primarily Uses
Yanfly has a clone event script... you can set-up all possible item events on a sample map, then clone it when needed
Are you referring to the spawn event script? If so, I am talking about a script that can spawn an event directly on the tile in front of the player - not preset with region IDs, like Yanfly's spawn event script does.
 

SharicX

Veteran
Veteran
Joined
Oct 20, 2014
Messages
39
Reaction score
10
First Language
Romanian
Primarily Uses
Actually, this can easily be done with switches. You create a blank event with a second page that is activated when a certain switch gets turned ON. Then, within whatever event you want, when the event ends, you set the switch for the blank event to turn ON.

That activates the second page which makes it do...whatever it is that you wanted it to do. That way, you "create" events. Or to put it on more technical terms, you "wake up" a sleeping event, not create one.

And further more, you can have 4 of the same events surrounding the character. Then, set it up so that only the event in the way that the player is facing will turn ON.
 
Last edited by a moderator:

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
You can simply calculate the position where the event should spawn... I've used that script and I can spawn them dynamically anywhere in the map...
 
Last edited by a moderator:

Dymdez

Newbie-in-Chief
Veteran
Joined
Feb 4, 2014
Messages
752
Reaction score
154
First Language
English
Primarily Uses
Actually, this can easily be done with switches. You create a blank event with a second page that is activated when a certain switch gets turned ON. Then, within whatever event you want, when the event ends, you set the switch for the blank event to turn ON.

That activates the second page which makes it do...whatever it is that you wanted it to do. That way, you "create" events. Or to put it on more technical terms, you "wake up" a sleeping event, not create one.

And further more, you can have 4 of the same events surrounding the character. Then, set it up so that only the event in the way that the player is facing will turn ON.
Wouldn't that require me to fill every tile of my game with these "sleeper" events? I want to make it so no matter where the player is, when he uses item x, an event is created on the tile in front of him.

Specifically, when the player uses an item, a portal opens up in front of him and when he walks into it, he teleports.

You can simply calculate the position where the event should spawn... I've used that script and I can spawn them dynamically.
Alright - I will try asap. Thanks.

Sorry, didnt mean to double post - thought they auto merged.
 

SharicX

Veteran
Veteran
Joined
Oct 20, 2014
Messages
39
Reaction score
10
First Language
Romanian
Primarily Uses
Wouldn't that require me to fill every tile of my game with these "sleeper" events? I want to make it so no matter where the player is, when he uses item x, an event is created on the tile in front of him.

Specifically, when the player uses an item, a portal opens up in front of him and when he walks into it, he teleports.
Ah, I understand now. I thought that it would be in a single event, happening only once, not every time he uses the item. Sorry about that.

It sounds like some sort of transportation-teleportation system. The closest thing it reminds me of is the Ocarina of Time. :D
 
Last edited by a moderator:

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
This is from the spawn events page, this is the very first set of script calls for spawning events...

spawn_event_location(x, y, event_id)spawn_event_location(x, y, event_id,map_id)It takes x,y position of where to spawn the event...You'd need to calculate x,y based on direction though. :)
 
Last edited by a moderator:

Dymdez

Newbie-in-Chief
Veteran
Joined
Feb 4, 2014
Messages
752
Reaction score
154
First Language
English
Primarily Uses
This is from the spawn events page, this is the very first set of script calls for spawning events...

spawn_event_location(x, y, event_id)spawn_event_location(x, y, event_id,map_id)It takes x,y position of where to spawn the event...You'd need to calculate x,y based on direction though. :)
Right, thank you, but even if I could calculate based on direction, how do I get the event to spawn directly next to the player? These script calls are for specific coordinates, and since the player can presumably summon the portal on any point of the tile grid, we cannot know any specific coordinates to call.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,100
Reaction score
13,705
First Language
English
Primarily Uses
RMMV
I've moved this thread to RGSS3 Script Requests. Please be sure to post your threads in the correct forum next time. Thank you.

You can use the MultiQuote button to quote multiple posts in a single response.  They don't auto-merge.

Tsukihime wrote a script that would allow you to spawn items on the map (take them from your inventory and add them to the map so you can pick them up again later).  You didn't really explain what you intend to do, and whether the items you "use" are what appears on the map or something else, so I'm only throwing it out there as a possibility.
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
Right, thank you, but even if I could calculate based on direction, how do I get the event to spawn directly next to the player? These script calls are for specific coordinates, and since the player can presumably summon the portal on any point of the tile grid, we cannot know any specific coordinates to call.
As I told you, calculate... If it's facing up for example, X = X of player, Y = Y of player - 1
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,100
Reaction score
13,705
First Language
English
Primarily Uses
RMMV
You can use these methods:

x = $game_map.round_x_with_direction($game_player.x, $game_player.direction)y = $game_map.round_y_with_direction($game_player.y, $game_player.direction)
then make your event spawn at the point designated by x and y.  However, that could be ANYWHERE on the map - on a tree, on the wall of a house, on a cliff or hill, in the water.  There is no check that the tile in front of the player is a VALID tile for a particular event to spawn on.  You would have to do that check yourself, using whatever rules you need for the purpose you have in mind.
 

metronome

Veteran
Veteran
Joined
Aug 21, 2014
Messages
338
Reaction score
144
First Language
English (Sure!)
Primarily Uses
@shaz

I see something interesting here.

I just knew that you don't have to define the X and Y in numbers!

So basically, all I have to do is making a script call:

x = $game_map.round_x_with_direction($game_player.x, $game_player.direction)
y = $game_map.round_y_with_direction($game_player.y, $game_player.direction)

spawn_event_location(x, y, 12)
and then the event 12 will spawn anywhere the player is

right?
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,100
Reaction score
13,705
First Language
English
Primarily Uses
RMMV
It will spawn on the tile in front of the player, not where the player is.


If you put that into the script call and it gives an error, it'll be because you're using an earlier version of the engine and the lines are too long, and have auto-wrapped in a bad place. If that happens, make the lines break after the ( and before $game_player and it should be right.
 

Dymdez

Newbie-in-Chief
Veteran
Joined
Feb 4, 2014
Messages
752
Reaction score
154
First Language
English
Primarily Uses
It will spawn on the tile in front of the player, not where the player is.

If you put that into the script call and it gives an error, it'll be because you're using an earlier version of the engine and the lines are too long, and have auto-wrapped in a bad place. If that happens, make the lines break after the ( and before $game_player and it should be right.
I tried it, then tried it with the adjusted line breaks - still receive this error. Tried in new project as well.

 
Last edited by a moderator:

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
Then maybe get the new version of Ace.. :)
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
Not sure, but getting it won't really do any harm...
 

Evgenij

Veteran
Veteran
Joined
Aug 28, 2013
Messages
349
Reaction score
100
First Language
German
Primarily Uses
N/A
This should fit in the small scriptcall box:

Code:
x = $game_player.xy = $game_player.yd = $game_player.directionx = $game_map.round_x_with_direction(x, d)y = $game_map.round_y_with_direction(y, d)spawn_event_location(x, y, 12)
 

Dymdez

Newbie-in-Chief
Veteran
Joined
Feb 4, 2014
Messages
752
Reaction score
154
First Language
English
Primarily Uses
This should fit in the small scriptcall box:

x = $game_player.xy = $game_player.yd = $game_player.directionx = $game_map.round_x_with_direction(x, d)y = $game_map.round_y_with_direction(y, d)spawn_event_location(x, y, 12)
Haha, all this did was transfer me to the map I have the event on! At least no error, moving in right direction? It isn't transferring me, but rather its making other events disappear? Edit: Yes, when I use the script, it makes one of the events on my map disappear, then spawns the event correctly. Any idea as to why a random event would disappear right before the spawn occurs?

Any ideas? This is what I have

x = $game_player.x

y = $game_player.y

d = $game_player.direction

x = $game_map.round_x_with_direction(x, d)

y = $game_map.round_y_with_direction(y, d)

spawn_event_location(x, y, 1, 3)
 
Last edited by a moderator:
Status
Not open for further replies.

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

Latest Threads

Latest Posts

Latest Profile Posts

"You can thank my later", "But you haven't done anything", "Well, that's why ..."
Are we allowed to post about non-RPG Maker games?
I should realize that error was produced by a outdated version of MZ so that's why it pop up like that
Ami
i can't wait to drink some ice after struggling with my illness in 9 days. 9 days is really bad for me,i can't focus with my shop and even can't do something with my project
How many hours have you got in mz so far?

Forum statistics

Threads
105,884
Messages
1,017,240
Members
137,609
Latest member
shododdydoddy
Top