ID:144739
 
Code:
This is my code for the HUD button which should Hide the usr behind the object
var/obj/hud/Hide/A = new() //Defines the HUD
obj/hud/Hide
icon='Hide.dmi'
screen_loc="1,1"
New()
usr.client.screen+=src
Click()
for(var/obj/hud/Hide/O in oview(1))
if(usr.loc==O.loc)
usr.loc=locate(O.x,O.y+1,O.z)
else
usr.loc=O.loc


This is how it is defined under the object
Cloud1
icon = 'Cloud.dmi'
icon_state="1"
layer=6
density=1
verb
Hide()
set src in oview(1)
if(usr.it)
return
else if(usr.frozen)
return
else
usr.loc=locate(src.x,src.y,src.z)
Shake()
set src in oview(1)
if(usr.it)
src.icon_state="Shake2"
spawn(10)
src.icon_state="2"
var/mob/m = locate(/mob) in src.loc
if(m)
m.loc = locate(src.x,src.y-1,src.z)
else
return
else
return

Problem description: sorry for having so many questions on here but I've tried everything I can do to get this to work but to no avail. Any Ideas?

How exactly is this not working? What's happening with this code that isn't behaving as you would like?

Lummox JR
In response to Lummox JR
when I click the button it does absolutely nothing, it should hide the usr behind a hideable object that he/she is next to
In response to KirbyAllStar
What is the full type path of the Cloud1?

If it isn't "/obj/hud/Hide", than that's the problem.. because in the HUD Click() code, you are searching for that certain path

for(var/obj/hud/Hide/O in oview(1))


If Cloud1 was under /obj/Hide, the HUD for() (the one above) would ignore it...

Solution: Change your for() path

- GhostAnime
In response to GhostAnime
ok I kind of understand that but there are many different hideable objects how would I make it to where it could work with them all.

obj
cloud1

thats the path do I need to put all the hideable ones under
obj
Hide
cloud1
something like that?
In response to KirbyAllStar
Yes, that is one way.. actually, that would be a preferable way to do it, group all hidable objects under one path (/obj/Hide in this case).


Another method, which I recommand the first one over this, is checking if the object had the verb Hide... but like I said, I prefer the first one as this would cause a lot of hassel

Edit: And it would be easier for your too, as you can have one or so general verb for all those objects:
obj/something
verb/Yay() world<<"Yay"
verb/Meh() world<<"Meh"
si1
sk3
sl2
verb/Boo() world<<"Boo"

In the above example, everything under /obj/something (si1, sk3 and sl2) WILL have the verb Yay and Meh... but only sl2 will have an additional verb, Boo

Edit 2: If you have a screen sizing option, I recommand that you change the way you do screen_loc (though 1,1 would be okay anyways) to something like "SOUTH,WEST"

Lets say you want a certain HUD background extending at the bottom, you would have this line in that background code: "SOUTH,WEST to SOUTH,EAST"

and lets say we want something 1 tile before the screen's X ends.. than you would want to put "SOUTH,EAST-1"..

- GhostAnime
In response to GhostAnime
Thank you very much, this helped a lot I've got it working now. I've been trying to get this to work since I began Freeze Tag HideAway and now it works. Thanks Again

Now I have troubles with this

obj/hud/Shake
icon='Shake.dmi'
screen_loc="2,1"
layer=7
Click()
for(var/obj/Hide)
set src in oview(1)
if(usr.it)
src.icon_state="Shake1"
spawn(10)
src.icon_state="1"
var/mob/m = locate(/mob) in src.loc
if(m)
m.loc = locate(src.x,src.y-1,src.z)
else
return


It shows up on the screen but Will not shake the shakeable obj. all the shakeable obj's are under the obj/Hide path, and it should let the IT usr shake the object he/she is next to. Any way to fix this
In response to KirbyAllStar
lol the last one I made was fully working you juss changed somthing
obj/hud/Shake
icon='Shake.dmi'
layer=22
New()
src.screen_loc="2,1"
usr.client.screen+=src
Click()
for(var/obj/Hide/H in oview(1))
if(usr.it)
H.icon_state="Shake1"
spawn(10)
H.icon_state="1"
var/mob/m = locate(/mob) in H.loc
if(m)
m.loc = locate(H.x,H.y-1,H.z)
else
return


Ok am not sure but this should ba able to work ~~
and remember when a person has choose's there character make sure you put.
usr.client.screen += new/obj/hud/Hide
,
But if you juss want this for the person whos it than place this whereever you put the thing that makes the person it ~~.