Call common event before every map event activation?

Geoff Moore

Composer for Hire
Veteran
Joined
Jun 12, 2014
Messages
1,399
Reaction score
731
First Language
English
Primarily Uses
N/A
I'd like a common event to run whenever the player activates a map event, directly before the event itself. I know I could go into every separate event to trigger it, but is there a way to make a general rule with code instead?

Thanks for reading!
 

SoulPour777

Crownless King
Veteran
Joined
Aug 15, 2012
Messages
1,093
Reaction score
104
First Language
English
Primarily Uses
N/A
What do you mean "whenever the player activates a map event" exactly?
 

Geoff Moore

Composer for Hire
Veteran
Joined
Jun 12, 2014
Messages
1,399
Reaction score
731
First Language
English
Primarily Uses
N/A
Whenever the player uses the action button for an action button event, touches a player touch event, or triggers an autorun event.
 

??????

Diabolical Codemaster
Veteran
Joined
May 11, 2012
Messages
6,513
Reaction score
3,202
First Language
Binary
Primarily Uses
RMMZ
Put this in your script editor and replace ID with the id of the event you want to call..

Code:
class Game_Event  alias :start_comevv :start  def start(*args)    $game_temp.reserve_common_event( ID )    start_comevv(*args)  endend
 

Geoff Moore

Composer for Hire
Veteran
Joined
Jun 12, 2014
Messages
1,399
Reaction score
731
First Language
English
Primarily Uses
N/A
Hmm, that hangs the game. (I put it in a new script in Materials, is that right?)

Is the script applying to EVERY event, including common events? If it is, then I guess the common event I want to run is calling itself, causing an endless loop? So I just need it to run on events on the map, if possible.
 

??????

Diabolical Codemaster
Veteran
Joined
May 11, 2012
Messages
6,513
Reaction score
3,202
First Language
Binary
Primarily Uses
RMMZ
Yea just under materials and above main.

Thats a strange one.. It only applies to the Game_Events. Game_CommonEvent is a diffferent thing altogether.. Maybe I'm overlooking something :/
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
What are you trying to accomplish? What's so special about the common event you want to run?
 

??????

Diabolical Codemaster
Veteran
Joined
May 11, 2012
Messages
6,513
Reaction score
3,202
First Language
Binary
Primarily Uses
RMMZ
yea thats a very good question..

If its just to something simple it could be much easier to script and then it wouldnt require the common event :p
 

Geoff Moore

Composer for Hire
Veteran
Joined
Jun 12, 2014
Messages
1,399
Reaction score
731
First Language
English
Primarily Uses
N/A
Sorry for the delay, sleep and work happened. Here's the event, it just stops any character animations that are taking place:

screen.jpg
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
Alright then ...

1. If the player is facing down, you don't need to TELL them to turn down - they're ALREADY facing down.

2. You're asking for a script that lets you call a common event that then does script calls. Uh-huh.

3. Do this:

Code:
class Game_Event  alias :start_comevv :start  def start(*args)    if trigger_in?([0,1,2])      $game_player.set_char("$bugwalk",1,2,2)      $game_player.restore_char    end    start_comevv(*args)  endend
So if any event is triggered by action button, player touch or event touch, Galv's (?) script calls will be executed before the event starts.
 
Last edited by a moderator:

??????

Diabolical Codemaster
Veteran
Joined
May 11, 2012
Messages
6,513
Reaction score
3,202
First Language
Binary
Primarily Uses
RMMZ
Extra points to Shaz for guessing the script that the calls are from (assuming of course that she is (edit:) right )
 
Last edited by a moderator:

Geoff Moore

Composer for Hire
Veteran
Joined
Jun 12, 2014
Messages
1,399
Reaction score
731
First Language
English
Primarily Uses
N/A
Oh, sorry, I should have explained that! It's Galv's Move Route Extras. The reason the player turns in their current direction before the graphic changes is because my animations are using up/down/left/right frames of character graphics, so that will need to go in there. I can totally see why it seemed redundant, I should have explained myself better. Also, should the script read: $game_player.restore_char?
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
yes. Typo. sorry.

I still don't see why you want to turn them in a direction they're already facing. Your condition says "if the player is facing left, then make them turn left". But if they're facing left, they are ALREADY turned left.

Try it the way I posted (with the typo fixed), and if you STILL think they need to turn to face the direction they're already facing (and I REALLY don't think they do), add the extra line as shown:

Code:
class Game_Event  alias :start_comevv :start  def start(*args)    if trigger_in?([0,1,2])      $game_player.set_direction($game_player.direction)      $game_player.set_char("$bugwalk",1,2,2)      $game_player.restore_char    end    start_comevv(*args)  endend
 
Last edited by a moderator:

??????

Diabolical Codemaster
Veteran
Joined
May 11, 2012
Messages
6,513
Reaction score
3,202
First Language
Binary
Primarily Uses
RMMZ
@Shaz - to make them face left-er ?
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
Yes, because sometimes you just can't face left enough.


I don't think it's necessary, but the OP seems adamant, so I figured I'd provide it now, just in case they proved me wrong and I had to provide it later anyway :)
 

??????

Diabolical Codemaster
Veteran
Joined
May 11, 2012
Messages
6,513
Reaction score
3,202
First Language
Binary
Primarily Uses
RMMZ
Nah, can never face too left. The more the better imo...
Could maybe enhance the method so that it turns left, turns right, then turns left again - just to show that left is better ^_^
 

Geoff Moore

Composer for Hire
Veteran
Joined
Jun 12, 2014
Messages
1,399
Reaction score
731
First Language
English
Primarily Uses
N/A
IT'S STILL NOT LEFT ENOUGH!! j/k

I am such a moron...

However, I do still need the branching as the code currently turns my character down regardless of which direction they were facing. The last 2 of $game_player.set_char("$bugwalk",1,2,2) denotes the direction row of the character sheet, 2 for down, 4 for left, 6 for right and 8 for up.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
We'll get there :)

Code:
class Game_Event  alias :start_comevv :start  def start(*args)    if trigger_in?([0,1,2])      $game_player.set_direction($game_player.direction)      $game_player.set_char("$bugwalk",1,2,$game_player.direction)      $game_player.restore_char    end    start_comevv(*args)  endend
And maybe THAT means you can remove the set_direction command.
 
Last edited by a moderator:

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

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,853
Messages
1,016,986
Members
137,561
Latest member
visploo100
Top