ID:174915
![]() Jul 7 2003, 8:02 am
|
|
I have some problem with infinate loops or something. Like I coded my own battle system, and every once in a while if the battle goes on too long, I get an infinate loop bug to appear in Dream Daemon. If anyone wants to try and help, please page me(Metroid) or email me at WindMetroid@hotmail.com. Thanks ahead of time.
|
![]() Jul 7 2003, 8:38 am
|
|
Build in a switch or use while
|
It would be nice if you could either do it for me or tell me how to do it. I'm not a super genius that knows how to do something even if ive never heard of it before.
|
Metroid wrote:
I have some problem with infinate loops or something. Like I coded my own battle system, and every once in a while if the battle goes on too long, I get an infinate loop bug to appear in Dream Daemon. If anyone wants to try and help, please page me(Metroid) or email me at WindMetroid@hotmail.com. Thanks ahead of time. You'll really need to post some of the code to your battle system before anyone can help you out with it. Lummox JR |
Where should I put this in my code? Here I'll show you one of my procs and tell me where to add that.:
Attack_Up(mob/M) Oh and btw, while I'm at it and showing this spell, can u tell me why it dont work, like it seems to skip the var and not add anything. Please help with that too, thanks |
Lemme explane
Lets say you have 4 differend procs that just run in a row untill someones HP is 0 or less. When the battle takes a long time you will get that infinate loop error. DOH You can do two things: -use a switch -use while You can make a switch to ask a player if he (for example) wants to keep attacking or wants to run. switch(input(M,"What do you want to do?","Combat") in list("Attack","Run")) You can also use while. While(M.hp > 0) If you use while then you wont have to loop cuz while keeps calling the code under it untill M.hp = 0 or less. Well figure the rest out your self. And if you can't find a answer to your problems then you sould not be making a battle system. |
Fint wrote:
And if you can't find a answer to your problems then you sould not be making a battle system. First of all, if I don't make a battle system myself I can't, 1) Learn and fix my mistakes and make a better one later, 2) Have it the ways I want a battle system. >switch(input(M,"What do you want to do?","Combat") in list("Attack","Run")) I have something like that, it goes like this: mob I don't see a problem with using an alert so don't pester me about it it does the same thing. And how do I use the while exactly? Like whats the spawn(20) about? (I'm sry if im acting like a newb im not completely acurate on some things still, either way, u didnt know at one time so help me out.) Like see i don't have a deathcheck like some people do i think, like after a player attacks, it checks NPCDeathcheck, here Ill show u my Death Checks: PlayerDeathCheck(mob/M) Please don't tell me to not do a new battle system or anything, just tell me what to do to fix the problem, I might be acting like a newb but you have to do something sometime to learn from your mistakes and inprove in coding. Just be a nice guy and help someone out please. |
Well, one thing you have to change right off is that you don't need two different DeathCheck() procs, and neither one is set up right. You pass M to PlayerDeathCheck(), but the only extra thing it needs to know is the killer. Instead you're using M and src in that proc interchangeably, where M should be the killer alone and src is the mob who may be dead.
And without keeping M and src straight, there's no hope of getting the rest taken care of. So you have to fix this other problem first. Lummox JR |