I am turning to the forums as I'm starting to get...
"Desperate, your turn."
"Desperate."
"Desperate."
"Desperate."
I am working on a game which uses a whole bunch of screens. For instance, while in the "basement" label, the player can click on one of their dinosaurs, which in itself is a screen. Doing this will show screens related to that dinosaur, such as a "feed", "talk" and "kill" screen. Were a player to.. say, kill a selected dinosaur, it will of course disappear from view, and a whole bunch of variables will change.
Whenever one of these related dinosaur screens are clicked ("feed", "talk" and "kill"), I make the game use ui.callsinnewcontext to essentially reload the "basement" label where all this takes place. This is necessary for the game to update itself on the variables that change when you kill, feed or talk to one of your dinosaurs.
Now for the actual issue at hand. It would seem that whatever happens after a label has been loaded via ui.callsinnewcontext will not be saved should the player wish to save their game and load it later. Essentially, whenever the player loads their game after having interacted with their dinosaurs, all of those interactions are nullified.
"What a shame."
- JC Denton
2052
Here is some code to (hopefully) help you understand what is happening.
First off we got a simplified view of the basement label:
Code: Select all
label basement:
if velociraptor <= 0:
$ velociraptor_power = 0
$ velociraptor_noise = 0
$ velociraptor_food = 0
if velociraptor == 2:
$ velociraptor_power = 0
$ velociraptor_noise = 0
$ velociraptor_food = 0
$ velociraptor_health = 10
if velociraptor_hatch >= 3:
$ velociraptor = 1
if velociraptor == 1:
$ velociraptor_stage = 1
$ velociraptor_power = 2
$ velociraptor_noise = 4
$ velociraptor_food = 4
if velociraptor_health >= 55 and velociraptor_health <=119:
$ velociraptor_stage = 2
$ velociraptor_power = 5
$ velociraptor_noise = 10
$ velociraptor_food = 8
if velociraptor_health >= 120:
$ velociraptor_stage = 3
$ velociraptor_power = 3
$ velociraptor_noise = 12
$ velociraptor_food = 10
if velociraptor_health <= 0:
$ velociraptor = 0
if velactive == 1:
show screen velociraptor2
show screen velociraptor_feed
show screen velociraptor_kill
show screen velociraptor_talk
show screen velociraptor_info
if velociraptor >= 1 and velactive == 0:
show screen velociraptorHere are the screens related to the velociraptor:
Code: Select all
screen velociraptor:
vbox xalign 0.91 yalign 0.12:
imagebutton:
idle "ui/ui_velociraptor.png"
hover "ui/ui_velociraptor_hover.png"
#All this messy stuff below has to do with the (probably inefficient) way I've dealt with the existance of 9 other dinosaurs in the game. Essentially, it hides screens from dinosaurs you no longer have selected as you're selecting the velociraptor. Very messy, though I am by no means a particularly skilled coding-person
action [ SetVariable("oviactive", 0), SetVariable("velactive", 1), SetVariable("plaactive", 0), SetVariable("caractive", 0), SetVariable("triactive", 0), SetVariable("ankactive", 0), SetVariable("spiactive", 0), SetVariable("steactive", 0), SetVariable("albactive", 0), SetVariable("oloactive", 0), Show("velociraptor_kill"), Show("velociraptor_feed"), Show("velociraptor_talk"), Show("velociraptor2"), Hide("velociraptor"), Show("velociraptor_info"), Hide("albertosaurus_info"), Hide("albertosaurus_kill"), Hide("albertosaurus_feed"), Hide("albertosaurus_talk"), Hide("albertosaurus2"), If ( (albertosaurus == 1 or albertosaurus == 2), true = Show("albertosaurus"), false = Hide("albertosaurus") ), Hide("oviraptor_info"), Hide("oviraptor_kill"), Hide("oviraptor_feed"), Hide("oviraptor_talk"), Hide("oviraptor2"), If ( (oviraptor == 1 or oviraptor == 2), true = Show("oviraptor"), false = Hide("oviraptor") ), Hide("spinosaurus_info"), Hide("spinosaurus_kill"), Hide("spinosaurus_feed"), Hide("spinosaurus_talk"), Hide("spinosaurus2"), If ( (spinosaurus == 1 or spinosaurus == 2), true = Show("spinosaurus"), false = Hide("spinosaurus") ), Hide("carnotaurus_info"), Hide("carnotaurus_kill"), Hide("carnotaurus_feed"), Hide("carnotaurus_talk"), Hide("carnotaurus2"), If ( (carnotaurus == 1 or carnotaurus == 2), true = Show("carnotaurus"), false = Hide("carnotaurus") ), Hide("olorotitan_info"), Hide("olorotitan_kill"), Hide("olorotitan_feed"), Hide("olorotitan_talk"), Hide("olorotitan2"), If ( (olorotitan == 1 or olorotitan == 2), true = Show("olorotitan"), false = Hide("olorotitan") ), Hide("triceratops_info"), Hide("triceratops_kill"), Hide("triceratops_feed"), Hide("triceratops_talk"), Hide("triceratops2"), If ( (triceratops == 1 or triceratops == 2), true = Show("triceratops"), false = Hide("triceratops") ), Hide("ankylosaurus_info"), Hide("ankylosaurus_kill"), Hide("ankylosaurus_feed"), Hide("ankylosaurus_talk"), Hide("ankylosaurus2"), If ( (ankylosaurus == 1 or ankylosaurus == 2), true = Show("ankylosaurus"), false = Hide("ankylosaurus") ), Hide("stegosaurus_info"), Hide("stegosaurus_kill"), Hide("stegosaurus_feed"), Hide("stegosaurus_talk"), Hide("stegosaurus2"), If ( (stegosaurus == 1 or stegosaurus == 2), true = Show("stegosaurus"), false = Hide("stegosaurs") ), Hide("plateosaurus_info"), Hide("plateosaurus_kill"), Hide("plateosaurus_feed"), Hide("plateosaurus_talk"), Hide("plateosaurus2"), If ( (plateosaurus == 1 or plateosaurus == 2), true = Show("plateosaurus"), false = Hide("plateosaurus") ) ]
activate_sound "sounds/Select2.ogg"
screen velociraptor_info:
add If ( (velociraptor_stage == 1), true = ("ui/velociraptor1.png"), false = ("ui/nodinosaur.png") ) xalign 0.5 yalign 0.5
add If ( (velociraptor_stage == 2), true = ("ui/velociraptor2.png"), false = ("ui/nodinosaur.png") ) xalign 0.5 yalign 0.5
add If ( (velociraptor_stage == 3), true = ("ui/velociraptor3.png"), false = ("ui/nodinosaur.png") ) xalign 0.5 yalign 0.5
add If ( (velociraptor == 2), true = ("ui/dinosauregg.png"), false = ("ui/nodinosaur.png") ) xalign 0.5 yalign 0.5
text "[velociraptor_food]" outlines [ (absolute(0), "#000", absolute(0), absolute(0)) ] color "#4B372A" xalign 0.3386 yalign 0.371
text "[velociraptor_noise]" outlines [ (absolute(0), "#000", absolute(0), absolute(0)) ] color "#4B372A" xalign 0.464 yalign 0.928
text "[velociraptor_power]" outlines [ (absolute(0), "#000", absolute(0), absolute(0)) ] color "#4B372A" xalign 0.559 yalign 0.928
text "{font=fonts/augusta.ttf}[Velociraptor_name]{/font}" outlines [ (absolute(0), "#000", absolute(0), absolute(0)) ] color "#4B372A" xalign 0.5 yalign 0.85
screen velociraptor_kill:
vbox xalign 0.3285 yalign 0.7:
imagebutton:
idle "ui/kill.png"
hover "ui/kill_hover.png"
action [ SetVariable("velactive", 0), SetVariable("velociraptor", velociraptor - 2), SetVariable("meat", meat + 16), ui.callsinnewcontext("basement") ]
activate_sound "sounds/reset.ogg"
screen velociraptor_feed:
vbox xalign 0.3285 yalign 0.3:
imagebutton:
idle "ui/feed.png"
hover "ui/feed_hover.png"
action If ( (meat >= velociraptor_food), true= [ SetVariable("meat", meat - velociraptor_food), SetVariable("velociraptor_health", velociraptor_health + 10), ui.callsinnewcontext("basement") ], false = None )
activate_sound "sounds/Select3.ogg"
screen velociraptor_talk:
vbox xalign 0.3285 yalign 0.15:
imagebutton:
idle "ui/talk.png"
hover "ui/talk_hover.png"
action ui.callsinnewcontext("velociraptor_talk")
activate_sound "sounds/Select3.ogg"
screen velociraptor2:
vbox xalign 0.925 yalign 0.12:
imagebutton:
idle "ui/ui_velociraptor.png"
hover "ui/ui_velociraptor_hover.png"
action [ SetVariable("velactive", 0), Hide("velociraptor_info"), Hide("velociraptor_kill"), Hide("velociraptor_feed"), Hide("velociraptor_talk"), Hide("velociraptor2"), Show("velociraptor") ]
activate_sound "sounds/Select2.ogg"Code: Select all
$ meat = 20
$ fruit = 20
$ velactive = 0 #Used to tell the game whether or not a dinosaur is selected
$ velociraptor = 1
$ velociraptor_hatch = 0
$ velociraptor_health = 10
$ velociraptor_stage = 0
$ Velociraptor_name = "Velociraptor"I realize my code is probably very unnecesarily overcomplicated, though I hope something can be done with what's already here instead of having to rewrite most of it.
Any help is much appreciated! ♥ ❤ ♥ ❤ ♥ ❤ ♥ ❤ ♥ ❤ ♥ ❤ ♥ ❤ ♥ ❤ ♥ ❤ ♥ ❤
