Nereid

Veteran
Veteran
Joined
Sep 22, 2021
Messages
331
Reaction score
96
First Language
none
Primarily Uses
RMMZ
I still can't get why this happens...

1642349581872.png

Usually it's some event... but I literally disabled all of them (with an unactivated condition, I'm assuming the script doesn't still check events that can't even trigger?) - so I should have nothing that activates when the player goes on this map... and, needless to say, there's no <resetss: 0abcd> anywhere, either. Why does it keep referring to that line 50? Which has
bob = @page.reset_ss if bob == "" or bob.include? "0"
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
35,826
Reaction score
9,479
First Language
German
Primarily Uses
RMMV
please give a link to the website where you got the reset self switch script from.
no one can help you without a link to that website
 

Nereid

Veteran
Veteran
Joined
Sep 22, 2021
Messages
331
Reaction score
96
First Language
none
Primarily Uses
RMMZ
It's not very long:
#--------------------------------# # Dramatic Lightning Co Presents: # Self Switch Reseter #--------------------------------# # You can reset your Event's Self Switches with this script! # Create a Comment in the first line of your Event page and # place <resetss: 0abcd> there. abcd are the letters of the # self switch you want to reset. #--------------------------------# # By default, you only need to place the notetag in the first # page and it'll reset the self switches regardless of what # page you're on. You can put 0 (zero) in the notetag so that it'll # only affect the first page. Alternatively, you can place the # notetags in each other page. #--------------------------------# module DL module Renew Regex = /<resetss:\s*(\w+)\s*>/i end end module RPG class Event::page def reset_ss bob = "" @list.each {|cmd| if cmd.code == 108 && res = cmd.parameters[0].match(DL::Renew::Regex) bob = res[1].to_s end } return bob end end end class Game_Event < Game_Character alias dl_renew_initialize initialize def initialize(map_id, event) dl_renew_initialize(map_id, event) renew_self(map_id, event) refresh end def renew_self(map_id, event) bob = "" bob = @event.pages[0].reset_ss if @event.pages[0] bob = @page.reset_ss if bob == "" or bob.include? "0" $game_self_switches[[map_id, event.id, "A"]] = false if bob.include? "a" $game_self_switches[[map_id, event.id, "B"]] = false if bob.include? "b" $game_self_switches[[map_id, event.id, "C"]] = false if bob.include? "c" $game_self_switches[[map_id, event.id, "D"]] = false if bob.include? "d" end end
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
3,992
Reaction score
1,040
First Language
English
Primarily Uses
RMVXA
It's not very long:
Regardless you need to use a code block when pasting code into your post.
There actually seems to be an error in the code you posted as well.
It took a while to figure out how to use the script.
using <reset_ss: 0abcd> pretty makes the code useless from what I can tell.
Only works on page 0? If you self switch A on then your on page 1. How will the code even work then.
I did a test and put <reset_ss: abcd> on page 2 of an event.
It did nothing until I changed maps. So when reloading a map is when the script works.
Then it makes sense for the 0 to come into affect. Page 0 is read and all self switches are turned off.

the P in Event:: Page was not capitalized
Ruby:
#--------------------------------#
# Dramatic Lightning Co Presents:
# Self Switch Reseter
#--------------------------------#
# You can reset your Event's Self Switches with this script!
# Create a Comment in the first line of your Event page and
# place <resetss: 0abcd> there.  abcd are the letters of the
# self switch you want to reset.
#--------------------------------#
# By default, you only need to place the notetag in the first
# page and it'll reset the self switches regardless of what
# page you're on.  You can put 0 (zero) in the notetag so that it'll
# only affect the first page.  Alternatively, you can place the
# notetags in each other page.
#--------------------------------#


module DL
  module Renew
   Regex = /<resetss:\s*(\w+)\s*>/i
  end
end

module RPG
  class Event::Page

   def reset_ss
     bob = ""
     @list.each {|cmd|
       if cmd.code == 108 && res = cmd.parameters[0].match(DL::Renew::Regex)
         bob = res[1].to_s
       end
     }
     return bob
   end
  end
end

class Game_Event < Game_Character
  alias dl_renew_initialize initialize
  def initialize(map_id, event)
   dl_renew_initialize(map_id, event)
   renew_self(map_id, event)
   refresh
  end

   def renew_self(map_id, event)
     bob = ""
     bob = @event.pages[0].reset_ss  if @event.pages[0]
     bob = @page.reset_ss if bob == "" or bob.include? "0"
 
     $game_self_switches[[map_id, event.id, "A"]] = false if bob.include? "a"
     $game_self_switches[[map_id, event.id, "B"]] = false if bob.include? "b"
     $game_self_switches[[map_id, event.id, "C"]] = false if bob.include? "c"
     $game_self_switches[[map_id, event.id, "D"]] = false if bob.include? "d"
   end
 
end
 

Nereid

Veteran
Veteran
Joined
Sep 22, 2021
Messages
331
Reaction score
96
First Language
none
Primarily Uses
RMMZ
Ignore the uncapitalized p really, it was something I ended up changing before using the code tag because the forum interpreted it as a tongue-in-cheek emoji... other than that though, what could I do? Not sure I understood what I can change with the first paragraph.
 

gstv87

Veteran
Veteran
Joined
Oct 20, 2015
Messages
2,708
Reaction score
1,776
First Language
Spanish
Primarily Uses
RMVXA
reset_ss: is a method.
"undefined method reset_ss for nil:nilclass" is the error

think!
how can "reset_ss" be undefined, if you just pasted it from the code where it is defined?
if page.reset_ss is undefined, that means page is undefined.
where is that page coming from!?
trace the code! that's how you find errors!

Code:
 def renew_self(map_id, event)
     bob = ""
     bob = @event.pages[0].reset_ss  if @event.pages[0]
     bob = @page.reset_ss if bob == "" or bob.include? "0"
     $game_self_switches[[map_id, event.id, "A"]] = false if bob.include? "a"
     $game_self_switches[[map_id, event.id, "B"]] = false if bob.include? "b"
     $game_self_switches[[map_id, event.id, "C"]] = false if bob.include? "c"
     $game_self_switches[[map_id, event.id, "D"]] = false if bob.include? "d"
  end

this
Code:
bob = @event.pages[0].reset_ss  if @event.pages[0]    
bob = @page.reset_ss if bob == "" or bob.include? "0"
includes a reference to the error.
THIS, is problematic to the analysis of the problem.
so, make THIS, something LESS problematic:

Code:
page = @event.pages[0]
if page != nil
 bob = @event.pages[0].reset_ss
 if bob == "" or bob.include? "0"
  bob = @page.reset_ss
 end
end

STRUCTURE.
the code can't go where you don't let it.
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
6,812
Reaction score
9,117
First Language
Indonesian
Primarily Uses
RMVXA
Eh, my personal fix would be like this to replace line 50
Code:
bob = @page.reset_ss if @page && (bob == "" || bob.include? "0")
 

gstv87

Veteran
Veteran
Joined
Oct 20, 2015
Messages
2,708
Reaction score
1,776
First Language
Spanish
Primarily Uses
RMVXA
@TheoAllen there is a priority for running those, that I'm not sure it will affect the thing.
the plain basic structure is fail-proof.
it's the OG thing, and you can always rely on it working as intended.
 

kyonides

Reforged is laughable
Veteran
Joined
Nov 17, 2019
Messages
431
Reaction score
170
First Language
English
Primarily Uses
RMXP
@Nereid why exactly do you need this script? Wouldn't it be easier to manually reset the self switch? Or use a script that allows you to do the same with a short script call?
 

Nereid

Veteran
Veteran
Joined
Sep 22, 2021
Messages
331
Reaction score
96
First Language
none
Primarily Uses
RMMZ
A script that's even shorter?
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
35,826
Reaction score
9,479
First Language
German
Primarily Uses
RMMV
@Nereid
there is one question you have to answer:

what do you want that script to do?

If you cannot answer that question, then the solution is to remove that script because you don't need it.
 

Nereid

Veteran
Veteran
Joined
Sep 22, 2021
Messages
331
Reaction score
96
First Language
none
Primarily Uses
RMMZ
I'm using it to respawn enemies. What's strange, though, is that the error occurs where there are no such events.
 
Last edited:

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
3,992
Reaction score
1,040
First Language
English
Primarily Uses
RMVXA
it was something I ended up changing before using the code tag because the forum interpreted it as a tongue-in-cheek emoji.
That's why you use code tags like I did.
I'm assuming the script doesn't still check events that can't even trigger?
It looks like it only checks the first page and the current page. (if not page 0)
I actually explained what the bug was already.
Didn't catch that.
the error occurs where there are no such events.
What do you mean. No events with the comment? That doesn't matter if (as KK20 said) there are events that do not have a valid page condition.

It's like this. You have an event -> it only has one page -> it's on a condition that switch 3 is on - > switch 3 is off -> event does not have a valid page.

Insert this above the error line.
return if @page.nil?
The error will not show up again. *tested and confirmed with getting the error and this fixes it.
 

Nereid

Veteran
Veteran
Joined
Sep 22, 2021
Messages
331
Reaction score
96
First Language
none
Primarily Uses
RMMZ
Yep, seems to have fixed it, thanks.
 

Latest Threads

Latest Profile Posts

The power of tutorials. This was fun to make,parallax lightning makes more sense to me now. Now comes the annoying step of doing stuff without a step by step show though !_!
With the new phone, I can now play a lot of old RPGs that my old phone just didn't have room for. Some RPGs definitely show their age even with updated graphics and quick saving.
I don't think I have ever stuck to a project this long....And I'm still just in the planning stages basically xD
It's not about the engine, it's about the resources.

Forum statistics

Threads
121,963
Messages
1,145,505
Members
160,243
Latest member
KrisSis265
Top