obj
hud
cweapon
name = "Current Weapon"
icon_state = usr.armr
screen_loc = "1,1"
At "cweapon", I'm wanting the icon_state to be the user's equipped weapon, but I'm not sure how to do this.
ANY help is appreciated.
~PAK~
ID:166570
![]() Jul 20 2006, 3:22 am
|
|
obj At "cweapon", I'm wanting the icon_state to be the user's equipped weapon, but I'm not sure how to do this. ANY help is appreciated. ~PAK~ |
![]() Jul 20 2006, 3:54 am
|
|
You can't define the icon_state variable like that. What you should do is change it when you place it on the players screen and/or whenever he switches weapons.
|
Umm, I hope you know that icon_state will just use the name as the state in that particular icon file
... which is useless as I don't see the icon defined One way you can do it is: icon = usr.armr or icon=usr.armr.icon [forgot if this works] (Assuming that usr.armr holds the object itself and not the name or such) - GhostAnime EDIT: And listen to what super said, you should. prob. make a special proc that updates the screen whenver the weapon changes |
obj Take a look at line 5. The compiler will not let you do this, and will return an error like 'Expected a constant expression'. This means when you set a variable of any sort at compile time it can't be a reference. What you can do is throw in something with your Equip() verb or whatever you use when you equip stuff to do this: for(var/obj/hud/cweapon/X in usr.client.screen) Like they said, best to do something that updates your screen, and that's how you'd do it. Hope that helps ~ AJ |
You mean
X.icon_state="[usr.armr]" obj/OMZ/HUZD - GhostAnime |
Sorry for bringing such an old post back... but I'm having the same problem, and I didn't want to just make a new one because I just got distracted from this one >.>
mob/proc/hudupdate() That's what I have going right now, but it's not working. I'm not getting any compile errors, nor any errors in-game, besides the fact that it's not working, the weapon doesn't show up. What am I doing wrong? |
mob It works for me so I think it will work for you |
mob I havnt tested it but that should work I thinkish :/. - Dark Emrald |
sys.dm:139:error:if:undefined proc
sys.dm:138:error:src.meleewep:undefined type mob/proc/hudupdate() |
When you get an undefined proc message about if(), you have an indentation error. Hit Ctrl+T to see your tabs and spaces.
Lummox JR |