Page 1 of 1

help needed!! transfering actor variables :(

PostPosted: Fri Apr 15, 2011 10:50 am
by sonicfire
hi folks!

can anyone help me with this one? basically i´m trying to pass a colour variable between three actors so to say.
i cant think of a better way to do this. in this "game" currently it should detect colours and destroy connected
diamonds (of the same colour). however in my routine it only works with the blue diamonds
(guess because it starts with "0" which is colour blue, so the variable isnt passed correctly and thus always zero).

can anyone have a look? i dont know why my variable passing
Code: Select all
actorxyz->ia_mycol = ia_mycol;

doesnt work :(

thanks so much in advance!!

Re: help needed!! transfering actor variables :(

PostPosted: Fri Apr 15, 2011 1:16 pm
by sonicfire
ok, got it, had to move some actor variable related stuff into a TIMER! instead of "in the creation event".
(so execute something around 20ms later).

there was once a problem with this also, using load and savevars, when used in create actor event.

ok, problem solved :) weird, but solved.

Re: help needed!! transfering actor variables :(

PostPosted: Fri Apr 15, 2011 8:55 pm
by skydereign
This problem is due to the event ordering gE uses. When you call CreateActor, it will stop the current script and create the actor (which means it will run the create actor script before you can set any variables). Same goes for Activation Events. Of course the actor isn't drawn until the draw events start. Anyways, you don't have to use a timer in your case, and most cases actually. I usually use the creator actor reference, which is extremely useful. In temparr's create actor event, add this code to the top.
Code: Select all
ia_mycol = creator.ia_mycol;