ID:149272
Jun 6 2002, 5:44 am
|
|
OK, When I die, the battle proc doesnt stop. How can I fix this?
|
In response to Lummox JR
|
|
What!?
|
In response to SuperStorm
|
|
He is kinda trying to tell you that we can't do anything without the code
|
In response to SuperStorm
|
|
He's asking you to show some code, and wow; his code could actually help you!
|
In response to Nadrew
|
|
Well, Lummox, Instant Messenge me on AIM if you have it. Im SuperStorm2k3
|
In response to SuperStorm
|
|
I doubt Lummox would do that, from what I've seen he doesn't like putting up with annoying newbies such as yourself.
|
In response to SuperStorm
|
|
SuperStorm wrote:
Well, Lummox, Instant Messenge me on AIM if you have it. Im SuperStorm2k3 Why should I contact you via AIM when it's easier for you to just post the code here and have multiple people take a look at it? In my experience, helping someone through a major code problem in real-time takes about 5 times as long anyway. Lummox JR |
In response to Nadrew
|
|
You cant talk about anyone being a newbie, because at a time, you were a n00b too. And im not a newbie, im posting this for a friend
|
In response to SuperStorm
|
|
SuperStorm wrote:
You cant talk about anyone being a newbie, because at a time, you were a n00b too. True, and I was an annoying newbie, too. For a whole two weeks I annoyed the oldbies until I finally started doing things on my own. And im not a newbie, im posting this for a friend Then you'd be able to do it for him, yourself. |
In response to Lummox JR
|
|
mob
Imp icon = 'bed1.dmi' HP = 15 MaxHP = 15 Strength = 3 Exp = 80 Gold = 5 Bumped(O) usr.islocked=1 Battle() Dario icon = 'dario.dmi' HP = 500 MaxHP = 500 Strength = 25 Exp = 1000 Bumped(O) usr<<sound('FFMQVolcano.mid',1) usr.islocked=1 Battle() mob proc Attack() var/Damage=usr.Strength src.HP-=Damage usr<<"You attacked the [src] for [Damage] damage." Death() sleep(10) monsterattack() proc monsterattack() var/Damage=src.Strength if(src.Strength<=0) usr<<"The [src] hit you for zero." sleep(10) else usr.HP-=Damage usr<<"The [src] hit you for [Damage] damage." if (usr.HP<=0) usr.loc=locate(2,2,1) usr.HP=usr.MaxHP usr.MP=usr.MaxMP usr<<sound('FFMQFireburg3.mid',1) usr.islocked=0 if (usr.HP==0) ..() DeathCheck() sleep(10) Battle() proc Run() alert("You tried to run and did!") Battle() proc Battle() if(usr.dead==0) sleep(10) switch(input("What would you like to do.")in list("Attack","Run")) if("Attack") Attack() if("Run") Run() if(usr.dead==1) usr<<"You have died in battle" proc Death() if(src.HP<=0) usr.Exp+=src.Exp usr.Gold+=src.Gold Levelup() usr.islocked=0 del src src.dead=1 sleep(30) src.dead=0 Bumped(O) Bump(O) ..() if(ismob(O)) O:Bumped(src) mob/var/islocked = 0 mob.Move() if(src.islocked) return 0 else return ..() |
In response to SuperStorm
|
|
In the IMP code where did you define "O"
|
In response to Strange Kidd
|
|
Thats not the problem. The problem is when you die, it keeps asking if you wanna attack or run. We want it so it stops. just want to know how to end a proc so that it wont continue with the Battle proc
|
In response to SuperStorm
|
|
You've got a few major (but subtle) problems in your code here that really need cleaning up, plus some style issues that I could foresee biting you in the butt later.
The biggest problem: Your battle procs are littered with usr. This only makes sense if you initiate battle via a verb, but after that you can't guarantee usr will remain the same. What you need to do here is to set up vars indicating who's involved in the battle. Bumped(O) Here's the first heinous use of usr. This is used in verbs, remember, not movement. usr will be set to Dario when he moves, it's true, if the player moves him; but you can't and shouldn't rely on that. The imp, if it bumps Dario, won't do so via using a verb, so usr will be the last player who did anything. You're ignoring O, presumably the atom that bumps into either Dario or the imp--O is the aggressor in battle. Your Battle() proc needs to be told who the player is, and who the monster is. It should be called like this: Battle(player,monster) Now, onto the other procs: mob/proc This is all messed up. Where to begin? Let's start with the simple stuff. The "if(usr.HP==0) ..()" block in monsterattack() makes no sense at all because monsterattack() isn't inherited from anything. Lose this. Look at all the calls to Battle(). Run() calls Battle()--why, if the battle's over? monsterattack() calls Battle(), but is itself called by Battle(), so you get a big nested set of procs--it should, at worst, use spawn() to call Battle(). Okay, now again we're stuck with the problem of usr being littered everywhere. If the Attack() and monsterattack() procs both belong to the monster, then it needs to know who the player is. proc/Attack(mob/M) The monsterattack() proc is similarly messed up, but worse. Rather than try to fix this, I have a better solution: Make a proc that simply registers an attack and checks for death, and another one that offers the choice of actions; then your battle code can be extended to player vs. player battles easily. mob/proc Notice how much shorter this whole thing is? To initiate the battle, call player.StartBattle(monster) (or vice-versa, if the monster gets to hit first). This is a radical change to your code, but the code you're using doesn't really work, would need a lot of fix-ups to get working, and still wouldn't be expandable later on. Lummox JR |
In response to Nadrew
|
|
Nadrew wrote:
I doubt Lummox would do that, from what I've seen it doesn't like putting up with annoying newbies such as yourself. Lummox...who knew? Alathon\\ |
In response to Alathon
|
|
Alathon wrote:
Nadrew wrote: Whoops! Damned two-track mind, fixed now =P. |
Ah, I see the problem.
Your error is on line 242:
Lummox JR