RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
(Resolved) Activating an event through a script

0 Members and 1 Guest are viewing this topic.

**
Rep:
Level 83
All that you know is at an end...
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 for:
   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

And here's the event page that is supposed to activate:
Spoiler for:


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.
« Last Edit: November 30, 2009, 05:52:50 AM by CursedBlackWolf »

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
What are the triggers for that event? Is it parallel process with a switch condition? Is it the last page in the event?

*
Rep:
Level 87
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.

**
Rep:
Level 83
All that you know is at an end...
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.

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.

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
DO any of the pages in the event include the "Erase Event" command?

**
Rep:
Level 83
All that you know is at an end...
DO any of the pages in the event include the "Erase Event" command?

They do not.

*
? ? ? ? ? ? ? ? ? The nice kind of alien~
Rep:
Level 92
Martian - Occasionally kind
If I remember correctly then you need to tell the game_map that it needs to refresh:
Code: [Select]
$game_map.need_refresh = true

*
Rep:
Level 87
Hey, that's what I was going to say next ;)
Always remember you're unique.
Just like everybody else.

**
Rep:
Level 83
All that you know is at an end...
You guys are awesome!

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

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

Worked like a charm!