ID:177542
 
I cant seem to make doors open and close by clicking. its hard. I have code and it looks like it'll work but it doesnt
obj/door
var
open=1
Click()
if(open==1)
(switch it to close ya know)
if(open==2)
(switch to open you know what i mean)

but it doesnt work

I also need a life bar. is there any demo that will help me go about making life bars and stuff like that?


For the doors, you're trying to have a variable be either 1 or 2. NEVER do that unless absolutely necessary. It makes so much more sense to have the variable be either 0 or 1. This is how I would do a door:
obj/door
icon = 'door.dmi'
icon_state = "closed"
density = 1 //it starts closed
Click()
if(density) //if it's closed, we want to open it
density = 0 //we can walk through open doors
icon_state = "open" //door.dmi should have open and closed states
else
density = 1
icon_state = "closed"

That should work fine. You don't even need to define an open variable. density alone will do the trick.

As for meters, my HUD demo will show you how. There are also a couple of other meter demos out there, so if mine doesn't work look for other ones.
In response to WizDragon
thanks
mob/verb
Attack(mob/M as mob in oview(1))
var/damage = rand(1,usr.attack)
M.hp -= damage
view() << "[usr] attacks [M] [damage] damage"
M.Death()
sleep(2)
i've got a question as to why when i use this attack verb when i use it on a enemy. i'll use my macros. and then when i kill the enemy sometimes it comes up with a error saying the enemy is already dead.
In response to Ace2064
What do you mean exactly by "dead"? What do you do in the Death proc? Do you delete the dead mob, or do you just change his icon state?
In response to WizDragon
I delete the mob. every 3 minutes there is a repop.
does anyone know the dragon ball ,ssj4,and sword codes and /or how to make it when you put your game on the hub to make it say run so other people can run there own game of mine
In response to WizDragon
WizDragon wrote:
For the doors, you're trying to have a variable be either 1 or 2. NEVER do that unless absolutely necessary. It makes so much more sense to have the variable be either 0 or 1. This is how I would do a door:
obj/door
> icon = 'door.dmi'
> icon_state = "closed"
> density = 1 //it starts closed
> Click()
> if(density) //if it's closed, we want to open it
> density = 0 //we can walk through open doors
> icon_state = "open" //door.dmi should have open and closed states
> else
> density = 1
> icon_state = "closed"

That should work fine. You don't even need to define an open variable. density alone will do the trick.

As for meters, my HUD demo will show you how. There are also a couple of other meter demos out there, so if mine doesn't work look for other ones.

Yes, i have a hud demo out as well.
http://www.byond.com/hub/RaeKwon/RaeKwonHudDemo

And, if you want to display text:
http://www.byond.com/hub/RaeKwon/RaeKwonTextDemo

Alatar
In response to Roberts SSJ Gogeta
Roberts SSJ Gogeta wrote:
does anyone know the dragon ball ,ssj4,and sword codes and /or how to make it when you put your game on the hub to make it say run so other people can run there own game of mine

Hey! Don't be replying to other peoples posts asking for code help! That is not acceptable!
Especially asking about Dragonball z stuff, and expecting so much.
<s>Robert that was intellegent</s>

Alatar