My Var declare
obj
var/state
My code that works for the torches
obj/Light
icon = 'Light.dmi'
Torch
icon_state = "Torch_On"
luminosity = 3
state = 1
verb
Toggle()
set src in oview(1)
set category = "Object"
if(state == 1)
luminosity = 0
icon_state = "Torch_Off"
state = 2
else
icon_state = "Torch_On"
luminosity = 3
state = 1
This code works correctly.
Now my other Var declare
mob
var/state
And the code that works only halfway
mob/verb
// *****Chat Verbs*****
say(msg as text)
set src = usr
set category = "Chat"
view() << "[usr.name] says, [msg]"
OOC(msg as text)
set src = usr
set category = "Chat"
world << "[key]: [msg]"
// *****Emote Verbs*****
smile()
set src = usr
set category = "Emotes"
view() << "[usr.name] smiles."
// *****Special Verbs*****
ghost()
if(key != "Penguinsandwich")
set hidden = 1
state = 0
else
set hidden = 0
set category = "Special"
state = 1
if(state == 1)
density = 0
state = 2
else
density = 1
state = 1
Everything works correctly as far as I can tell up until the second if statement gets processed. Once it does, my density = 0 and the function stops. It doesn't process the last else statement to reverse the density back to = 1
What exactly am I doing wrong here?
I was supposed to mimic how the parent file of those properties, like torch, had the variable set to 1 already
I ended up just changing
mob
var/state = 1
and it worked.