じ☆ve冰风 发表于 2026-8-1 19:39:14

DL: Self Switch Reset



Script: Self Switch Reset
Difficulty: Easy
Short Version: Reset an Event's Self Switches when changing maps.
Spoiler: Script                Code:       
#--------------------------------#
# 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.match(DL::Renew::Regex)
         bob = res.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.reset_ssif @event.pages
   bob = @page.reset_ss if bob == "" or bob.include? "0"
   
   $game_self_switches[] = false if bob.include? "a"
   $game_self_switches[] = false if bob.include? "b"
   $game_self_switches[] = false if bob.include? "c"
   $game_self_switches[] = false if bob.include? "d"
   end

end


---

So pretty much the idea for this script came from thinking: if I give an Event a "Status Effect" A that turns him into an old man, I don't want to leave that old A on when I come back.So what this small script does is reset a few Self Switches whenever you reload a map.For this script, you place the

<resetss: 0abcd>

in a Comment, and you place that Comment in the first line of the Event Page.The letters in the string each represent a Self Switch, so if you want to turn off Self Switch A and C, you put down <resetss: ac>

You can put the notetag in any page so that they'll only affect that page, but you can also put the notetag in the first page to affect ALL the pages.However, if you want that notetag to affect only the first page, you'll have to add 0 (zero) into the string.


本贴来自国际rpgmaker官方论坛作者:Harosata处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/dl-self-switch-reset.85861/
页: [1]
查看完整版本: DL: Self Switch Reset