ID:266570
![]() Apr 11 2002, 4:11 pm
|
|
Ok i want it to increase something (var) and it be use contoled
|
![]() Apr 11 2002, 5:01 pm
|
|
Say that again?
|
I think I know what he's saying. I was thinking along the same lines myself recently, but I kind of put the thought aside until I could work out some of the more critical gameplay.
Say, for example, you wanted your characters to heal over time when they're not in battle. So every 10 seconds, maybe, you'd recover...I don't know, a tenth of you maximum total HP. Is there any way to do that? I suppose there's nothing stopping you from running a procedure at or shortly after login to run a while loop that continuously runs the whole time you're playing. Seems to me like it would require a lot of wasted processing time, though, which is why I half-abandoned the notion. But why not, I suppose? If that's what you really wanted. I'm not sure what you mean by use controlled. Perhaps that such continued increase only occurred when activated by the user in some way? |
TheWatcherUatu wrote:
I think I know what he's saying. I was thinking along the same lines myself recently, but I kind of put the thought aside until I could work out some of the more critical gameplay. The simplest way to slowly increase a var needn't take a lot of processing time at all: mob Lummox JR |
Yeah, that's what I was getting at, only I wasn't thinking about using the spawn function. My function would have been something like:
mob var HP = 80 max_HP = 100 proc Healloop() var/healamount var/newhealth while ((!dead) && (!warmode)) healamount = max_HP/10 if (HP < max_HP) newhealth = HP + healamount if(newhealth > max_HP) HP = max_HP else HP = newhealth sleep(100) I'm not as intimately familiar with the spawn procedure as I'd like to be. Is there some advantage to using that rather than an actual while loop with a sleep at the end? Or is it the same thing? |
TheWatcherUatu wrote:
I'm not as intimately familiar with the spawn procedure as I'd like to be. Is there some advantage to using that rather than an actual while loop with a sleep at the end? Or is it the same thing? I'm not sure there's an advantage either way; spawning could be useful in that it's an independent event, not driven by another proc. Using sleep() will make your code wait in a suspended status, though, so that won't eat up CPU cycles any more than spawn() will. Lummox JR |