[RMVX ACE] THIS MIGHT BE VERY BASIC BUT...
Posts
Pages:
1
Hey everybody, I need some help that I hope is simple and I may just possibly overlooking something and that is!
How to start a script on a switch command or through a common event, or at least have it hidden until called upon.
The script is basically just an add on to the Survival script I'm using to make a HUD display on screen. But I don't want it showing up until after the introduction. Usually I would just hide it behind a black picture or something but since it's a draw onto screen it overlaps the picture.
Here's the script:
Maybe this is extremely basic and I'm still learning about scripts and I have just enough knowledge to usually edit them to my needs but I'm clueless right now for something like this.
Any help will greatly be appreciated! Thank you!
How to start a script on a switch command or through a common event, or at least have it hidden until called upon.
The script is basically just an add on to the Survival script I'm using to make a HUD display on screen. But I don't want it showing up until after the introduction. Usually I would just hide it behind a black picture or something but since it's a draw onto screen it overlaps the picture.
Here's the script:
class Scene_Map < Scene_Base
alias :start_up :start
def start
start_up
create_survival_window
end
def create_survival_window
barcount = 0
if $survival_s[1] == true
barcount += 1 if $survival_s[6] == false || $survival_v[1] < Anyx::LIFEHIDEVAL
end # if $survival_s[1] == true
if $survival_s[2] == true
barcount += 1 if $survival_s[7] == false || $survival_v[2] < Anyx::FOODHIDEVAL
end # if $survival_s[2] == true
if $survival_s[3] == true
barcount += 1 if $survival_s[8] == false || $survival_v[3] < Anyx::WATERHIDEVAL
end # if $survival_s[3] == true
if $survival_s[4] == true
barcount += 1 if $survival_s[9] == false || $survival_v[4] < Anyx::RESTHIDEVAL
end # if $survival_s[4] == true
if $survival_s[5] == true
barcount += 1 if $survival_s[10] == false || $survival_v[5] > Anyx::TOXINHIDEVAL
end # if $survival_s[5] == true
@survival_window = Window_Survival.new
@survival_window.contents.draw_text(-23, -23, -23, -23, " Survival System") if barcount == 0
barcount -= 1 if barcount >= 1
survivalwinypos = Anyx::WINYPOS - (-23 * barcount)
@survival_window.x = Anyx::WINXPOS
@survival_window.y = survivalwinypos
@survival_window.opacity = Anyx::WINOPACITY
@refresh_timer = 90
end # def create_survival_window
alias :map_update_up :update
def update
map_update_up
@refresh_timer = @refresh_timer > 0 ? @refresh_timer - 1 : 90
@survival_window.refresh if @refresh_timer == 0
end
end # class Scene_Map < Scene_Base]
Maybe this is extremely basic and I'm still learning about scripts and I have just enough knowledge to usually edit them to my needs but I'm clueless right now for something like this.
Any help will greatly be appreciated! Thank you!
I'm not 100% on this, but, my guess is something along the lines of either...
...this, or, for a way that might make more sense...
...that? Though, this is largely assuming that the introduction is over after the first game-switch is active/on. If it's a different game-switch, you just need to change the number in the square-brackets. If it's a self-switch... that's a bit more complicated, but still probably doable.
alias :start_up :start def start start_up create_survival_window if $game_switches[1] == true end
...this, or, for a way that might make more sense...
alias :start_up :start def start start_up if $game_switches[1] == true create_survival_window end end
...that? Though, this is largely assuming that the introduction is over after the first game-switch is active/on. If it's a different game-switch, you just need to change the number in the square-brackets. If it's a self-switch... that's a bit more complicated, but still probably doable.
The second one works for a second(after fixing the word switches :P)
But then I get this error:

Which is the script refreshing and checking the HUD to change and lower the Food/Water values. Which shouldn't be taking affect though, right? Since the script isn't turned on yet.
But then I get this error:

Which is the script refreshing and checking the HUD to change and lower the Food/Water values. Which shouldn't be taking affect though, right? Since the script isn't turned on yet.
It's probably throwing that error because @refresh_timer is (only?) defined in the create_survival_window function. If my guess is right, and the switch is off, that function gets skipped, that instance-variable is not defined, so it has nil as it's value.
The thought in my head is to do something like...
...that, and see what all happens!
*Edit: Personally speaking, I hate lines that look like...
...this, because it looks confusing as hell. Even if I know this a kind of if-then statementthat I would have to look up to see what, exactly, it's supposed to do.
The thought in my head is to do something like...
alias :map_update_up :update def update map_update_up if @refresh_timer != nil @refresh_timer = @refresh_timer > 0 ? @refresh_timer - 1 : 90 @survival_window.refresh if @refresh_timer == 0 end end
...that, and see what all happens!
*Edit: Personally speaking, I hate lines that look like...
@refresh_timer = @refresh_timer > 0 ? @refresh_timer - 1 : 90
...this, because it looks confusing as hell. Even if I know this a kind of if-then statement
Ahhh, that did it! So far so good :D
The window doesn't show up even when I turn the switch on unless I go to the menu which isn't a big deal since I'm going to force the menu open anyway at the beginning after the intro
Thank you so much, Marrend! I really appreciate your help :)
The window doesn't show up even when I turn the switch on unless I go to the menu which isn't a big deal since I'm going to force the menu open anyway at the beginning after the intro
Thank you so much, Marrend! I really appreciate your help :)
Pages:
1















