GMS 2 [SOLVED] Particle type doesn't exist?

PlayerOne

Member
Bit of a problem here. I'm using particles in my project but every time I change rooms the output window indicates repeatedly:

part_particles_create :: particle type does not exist!

The odd thing is the particles function normally and I can't figure out why the output keeps spitting out that message.
 

TsukaYuriko

☄️
Forum Staff
Moderator
Without seeing the code in question, there is next to nothing we can go by to figure out what's going on. Please post all relevant code.
 

PlayerOne

Member
Without seeing the code in question, there is next to nothing we can go by to figure out what's going on. Please post all relevant code.
After testing, I narrowed the issue to this particle script.

Keep in mind the I have 3 controller objects, 1 persistent and 2 non-persistent. The one non-persistent controller called Obj_Controller_Land contains the script in the create event and uses the clean-up event to destroy the globals when the room ends.

Because the object isn't persistent I stuck this controller object in every room to ensure that the particles are continually used. Though from the output in the program something isn't being destroyed from the last room to the new room.


Code:
SCRIPT:
global.pt_rain=part_type_create()
global.pt_rain_emit=part_emitter_create(global.particle)

var sys = global.particle
var rain = global.pt_rain;
var pt_emit = global.pt_rain_emit

part_type_shape(rain,pt_shape_line)
part_type_size(rain,0.2,0.3,0,0)
part_type_color2(rain,c_ltblue,c_white)
part_type_alpha2(rain,0.5,0.1)
part_type_gravity(rain,0.1,290)
part_type_speed(rain,0.5,0.5,0,0)
part_type_direction(rain,230,330,0,1)
part_type_orientation(rain,290,290,0,0,0)
part_type_life(rain,20,180)

part_emitter_region(sys,pt_emit,camera_x-1200,room_width,camera_y-100,camera_y-100,ps_shape_line,ps_distr_linear)
part_emitter_stream(sys,pt_emit,rain,5)

   repeat(room_speed * 8) // <<< Speed of rain
   {
       part_system_update(sys);
   }

Code:
CLEAN UP:
part_type_destroy(global.pt_rain);
part_type_destroy(global.pt_rain_emit);
 

TsukaYuriko

☄️
Forum Staff
Moderator
You're calling part_type_destroy on an emitter. That can't be good for anything that runs after it, as particle and emitter IDs are untyped and can overlap, thus potentially destroying a valid particle type instead of the emitter.
 

PlayerOne

Member
You're calling part_type_destroy on an emitter. That can't be good for anything that runs after it, as particle and emitter IDs are untyped and can overlap, thus potentially destroying a valid particle type instead of the emitter.
Still have to learn a bit more about particles. Looks like I got some restructuring to do in the controller objects. Thank you. :)
 
Top