ID:262433
 
Code:
        Bump(mob/M)
if(M.armor > 0)
if(M.team = usr.team)
usr << "Yeah, go ahead and shoot your friends. It doesn't do anything!"
else
var/damage = rand(damage1, damage2)
usr << "You shoot [M] for [damage] damage!"
oview() << "[own] shoots [M] for [damage] damage!"
M.armor -= damage
if(M.armor <= 0)
world << "[M] is destroyed by [own]!"
M.loc = null
var/again = input("You have died. Play Again?") in list("Yes","No")
if(again == "Yes")
M.Login()
else del src


Problem description:

Get 3 errors:


Warzone.dm:160:error:M.team:undefined var
Warzone.dm:160:error:usr.team:undefined var
Warzone.dm:160:error::missing expression


any thoughts?

--Vito

Okay, it's obvious what the errors are saying, first off, you don't have the team variable defined for either /mob or the /obj you're using, you need to define it for both.


        Bump(mob/M)
if(M.armor > 0)


                if(M.team = usr.team)


Your other problem
You're missing an equals sign here. ^

                    usr << "Yeah, go ahead and shoot your friends. It doesn't do anything!"
else
var/damage = rand(damage1, damage2)
usr << "You shoot [M] for [damage] damage!"
oview() << "[own] shoots [M] for [damage] damage!"
M.armor -= damage
if(M.armor <= 0)
world << "[M] is destroyed by [own]!"
M.loc = null
var/again = input("You have died. Play Again?") in list("Yes","No")
if(again == "Yes")
M.Login()
else del src
In response to Nadrew (#1)
Nadrew wrote:
Okay, it's obvious what the errors are saying, first off, you don't have the team variable defined for either /mob or the /obj you're using, you need to define it for both.

AHEM: I DID (for both) still have 2 errs.

Your other problem
You're missing an equals sign here.

Whoops.

--Vito
In response to Vito Stolidus (#2)
mob
var
team


obj
projectile
var
team
In response to Nadrew (#3)
Ya I kno, thats basically what I got, only its:

obj
missile
var
team


--Vito
In response to Vito Stolidus (#4)
I'm still getting errors here... is anyone going to serously help?

--Vito
In response to Vito Stolidus (#5)
You've been seriously helped various times. It's not our fault you're getting errors. You're obviously referencing the atoms in question WRONG or there wouldn't be an error. Is the Bump() under /obj/missile or /mob? Before you start getting offensive you should learn more about the basics of DM.
In response to Nadrew (#6)
under obj/missile. You really think I'm that stupid?

...sory for complaining. I have had two things that I have been asking on these forums for almost 2 weeks and they still have not had a realistic answer. I shouldn't complain, tho: about 4 other things have been fixed.

--Vito
In response to Vito Stolidus (#5)
        Bump(mob/M)
if(ismob(M))
if(M.armor > 0)
if(M.team == src.team)
M << "Friendly fire... No damage for you."
else
var/damage = rand(damage1, damage2)
M << "You are shot for [damage] damage!"
oview() << "[own] shoots [M] for [damage] damage!"
M.armor -= damage
if(M.armor <= 0)
world << "[M] is destroyed by [own]!"
M.loc = null
var/again = input("You have died. Play Again?") in list("Yes","No")
if(again == "Yes")
M.Login()
else del src


Try this.
In response to Vito Stolidus (#7)
The answers in all of your questions were the correct answer. You're the one that's not taking the answer in stride and assuming just because it doesn't work exactly how you asked that the advice was bad. The simple fact is, you're the one not doing it right, not us.
In response to XxDragonFlarexX (#8)
Warzone.dm:162:error:M.team:undefined var



Can you figure out why your code gives fifteen "inconsistent Indentation" errors and this one?

--Vito
In response to Vito Stolidus (#10)
BECAUSE DM HATES PEOPLE WHO COPY AND PASTE CODE!
In response to Nadrew (#9)
I've been trying EXACTLY what I'm told. I get more errors, or worse.

--Vito
In response to Vito Stolidus (#10)
If you copy and paste something from the forums, the indentation may be messed up sometimes. Reindent it so it works.
In response to Crashed (#11)
...Yeah. I fixed the copy/paste discrepancies, and was left with the error that called 'M.team' undefined.

--Vito
In response to Vito Stolidus (#14)
Do you have a
mob
var
team

in your programming?
In response to Vito Stolidus (#10)
Vito Stolidus wrote:
> Warzone.dm:162:error:M.team:undefined var
>



The fact that you're getting this means the 'M' in your code (/mob in this case) as no team variable defined. If you define M as mob/M team needs to be a toplevel mob variable:
mob
var
team


If you have it defined under a child type
mob
something
var
team


You'd need to define M as mob/something/M.
In response to Nadrew (#16)
Thanks. I'll check that

--Vito
In response to XxDragonFlarexX (#15)
As I said, I'll check that.

--Vito
In response to Vito Stolidus (#10)
many people have been telling you this several times but let me explain it:

we help out here on the forums to learn you something. If you just copie and paste it you wont learn anything, LEARN from the codes that we give out. on the forums everything is spaced, not tabbed. so thats a reason for not to copie and paste to. ( however you still can retab them)

but just go ahead, and blindly copie and paste the code and dont learn a thing.

if you really want to become a good programmer, learn from the code that is giving out in the forums.

[EDIT] Woops, replied to the wrong message.. sorry[/EDIT]
O-matic
Page: 1 2