I have a battle system, for boss battle 1, where after every round it does this:
DragonDeath()
usr:DeathCheck()
goto War
Ok even after the battle is over it still goes to war!
How do I stop the loop?
ID:149649
Mar 18 2002, 9:37 pm
|
|
FireEmblem wrote:
I have a battle system, for boss battle 1, where after every round it does this: This is one of those 98% of situations where you should never use goto. This should be a while loop: while(still_fighting) Lummox JR |
In response to Skysaw
|
|
Ok,
mob var RDFEHp = 90 Dodge = 0 Red_Dragon_First_Encounter icon = 'Red Dragon.dmi' verb Talk() set src in oview(1) alert("Who are you??") alert("I'm [usr]!") alert("And What do you want?") alert("To conquer you!") alert("Ahahahahaaa!!") alert("You think you can beat me??") alert("Well?") War switch(input("Pick a command!")in list("Attack","Torch","Dodge")) if("Attack") var/damage = rand(1,10) usr.RDFEHp -= damage alert("YAHH!") damage = rand(1,10) usr.Health -= damage FirstEncounter() usr:DeathCheck() goto War if("Torch") var/damage = rand(3,10) usr.RDFEHp -= damage alert("YAHH!") damage = rand(1,10) usr.Health -= damage FirstEncounter() usr:DeathCheck() goto War if("Dodge") usr.Dodge = rand(1,2) alert("You jump and kick the Red Dragon!") usr.RDFEHp -= 3 alert("YAHH!") if(usr.Dodge == 1) alert("You evade the attack!") goto War else var/damage = rand(1,10) usr.Health -= damage FirstEncounter() usr:DeathCheck() goto War |
In response to FireEmblem
|
|
Yep, you shouldn't have used goto there. A simple while() loop will do the trick:
while(still in battle) Put the whole switch() block right under that loop. All the gotos should go. Lummox JR |
Show us a little more code. Impossible to tell from that.