proc
timer()
new /obj/Egg
spawn(300)
timer()
There's my proc but i was wondering how i can make it so that the Egg object is created next to a particular mob. thx
- Sam
ID:178651
Apr 21 2002, 3:10 am (Edited on Apr 21 2002, 3:35 am)
|
|
In response to Exadv1
|
|
I dont get it? what code do i put under and is Egg() a verb or proc? sorry for the misunderstanding
|
In response to Exadv1
|
|
Exadv1 wrote:
That is not good code. use while(1) instead I'm curious why you think it is a bad practice to make self spawning procs. As long as he uses spawn (and not sleep) to delay the call, there will be no trouble. |
If you have a reference to the mob, you can use get_step to find a space next to the mob (probably behind it?).
var/turf/T = get_step(my_mob,turn(my_mob.dir,180)) The turn proc is used here to find the direction behind my_mob. http://www.byond.com/docs/ref/info.html#/proc/get_step http://www.byond.com/docs/ref/info.html#/proc/turn |
In response to Shadowdarke
|
|
thx!!!
|
In response to Shadowdarke
|
|
I still dont seem to get it does that make him turn 180 degrees but how does that work in tandem with the spawning of the Egg?
|
In response to Akarat
|
|
No, that tells you the turf behind my_mob. Just create the egg in that turf:
new/obj/egg(T) |
In response to Shadowdarke
|
|
how can i refer to the mob if it uses icon state? i can't just right "mob"
this is what ive got var/turf/T = get_step(???,turn(???.dir,180)) proc Egg() new /obj/Egg(T) spawn(300) Egg() thx ne help is appreciated - Sam |
In response to Akarat
|
|
Akarat wrote:
how can i refer to the mob if it uses icon state? i can't just right "mob" You said it should be a specific mob. You have to have a reference to that mob. If it is a mob that is unique in the world, you can use locate() to find it. proc Egg() var/mob/chicken/C = locate() // will locate a mob/chicken in the world var/turf/T = get_step(C,turn(C.dir,180)) new /obj/Egg(T) spawn(300) Egg() |
In response to Shadowdarke
|
|
proc
Egg() var/mob/Black/B = locate() var/turf/T = get_step(B,turn(B.dir,180)) new /obj/Egg(T) spawn(300) Egg() is that right?? cuz i got loading Antz.dme Antz.dm:68:error:B:undefined type: B Antz.dm:68:error:B.dir:undefined type: B.dir Antz.dm:67:B :warning: variable defined but not used |
In response to Akarat
|
|
that's right, but it looks like the type path is wrong. Are you sure it isn't /mob/ant/Black or something like that?
|
Egg()
while(1)
//code here
Look up get_step