Legacy GM Problem setting variables used in particle script. [SOLVED]

T

Tys

Guest
Hello everyone,

In my spellcasting-game I use a particle system which consists of two colours. Since many things in my game consist of two colours which depend on the elements of the spell you're gonna cast, I have made two variables called 'global.spellcolour1' and 'global.spellcolour2'.
I have inserted these two variables into the script that creates the particles so that the particles will be the colours of the chosen elements. This way I won't need to make new particles for every variation, but I can simply colour them.
However, the script seems to initialize before the variables are first set in the Game Start Event. So it throws an error, saying the variable is not set.

If I intitialize the variables in the create event of the object that creates and destroys the particle system, then it will swallow it. However, they will then always stay at the values I set them at there.. This is probably because every time it creates a new particle it sets them again.

I have tried declaring the variables in the Game Start Event of both the player object and that of the particle system object. In both cases it says the variable is not set.

I have also tried using a separate room to initialize stuff in before moving on to the room with the script. Even that didn't do the trick. Assuming I did that right.

Is it not possible to use variables in scripts that are declared outside of it?
I hope someone has a bright idea on how to make this possible. If there are other details I should provide, please let me know.

Thank you.


I happened to go watch a tutorial video about particles just now and he mentioned that if you want things to change you need to put the ps object code in the step event rather than the create event.
THIS FIXED IT.

Sorry for posting unnecessarily. I had been looking for a solution for a while.
 
Last edited by a moderator:
Top