Main Menu
  • Welcome to The RPG Maker Resource Kit.

(Resolved) Activating an event through a script

Started by CursedBlackWolf, November 29, 2009, 07:05:03 PM

0 Members and 1 Guest are viewing this topic.

CursedBlackWolf

I'm having a bit of a problem with a script I'm working on. I'm trying to make it so that a specific switch is turned on when a selection is made from a custom menu script, thereby activating an event on the current map. The problem is that the event does not start until you leave the current map, and come back to it.

Here's the script lines used:
[spoiler]    if Input.trigger?(Input::C)
     case @command_window.index
       when 0 # City upgrades
         if $game_variables[3] < $game_variables[43] and $game_variables[4] < $game_variables[44]
           $game_system.se_play($data_system.cancel_se)
         end
         if $game_variables[3] >= $game_variables[43] and $game_variables[4] >= $game_variables[44]
           $game_system.se_play($data_system.decision_se)
           $game_variables[5] = ($game_variables[5] + 1 )
           $game_variables[3] = ($game_variables[3] - $game_variables[43])
           $game_variables[4] = ($game_variables[4] - $game_variables[44])
           $game_switches[11] = true
           $scene = Scene_Map.new
         end[/spoiler]

And here's the event page that is supposed to activate:
[spoiler]
[/spoiler]

As I said, the event doesn't start unless you leave the map and return to it, and I can't figure out how to change that.

modern algebra

What are the triggers for that event? Is it parallel process with a switch condition? Is it the last page in the event?

shaz

You don't have another page on that event that's run when the switch is off, that erases the event, do you?
Always remember you're unique.
Just like everybody else.

CursedBlackWolf

Quote from: shaz on November 29, 2009, 09:10:39 PM
You don't have another page on that event that's run when the switch is off, that erases the event, do you?

I do not. It's the last page of the event. The first page is completely blank.

Quote from: modern algebra on November 29, 2009, 07:23:00 PM
What are the triggers for that event? Is it parallel process with a switch condition? Is it the last page in the event?

It's on Auto run with a switch condition, and it's the last page of the event.

modern algebra

DO any of the pages in the event include the "Erase Event" command?

CursedBlackWolf


Zeriab

If I remember correctly then you need to tell the game_map that it needs to refresh:
$game_map.need_refresh = true

shaz

Always remember you're unique.
Just like everybody else.

CursedBlackWolf

You guys are awesome!

I figured it had something to do with refreshing the map, I just didn't know the correct code. Thanks!

Quote from: ???ï?? on November 30, 2009, 01:25:41 AM
If I remember correctly then you need to tell the game_map that it needs to refresh:
$game_map.need_refresh = true

Worked like a charm!