ID:179531
 
obj/Vulnerability
var/Monster = usr.MON
icon = 'Digi.dmi'
icon_state = Monster

Monster.dm:46:error:usr.MON:undefined type
Monster.dm:46:error:= :expected a constant expression

I need the obj's Icon to be based on the users MON variable,
which is the users Vulnerability, so that i dont have to do this whole if thing(I`m lazy)

Pillsverry wrote:
obj/Vulnerability
var/Monster = usr.MON
icon = 'Digi.dmi'
icon_state = Monster

Monster.dm:46:error:usr.MON:undefined type
Monster.dm:46:error:= :expected a constant expression

I need the obj's Icon to be based on the users MON variable,
which is the users Vulnerability, so that i dont have to do this whole if thing(I`m lazy)

usr doesn't mean anything in this context.

What is it you are trying to do here? If you explain it in detail, we might be able to help.
In response to Deadron
I`m trying to to make it to where the objects icon is based on one of the users variables

like instead of:

if(usr.MON = Moth)
var/moth = image(/obj/moth , usr.loc)
usr << moth
if(usr.MON = Dog)
var/dog = image(/obj/dog , usr.loc)
usr << dog

var/vul = image(/obj/vul , usr.loc)
usr << vul

obj/vul
icon = 'Monster.dmi'
icon_state = usr.MON



but i want to get the object

i`m trying to find a way to do that easily without haveing to make new objects and stuff like that

I think i`m going to go ahead and do somthing like above if i cant get what i first posted to work
In response to Pillsverry
Pillsverry wrote:
I`m trying to to make it to where the objects icon is based on one of the users variables

Then after you create the object, set its icon to whatever the usr's variable indicates. Takes one line of code, in the same place where you create the object.
In response to Pillsverry
What you're still not getting, and which Deadron called your attention to quite plainly, is that usr means nothing in this context. Exactly who are you expecting the user to be here?

What the guys are saying, is that usr doesnt exist at the point in time that you compile your code. usr only comes into being once someone logs into your game. thats what
** Monster.dm:46:error:usr.MON:undefined type **
means. Usr is the player's mob. It is not the mob type.

the next error line;
** Monster.dm:46:error:= :expected a constant expression **
means that usr.MON has to be known at compile time in order for dream maker to use it. What the compiler is saying is that it doesnt know what to expect, and it has no way of dealing with this unknown.

I have an idea of what you are trying to achieve, and I think that it is a cool concept. Good luck to you.
In response to Ernie Dirt
Ernie Dirt wrote:
I have an idea of what you are trying to achieve, and I think that it is a cool concept. Good luck to you.

Good explanation, Ernie.

I already explained to him how to achieve it...we'll see if he reads closely enough.