• Hey! Guest! The 39th GMC Jam will take place between November 26th, 12:00 UTC and November 30th, 12:00 UTC. Why not join in! Click here to find out more!
  • Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Question - D&D link objects



hi, i just tried game maker studio 2 and its amazing but i have a question
how can i do this ?
let say i want to have a health script wich after health is less than 0 destroy object after 2 second
and i want to use this on so many other sprites
in DnD i can set a variable and then set an alarm and in alarm destroy object but :
for each object which i want to add health on it i have to write this events again
i know i can use scripts for health part, but how i do the alarm? i want to write this code (DnD) once and use it in so many objects
another way is to make health a parent but let say i want to have different objects like this (health) in my sprites and write it once and use it on different sprites
like turret , weapon , ...
i think the problem is the "wait" wich i need on my health object
so is there any way ?