ID:263581
 
Code:
mob/fidchelltrans
verb
Transform()
set category = "Transform"
set name = "Fidchell Form"
usr.Fidchell_Trans()
Revert()
set category = "Transform"
set name = "Fidchell Revert"
usr.Fidchell_revert()



mob
proc
Fidchell_Trans()
if(!src.fidchell)
if(src.MP >= 50)
src.fidchell=1

src.underlays+= icon('Fidchell.dmi',"Fidchell")

src.tempstr = src.Strmax
src.tempdef = src.Def
src.tempmdef = src.MDef
src.formstatus="Innis Form"
view(src) << "<I><font color = yellow>[src]: Fidchell!</I></font color = yellow>"

src.Strmax += 20
src.Strmin = src.Strmax - 2
src.Def += 10
src.MDef+=5
src.inavatar=1
if(src.MP >= 0)
while(src.inavatar)
if(src.MP > 0)
src.MP -= 2
sleep(10)
if(src.MP < 0)
src.MP = 0
src.Fidchell_revert()


Problem description:
well this code never had been a problem until now. Now everytime i run the verb, the server freezes, i dont kno why, i think its a loop problem or something

Are you changing the mob's inavatar var to null somewhere in Fidchell_revert()?

The only thing I can think of is that since you only sleep for a second if the mob has MP, if they didn't have MP and used it, but didn't eventually break it, it would just keep running without delay and lock things up.

If it's not that, then the problem may exist elsewhere. Cause everything else looks alright on a quick skimming over.


By the way, are you making a game based off .hack? That is awesome in so many ways. I'm a major .hack fan.


In response to Zagreus
when you transform the inavatar var goes to 1, when you revert its 0

so i just add break under the revert proc?

and yes im making a .hack game, well i already made it, its called The World R:2 its rank 142, and 61 in Anime Guild
In response to Max Omega
Does the game freeze immediately when you run that verb, or only after you run out of MP?

I'm still thinking it's a problem with Fidchell_revert() not causing the while to break, but without seeing it it's kinda hard to tell.

Just for kicks, try replacing your loop with this and see if it still happens.

while(src.inavatar)
if(src.MP > 0)
src.MP -= 2
sleep(10)
if(src.MP < 0)
src.MP = 0
break
src.Fidchell_revert()

In response to Zagreus
well this code works all the time, but until today when i recieve a call from my co-owner, i went over to his house to see that when i use an avatar, that the server freezes. i dont kno why. but i havnt really tried leting the sp run out.
In response to Max Omega
Max Omega wrote:
and yes im making a .hack game, well i already made it, its called The World R:2 its rank 142, and 61 in Anime Guild

Ahh cool, grats on that. 61 in BYOND Anime must be pretty good considering the mass amount of games they must have. I might have to check it out sometime. :) (I did actually try a couple times, but it seems it's never being hosted or is hosted by someone who doesn't want me to connect.)
In response to Zagreus
Zagreus wrote:
Max Omega wrote:(I did actually try a couple times, but it seems it's never being hosted or is hosted by someone who doesn't want me to connect.)

there are 2 .hack games, The World V2 and my The World R:2, loveless's and my game are similar in icons, because we had the same iconner V2 never gets hosted.