ID:144577
 
Code:battle problem
mob
verb
Fight()
if(usr.fightin==1)
usr << "You are already in a fight"
else
usr.fightin=1
usr.monster = input("Choose a monster to fight.","Monsters",usr.class) in list("Muffin - Lv1","Cancel")
usr.com()




mob
proc
com()
if(usr.monster=="Muffin - Lv1")
usr.fightin=1
usr.monhp=10
usr.monstr=5
usr.mondef=2
usr.monagility=3
usr.monexp=5
usr.mongg=10
monname="Muffin"
usr << "You attack a wild muffin!"
usr.monsterone()
if(usr.monster=="Cancel")
usr.fightin=0
return
mob
proc
monsterone()
if(usr.won==1)
usr.won=0
return
else
usr.action = input("What type of action do you want to take?.","Battle",usr.action) in list("Attack","Defend","Run")
if(usr.action=="Attack")
usr.monsteronex()
if(usr.action== "Defend")
usr.monsteronez()
if(usr.action=="Run")
usr.monsterrun()
proc
monsteronex()
var/humandamage
humandamage=usr.strength-usr.mondef
if(humandamage<=0)
usr << "You missed!"
if(humandamage>0)
if(usr.won==1)
return
else
usr.monhp-=humandamage
usr << "You have attacked the [usr.monname] for [humandamage]"
sleep(4)
deathcheck()
usr.monsteronew()
proc
monsteronew()
var/npcdamage
npcdamage=usr.monstr-usr.defense
if(npcdamage<=0)
if(usr.won==1)
return
else
usr << "[usr.monname] missed!"
if(npcdamage>0)
if(usr.won==1)
return
else
usr.hp-=npcdamage
usr << "The [usr.monname] has attacked you for [npcdamage]"
sleep(4)
deathcheck()
usr.monsterone()
proc
monsteronez()
var/npcdamage
var/defendamount
usr.miss = rand(1,2)
defendamount=usr.defense + usr.strength
npcdamage=usr.monstr-defendamount
if(npcdamage<=0)
if(usr.miss==1)
usr << "[usr.monname] missed!"
usr.monsterone()
if(usr.miss==2)
usr.hp-=usr.monstr
usr << "Your defend fails!"
usr << "The [usr.monname] attacks you for [usr.monstr]"
sleep(15)
usr.monsterone()
else
usr << "Bugged; Please contact inutracy immediatly and she will solve this problem"

else
usr.hp-=npcdamage
usr << "The [usr.monname] attacks you for [npcdamage]"
usr << "You defended for [defendamount]"
sleep(15)
usr.monsterone()
proc
monsterrun()
usr.run = rand(1,3)
if(usr.agility<=usr.monagility)
usr << "The [usr.monname] has blocked your path!"
sleep(10)
usr.monsterone()
if(usr.agility>usr.monagility)
if(usr.run==1)
usr << "You successfully ran away from the [usr.monname]"
return
if(usr.run==2)
var/npcdamage
usr << "The [usr.monname] has blocked your path!"
sleep(6)
npcdamage=usr.monstr-usr.defense
usr.hp-=npcdamage
usr << "The [usr.monname] has attacked you for [npcdamage]"
sleep(10)
usr.monsterone()
if(usr.run==3)
var/npcdamage
usr << "The [usr.monname] has blocked your path!"
sleep(6)
npcdamage=usr.monstr-usr.defense
usr.hp-=npcdamage
usr << "The [usr.monname] has attacked you for [npcdamage]"
sleep(10)
usr.monsterone()
else
usr << "Bugged Run; Please report this form to an admin<br><hr>"
usr << "<font color=red>usr.run: [usr.run]<br>usr.agility: [usr.agility]<br>usr.monagility: [usr.monagility]<br><hr>"
else
usr << "Neither more or less! (Debug)"

mob
proc
deathcheck()
if(usr.hp<=0)
usr << "<font color=blue>You have been defeated by [usr.monname]</font>"
usr.fightin=0
usr.monhp=0
usr.monstr=0
usr.mondef=0
usr.monagility=0
usr.monexp=0
usr.mongg=0
monname=""
usr.hp=usr.maxhp
return
if(usr.monhp<=0)
usr << "You have killed the [usr.monname]"
usr << "<font color=blue>You recieve [usr.monexp] exp!</font>"
usr << "<font color=blue>You recieve [usr.mongg] gold!</font>"
usr.exp += usr.monexp
usr.gold += usr.mongg
usr.fightin=0
usr.monhp=0
usr.monstr=0
usr.mondef=0
usr.monagility=0
usr.monexp=0
usr.mongg=0
monname=""
usr.levelup()
else
return
proc
levelup()
if(usr.exp>=usr.expneed)
usr << "<h3> <font color=red>Level Up! </font></h3>"
usr.level+=1
usr.strength+=3
usr.defense+=4
usr.expneed+=20
usr.exp=0
usr.maxhp+=6
usr.agility+=3
else
return


Problem description:ok this is it, i fight this monster THE only monster called Muffin and this is what the battle is like:

You attack a wild muffin!
You have attacked the Muffin for 4
The Muffin has attacked you for 3
You have attacked the Muffin for 4
The Muffin has attacked you for 3
You have attacked the Muffin for 4
You have killed the Muffin
You recieve 5 exp!
You recieve 10 gold!
missed!

the problem is i cant explain why missed! is there, i edited the coding a little. i took usr.won=1 from the monster end of the deathcheck cause it was causing this: when you fight a monster and kill it yur win = 1 and if your win = 1 then you cant fight again you could chose a monster but you couldent fight it.

please help me,
add on: when i attack a monster, and it misses its attack on me, the battle is ended without no victory or defeate.

again id apreciate a little help on this one.
Based on what you told me in another thread, my first question has to be "where did this code come from?"
In response to IainPeregrine
i think its mud starter
In response to VolksBlade
VolksBlade wrote:
i think its mud starter

You think it's mud starter? How stupid are you?

Don't use code from some random demo you found, espessially not one that already has a bug like this in it. Learn it yourself. Read your way out of this.
In response to Android Data
reading the DM guide wont help me
In response to VolksBlade
Android Data wrote:
You think it's mud starter? How stupid are you?

We're here to help people learn. This means taking them from where they know nothing to where they know something. Insulting people does nothing but make us look like elitists. Because of this, your posts are counterproductive, causing people who were trying to learn to do things the right way (when they don't know what that is) to give up and do things the easy (and wrong) way. Everyone was a newbie at one point, and it's nothing to be ashamed of; being a troll is.

VolksBlade wrote:
i think its mud starter

As I told you in another thread, you really need to start from scratch. That's the only way you've ever understand what's going on in your program. When I started programming (not on BYOND), I spent about four months trying to modify other people's code that I found online. I learned nothing from this. It was only when I read through an entire tutorial, doing the example excercises too, that I made any progress.
In response to IainPeregrine
IainPeregrine wrote:
We're here to help people learn. This means taking them from where they know nothing to where they know something. Insulting people does nothing but make us look like elitists.

Er. I have no idea why I wrote that. Quote or something must be stuck in my mind. Hmm. It IS almost 1 am. Could explain it.
Well, sorry about that.
In response to VolksBlade
As it is now, I don't know what's causing the error. In order to understand the problem, I'd have to understand all of what that system is doing, and all of what that system should be doing. Learning all that would take me longer than just programming my own system, because I already know how to program. The only person who could take a quick loot at that and know what to do, is Inutracy (I'm guessing that's the person who authored this code; her name is in it.). Even then, she may not remember what this system is supposed to do, or how it works.

If you knew how to program then you could make your own system in about an hour, instead of wreastling with someone else's, and spending days. We're not trying to get you to read the guide just for the heck of it, we're trying to help you learn to program. We've just found that the best way to learn to program, is by reading the guide. I'd suggest you take the advice I gave you in this thread: ID:497808