ID:155378
 
Hi there, i'm wondering if it is possible to change multiple icon states at once? I'm trying to do a door code and have it open when you Enter(), i've got it working per icon but the door is quite big.

Is there a way to have it so that when I enter it triggers three different things to change icon_state? so that it appears that the whole door is opening?

You want like a movie icon_state?
In response to Lugia319
Errr... best way I think to explain it is like this:

Character enters here
|
V
--------
| 1 | 2 | 3 |
--------
| 4 | 5 | 6 |
--------

I want when the character enters 2, all of the other 6 icon_states change

In response to Jadwiseman
Still quite simple. It requires only a get_step() proc with icon_state change.

EDIT: Here's a draft.

turf
Door // Door
Entered() // Entered Proc, It's default proc so I don't have to add proc before it
for(var/turf/Door/T in oview(src,1)) // All of the door turfs surrounding it will be affected.
T.icon_state = "swing" // It'll go to "Swing" movement state. I'm assuming that you have the door stop swinging at the end of swing state and it doesn't loop forever.
sleep(5) // Sleep a half second (time to swing)
T.icon_state = initial(T.icon_state) // Initial is a nifty proc I came across a while ago. It'll return the value of the argument at run time, returning your Door back to it's "initial" state!
In response to Lugia319
Could you help me out with the code please? I'm still only just learning
In response to Jadwiseman
See my previous post.
In response to Lugia319
Ah thanks so much, I shall give it a go :D
In response to Jadwiseman
I can't seem to get this to work :(... nothing happens.

turf
Daedalus
Doors
ddoor4 //open door
Entered()
for(var/turf/Daedalus/Doors/T in oview(src,1))
T.icon_state = "dcdoor4" //closed door
sleep(5) //
T.icon_state = initial(T.icon_state)


In response to Jadwiseman
You need to tab everything after the proc once.
In response to Lugia319
Sorry yes, i've tried that... it didn't seem to do anything.

I need the turf tile the usr walks on to change state from say dcdoor1 to dcdoor2, and then all the tiles around it to change state also to something else.

dcdoor# = closed
ddoor# = open

Example of a 32x32 tile layout:

dcdoor4 - dcdoor5 - dcdoor6

dcdoor3 - dcdoor1 - dcdoor2

User Enters 'dcdoor1', dcdoor1 then changes state to ddoor1.
This also triggers all of the other turf tiles around it to change state. So they change to this state after the user walks into dcdoor1.

ddoor4 - ddoor5 - ddoor6

ddoor3 - ddoor1 - ddoor2

Thanks so much for your help so far and you patience
In response to Jadwiseman
Does that make sense?
In response to Jadwiseman
Only if you're saying these doors have different icon states. I tested it myself and mine worked perfectly. Every door had a different icon but the same states, open and closed. I changed the icon state when I entered one door and the others followed suit. I don't really know why yours won't work, but it's probably because you didn't understand something.
In response to Lugia319
I must be missing something, sorry, I am still learning so thank you for your patience with me. The turf icons I am using are all in the same .dmi icon file called 'Daedalus'.

Here is the code I have at the moment

turf
Daedalus
Doors
Dcdoor6
icon = 'Daedalus.dmi'
icon_state = "dcdoor6" // Closed state
// icon_state = "ddoor4" - Open state

Dcdoor5
icon = 'Daedalus.dmi'
icon_state = "dcdoor5" // Closed state
// icon_state = "ddoor3" - Open state

Dcdoor4
icon = 'Daedalus.dmi'
icon_state = "dcdoor4" // Closed state
// icon_state = "ddoor4" - Open state

Dcdoor3
icon = 'Daedalus.dmi'
icon_state = "dcdoor3" // Closed state
// icon_state = "ddoor3" - Open state

Dcdoor2
icon = 'Daedalus.dmi'
icon_state = "dcdoor2" // Closed state
// icon_state = "ddoor2" - Open state

Dcdoor1
icon = 'Daedalus.dmi'
icon_state = "dcdoor1" // Closed state
// icon_state = "ddoor1" - Open state



This is what I have when the door is closed:


Thank you again for your help :).
In response to Jadwiseman
Nononononononononono. All of their icon states should be "open" when they are open.
In response to Lugia319
Sorry, could you show me what you mean?
In response to Jadwiseman
turf
Daedalus
Doors
Dcdoor6
icon = 'Door6.dmi'
icon_state = "Closed"
Dcdoor5
icon = 'Door5.dmi'
icon_state = "Closed"
Dcdoor4
icon = 'Door4.dmi'
icon_state = "Closed"
Dcdoor3
icon = 'Door3.dmi'
icon_state = "Closed"
Dcdoor2
icon = 'Door2.dmi'
icon_state = "Closed"
Entered()
for(var/turf/Daedalus/Doors/T in oview(src,3)) .
T.icon_state = "SwingOpen"
sleep(50)
T.icon_state = "Open"
sleep(5)
src.Check()
Check()
if(var/mob/a in oview(src,3))
for(var/turf/Daedalus/Doors/T in oview(src,3))
T.icon_state = "SwingShut"
sleep(5)
T.icon_state = "Closed"
else
sleep(50)
Check()

Dcdoor1
icon = 'Door1.dmi'
icon_state = "Closed" // Closed state


Alright. This is the easiest way in my opinion to go about doing this. Make each door in a seperate dmi. and name all the icon states the same for the 4 states. Closed Open SwingShut SwingOpen. The rest has been explained in Lugia's post. Only thing I did was make it easier to handle the icons. Using them all in the same Dmi, you have different icon states. So when trying to set them all at once wasn't working out. Which you can make it work I just figured this way is a hair easier.
In response to WickedlyAndy
Wow thanks so much for your help, that seems to work except it doesn't like the Check proc:

Daedalus.dm:25:error: var/mob/a: undefined var
Daedalus.dm:30:error: Check: undefined proc
Daedalus.dm:23:error: src.Check: undefined proc
Daedalus.dm:24:error: Check: undefined proc

If I get rid of that it works, except for a few little things:

A. It doesn't change the state of the turf I enter
B. It doesn't change the door back to the "closed" state after a few seconds.
C. It changes the state of all the other doors turfs really slowly. I had to delete the sleep(5) for it to change them all instantly.

I don't have a "swing" state, the doors just go from "Closed" to "Open" so don't worry about factoring that it

Thanks for everyones help on this so far :), you're all legends, nearly there :)


In response to Jadwiseman
Try changing oview to view. oview doesn't include the center. and if you deleted the Check proc, after it's icon state is changed to Open, add a sleep for how long you want it to stay open, and than T.icon_state="closed". That should fix those problems.
In response to WickedlyAndy
O wow thanks that works a treat! this has been bugging me for days and thanks to you guys you've helped me solve the issue :), thank you so much!
In response to Jadwiseman
Not a Problem