verb
Hide()
set src in oview(1)
if(usr.it)
return
else if(usr.frozen)
return
else if(Notplayer==0)
return
else
usr.loc=locate(src.x,src.y,src.z)
usr.layer=4
Shake()
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
This code is put under each object that I want the verbs to work with. The problem is that if two Hideable/Shakeable items are next to the user it forces them to pick from a list with all the Hideable/Shakeable Items. Is there any way for them to only shake or hide in an item if it is in front of them?
ID:166816
Jun 11 2006, 6:08 pm
|
|
Jun 11 2006, 8:29 pm
|
|
Yep! I made this code string myself after long long experimentation, nobody would tell me how to do it either, but here it is, a lot of hard work... First time its been used outside of my game.
|
In response to Dragonn
|
|
Sorry, that pasted wrong and It wont let me edit it, so here it is the right way.
mob/verb/Whatever() |
if(get_dist(src,usr) <= 1&&get_dir(usr,src)==usr.dir)
This will evaluate to TRUE if the object is one tile directly in front of the player. |
Nadrew, I put your idea in the game but it caused it to do the same thing, it still makes a list if the object is next to your character at all including diagnols which is what im trying to get rid of.
Dragon, I tried yours but it had quite a lot of erros, saying that the M.x and other things similar to it were invalid. Sorry, but I either can't or don't know how to put it into my game. Sorry This is in wrong place |
In response to KirbyAllStar
|
|
I think they all just misunderstood your question.
The answer is quite simple, there is a build-in proc for checking things that are in front of your character. I suggest you read up on it. |
Here is a little snippet of code from one of my games:
client What this code does, is check for any mob that is in front of the character that presses the center button, and calls the Talked proc with the mob that is in front of you. The line that pertains to you is the for() line. Be sure to change usr to src if it is necessary (which doesn't mean test to see if usr works first, it means unless it is in one of the few exception that using usr is acceptable, change it.) The built-in proc that was mentioned is get_step by the way, if you never figured that out yet. ; ) Good luck. §atans§pawn |