I want to create a verb that cheacks my players density and if it is 1 changes the players icon state to a bat and sets their density at 0 , if the players density is 0 ie they are already in bat form it reverts them to their original icon and sets density back to 1.
I have got the verb sorted to check density and convert to bat and i can get it to check the players density and set it back to 1 but how do I get it to restore the original player icon? I assume i need to get it to store it somehow and then revert back?
ID:162400
Jan 13 2008, 6:45 am
|
|
Well something like this should work:
mob Not sure if the mob/M is even needed. If not, use src. |
In response to Kaioken
|
|
I have tried what you suggested but it doesn't work, my icon stays as a bat. I have put the code below so that maybe you can see where I am going wrong
Transform_to_Bat() |
In response to DisturbedSixx
|
|
I don't think this will work because in my game you can choose a number of characteristics at login that then determine you icon state so each player will have a different icon state. I need something that will store an indiviual players state and then restore it.
|
In response to Sorcha
|
|
Well you'd have to use a bunch of if statements to get the right icon_state back.
|
In response to Sorcha
|
|
That's almost correct, however, the old_icon variable has to be declared as /mob/var, or it isn't saved between separate calls of the proc. Also, the line old_icon = icon_state must be inside the first if() before you change icon_state to "bat".
mob If the old icon_state is only changed once (in your character creation), then you can also just set it there and not have the old_icon = icon_state line at all in the bat verb. |
In response to Garthor
|
|
Transform_to_Bat() I tried what you said using the code above but it doesn't work. When i press the button a second time ie to revert from bat form, my icon remains as a bat. Where am i going wrong? |
In response to Sorcha
|
|
It'll work but I think what you mean is revert to the previous
character with overlays like hair, clothing etc. I think you can use the flick() proc but I'm pretty new to BYOND and am not too sure. |
In response to Draganath
|
|
Not even close.
The issue is that you didn't follow the advice I wrote. |
In response to DisturbedSixx
|
|
..Or a variable. Ever heard of them?
|
You can also use the initial() proc, however note the difference between the two methods (look initial() up).