Two questions....
1.How do I make it run a proc(in this case "SenzuWait()") whenever the game starts up?
2.Ho do I make the players screen go black whenever hes KO(I already have a working KO proc(see below)
My SenzuWait() and associated procs:
proc/SenzuWait()
sleep(1200)
SenzuRefresh()
SenzuWait()
proc/SenzuRefresh()
for(var/mob/Shopkeepers/S in world)
S.ShopSenzu += 1
My KO() proc incase needed:
mob/proc/KO()
if(src.PL <= 0||src.Stam <= 0)
src.KO = 1
view(9) << "[src] is KO!!"
src << "You lose conciousness!!"
sleep(rand(250,900))
src.KO = 0
src.PL = 1
src.Stam = 50
src.MaxPL += src.MaxPL/1500
src << "You regain conciousness"
oview(9) << "[src] regains consiousness!"
ID:261755
Apr 10 2003, 1:49 am
|
|
In response to Maz
|
|
World
New() SenzuWait() DOES NOT WORK! Ive tried it. The client.eye does,thank you! |
In response to SSj2-Mystic
|
|
This could be due to the way it loops into itself, try adding a spawn() in there
|
In response to SSj2-Mystic
|
|
Don't forget to put a ..() in there.
World New() ..() SenzuWait() |
In response to Maz
|
|
Maz wrote:
and you should probably just move there client.eye to somewhere thats black, this will leave the mob still as it is and set the screen to black, then just set the eye back to your mob. Alternately, you could flag the mob's sight var to BLIND. |
SSj2-Mystic wrote:
proc/SenzuWait() It is absolutely imperative that you change the last line to spawn() SenzuWait(). Otherwise your stack will eventually overflow and crash. When a proc calls itself, it's called recursion, and basically the old copy still keeps running while it waits for the new one to finish. Eventually you end up with a whole ton of SenzuWait() procs that are waiting for some other SenzuWait() to get finished. It takes memory to keep track of all of those. By using spawn(), you basically separate the new SenzuWait() call from the currently running proc, so it won't cause that kind of stack overflow. Alternatively you can run a different sort of loop. proc/SenzuWait() mob/proc/KO() Not bad. You should change view(9) to view(9,src), and do a similar change to oview(). Both of those procs take usr as a default point of reference, and usr isn't safe in procs (unlike in verbs). Lummox JR |
In response to Lummox JR
|
|
ok,right now i have it set up as
world New() ..() SenzuWait() and SenzuWait() as proc/SenzuWait() spawn(600) while(1) SenzuRefresh() sleep(1200) But it STILL wont run! I tried running SenzuRefresh right off of World/New(),but that dosent work either. I think my world/New() is screwed. |
In response to SSj2-Mystic
|
|
make sure that you have "..()" everyplace you have world/New() in your code.
|
In response to Nick231
|
|
Nick231 wrote:
make sure that you have "..()" everyplace you have world/New() in your code. He did that. Helps to actually look at his code. Lummox JR |
In response to Lummox JR
|
|
Lummox JR wrote:
Nick231 wrote: But it STILL wont run! I tried running SenzuRefresh right off of World/New(),but that dosent work either. I think my world/New() is screwed. Yes, but if he has world/New() somewhere else in which he does not have ..() it wont keep going on, possibly causing the proc to not start... (I did the same thing not too long ago so I figured I would just suggest it...) |
In response to Nick231
|
|
Nick231 wrote:
Yes, but if he has world/New() somewhere else in which he does not have ..() it wont keep going on, possibly causing the proc to not start... (I did the same thing not too long ago so I figured I would just suggest it...) You said he needed ..() in world/New(), which he had. As for being in something else that runs in world/New() it might be a valid point for other code, but there's nothing in his world/New() that applies. The only other proc he called was SenzuWait(), which doesn't need a ..() call because it's not an override--and it spawns properly, so it's not holding anything up. Lummox JR |
and you should probably just move there client.eye to somewhere thats black, this will leave the mob still as it is and set the screen to black, then just set the eye back to your mob.