[SOLVED] Destroy Effect error

G

Guilherme Hernandez

Guest
Speak up, all right?

One more question, I have a spawner that spawns several zombies. But when I squeeze to destroy a zombie, the Effect appears on another, and when I squeeze on another zombie the game crashes.

The Effect, im doing with DnD... I dont know how do with Code.

Like, I want the effect to appear only on the zombie I killed, not everyone on the screen.
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
Please share a screenshot of the DnD used and also post the EXACT error you get. :)
 

FrostyCat

Member
This only ever happens to people who reference variables in object.variable form when multiple instances of the object are in the room.

If the effect is created in the zombie's Destroy event, DO NOT create it at something like obj_zombie.x or obj_zombie.y. Leave the obj_zombie. part out of it and it will reference the current instance's coordinates. The same is true for any other instance property (e.g. sprite_index) or instance-scoped variable from within the same instance.

Rookies need to stop trying to reference variables for the current or colliding instance using object IDs. If only mainstream GML education would do a more sensible job educating novices about scope and instance handling.
 
G

Guilherme Hernandez

Guest
The event that contains the effect is the LEFT RELEASED, because I thought it would be in the same place where the code destroying the instance.

The problem is that I do not understand English very much, and practically all the tutorials are Portuguese, at least everyone I met now, so I'm having difficulties.

Relax, man, I'm starting now with codes and with Game Maker. We all get something wrong or ask for help.
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
Okay, that's fine. :)

I would still like to look at the DnD though... It may be that what @FrostyCat says is true but without actually seeing what you've done it's very difficult to help. It does sound like you are targeting an object rather than an instance though...
 
G

Guilherme Hernandez

Guest
I just succeeded in getting the effect to the place of the instance. I did as FrostyCat said, I just took the (objZombie.).
I did not know it worked that way. Thanks for the help, and sorry for not knowing the basics walks. Like I said, I started a month ago.
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
I did not know it worked that way. Thanks for the help, and sorry for not knowing the basics walks. Like I said, I started a month ago.
That's great! And don't let some people who are a bit direct about their advice put you off... They mean well. ;)
 
G

Guilherme Hernandez

Guest
I know, I was not mad or anything. Just think with a little more opinion because I started a little. But it's alright. : D Thanks to all who tried to help in a way!
 
Top