Jump to content
Sign in to follow this  
LanceGardner

Help With Global Self Switch A Reset

Recommended Posts

Hello all,

 

I really want a script to enable me to turn off all self switches of a type, let's say 'D'. I found this topic, which seems to have exactly what I need:

 

http://www.rpgmakervxace.net/topic/30665-resetting-self-switches-a-only/

 

However, I'm a newb. I think I need to put the second part (bulk_self_switch("A", false)) as a script call, but I don't know where to put this part: 

 

class Game_SelfSwitches
def bulk_set(letter, state)
switches = @data.keys.select {|data| p data; data[2] == letter }
switches.each {|key| self[key] = state }
end
end

class Game_Interpreter
def bulk_self_switch(letter, state)
$game_self_switches.bulk_set(letter, state)
end
end

 

Do I put it in the Game Interpreter script? If so, what line? Or is it a different Script Call?

 

Many thanks to anyone who can help me.

 

 

Share this post


Link to post
Share on other sites

I'm not sure about this script, but there is a way to turn all self-switches for example 'D' in one map.
 
Just use this script call:

666.times {|event_id| $game_self_switches[[6, event_id, "A"]] = false }
 ^                                         ^             ^        ^
This is how many events                ID of map       Self   turn ON/OFF
should it affect. It is based    where the switches   switch
on event ID                    should be dis/en-abled

Or if you want to choose which events it should affect then use this:

[10,15,20,25,33].each {|event_id| $game_self_switches[[6, event_id, "A"]] = false }
       ^                                               ^             ^        ^
  Switch ID's                                       Map ID      self switch   Turn OFF/ON

Will this be enough or you want to turn off ALL the self switches at once?

Share this post


Link to post
Share on other sites

Unfortunately it has to be all at once. I'm familiar with the One Map method. :/

 

Thanks for your reply, though. Would you have any idea where I should put that snippit of code? I've posted on two forums and private messaged Hime, who made the topic, and all with no luck so far. :/ 

Share this post


Link to post
Share on other sites

This snippet:

class Game_SelfSwitches
  def bulk_set(letter, state)
    switches = @data.keys.select {|data| p data; data[2] == letter }
    switches.each {|key| self[key] = state }
  end
end

class Game_Interpreter
  def bulk_self_switch(letter, state)
    $game_self_switches.bulk_set(letter, state)
  end
end 

should be pasted in a new slot, highly preferable below 'â–¼ Materials' and above 'â–¼ Main Process'.

 

 

knBxg16.png

As you can see, I have some scripts installed already.

 

 

 

And in game just use this script call.

bulk_self_switch("A", false)

That should work.

Share this post


Link to post
Share on other sites

To be honest it could be done in both ways.
As you noticed - the classes are already in your base scripts, so you could just simply copy&paste "def"'s to these classes in your default scripts. (edit base scripts)
However messing with base scripts may be problematic for new users and it'll bring problems with locating the problem when your game will be crashing.
 
And no problem, glad could help! (=
So it works and it is solved? =3
 
I have moved this thread to 'Ace Script Support'.

Share this post


Link to post
Share on other sites

That was my fear, I'm hesitant to modify the main scripts, but I'm quite used to using normal scripts by now. I just didn't know that was a script, as opposed to a script call or a modification to the main scripts or a comment or a notetag or what... 

 

So, I just tested it and it works! Finally my Loot System works! Thank you so much for your help.

 

I was tired of complicated loot events, and configuring each one individually, so I made an Common Event which first reads the Map Variable, then rolls a random number when you button press the Event (imagine a bush or a log, in a forest map). If it's a high result you get rare loot specific to that map (so in the forest you get a Silkcap Mushroom if it's rare, for example, which is worth a lot to sell), if it's medium you get normal and if it's low you get nothing. Then it switches the self switch to on, which obviously makes it empty if you try again. 

 

Now, when I go back to my party select screen (which one does between missions), all of the random loot drops for the previous mission reset, but opened treasure chests (which are on a different self switch) and dialogues stay memorised. That means I can just copy the same Loot Event across every single one of my maps and just change the graphic to a bush in the forest, a rock in the caves, etc. 

 

Sorry to rant but I'm quite proud, that system would have been completely beyond me a month ago and now it works like a dream. :) Thanks again. 

Edited by LanceGardner

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×