Player.dm:29:error:top.icon:left-hand side must be an object variable
That is the error im recieving, here is the coding:
obj/head
density = 0 //we can walk through the head.. we're looking at a diablo-style layout here
layer = 5 //the head will appear above everything else
mob
var
obj/head/top //top (head) of the mob
movetimer // used to limit how quickly the player walks
Move(loc)
if(world.time < movetimer) return
movetimer += 5 //short for movetimer = movetimer + 5
..() //carry on regularly
var/turf/T = locate(src.x,src.y + 1,src.z) //store the turf above the mob as a var
if(T) //if the turf exists
top.loc = T //then make the moving mob’s top’s loc the turf above it.
else //if the turf doesn’t exist
top.loc = null //don’t make the moving mob’s top’s loc anything
mob
New()
..() //do the regular New() behavior
top = new() //make the new top
mob
Fighter
top.icon = 'fighter.dmi'
icon_state = "head"
icon = 'fighter.dmi'
icon_state = "body"
How can I solve this error???
ID:176034
Feb 20 2003, 8:30 am
|
|
In response to tenkuu
|
|
Ok this is how my coding is looking now:
obj/head density = 0 //we can walk through the head.. we're looking at a diablo-style layout here layer = 5 //the head will appear above everything else icon = 'fighter.dmi' //Here we go. This will work. mob var obj/head/top //top (head) of the mob movetimer // used to limit how quickly the player walks Move(loc) if(world.time < movetimer) return movetimer += 5 //short for movetimer = movetimer + 5 ..() //carry on regularly var/turf/T = locate(src.x,src.y + 1,src.z) //store the turf above the mob as a var if(T) //if the turf exists top.loc = T //then make the moving mob’s top’s loc the turf above it. else //if the turf doesn’t exist top.loc = null //don’t make the moving mob’s top’s loc anything mob New() ..() //do the regular New() behavior top = new() //make the new top top.icon = 'fighter.dmi' //Perfectly legal. This could also be changed based on input from someone as well. mob Fighter top.icon = 'fighter.dmi' icon_state = "head" icon = 'fighter.dmi' icon_state = "body" But Im gettin a different error (Player.dm:30:error:top.icon:left-hand side must be an object variable)... why is it happening? |
In response to Rii
|
|
Hold on one minute here. Try to get out of the habit of just pasting in some code to your game. I provide serveral ways to tackle the problem and you added both, but neglected to take out the problem stuff. Though, I suppose I could have been a little clearer.
Your definition for fighter mob should look like this. The top.icon = ... part should have been removed: mob And for New() for your mobs you can take out the top.icon line because you have it declared in in your obj/head definition. So the following is how that should look. mob |
In response to tenkuu
|
|
Thanks for the tips =) Ill be more careful in the future, as for the help, thanks again.
|
In response to Rii
|
|
Ive sorted out the coding problems and it works fine, now Ive tried my hands at making the character change into the 2 tile tall/2 tile wide player but when I enter the castle it just shows up as the legs. How can I get the head to appear?
|
In response to Rii
|
|
Look up pixel_y and pixel_x pixel offsets are MUCH easier to handle and use. If you need an example...just say so.
|
In response to Goku72
|
|
Ok Ive looked up the pixel_x and pixel_y but I still dont understand, please give me an example.
|
top.icon is meaningless the way you have it above. Everything in object definitions must be constant. However, you have your obj/head definition where you can set the icon properly:
Alternatively, you could set top.icon in New() for your mobs.