Hey Guys :atkHappy:
So I was using the KS Engine and I was trying to make a spike trigger when I got this strange error:
FATAL ERROR in
action number 1
of Step Event0
for object spikeUp:
Push :: Execution Error - Variable Get 100109.trg(100061, -2147483648)
at gml_Object_spikeUp_StepNormalEvent_1 (line 2) - if (trg!=0) {
The step event in said spike:
//if this object has a trigger
if (trg!=0) {
//if it hasn't been triggered yet and the trigger is set
if (!triggered && global.trigger[trg]) {
//start moving
vspeed=vs;
hspeed=hs;
triggered=true;
}
}
For some reason gamemaker is having trouble with
if (trg! = 0)
Spikes Creation Code:
trg = 2
vs = -5
hs = 0
Does anyone know what the problem here is?
You mention you set the trigger value in "Creation Code" - is this Instance Creation Code or in the Create Event? It shouldn't matter, but it would be good to confirm.
I just checked the engine myself, and it seems to work fine; can you confirm your code looks like the following?
Spike Instance Creation Code
(https://i.imgur.com/sIGs8Mr.png)
Trigger Instance Creation Code
(https://i.imgur.com/WPQ6FY8.png)
spikeUp Create Event & spikeUp Step Event
(https://i.imgur.com/zo6lgGq.png)
Your step event looks correct, so we just need to find where the problem is. Which kind of spike are you using for this trigger? is it a spikeUp, or a different kind of spike? Is it a custom spike object? If so, show me the Create Event for it, I want to make sure trg is being initialized.
For some reason my create event looks like this: (https://imgur.com/YdZz7I1.png) (Don't know why I did that :atkWut:)
After correcting it, I get this error:
___________________________________________
############################################################################################
FATAL ERROR in
action number 1
of Other Event: Room Start
for object objTrigger:
Push :: Execution Error - Variable Get 100449.trg(100061, -2147483648)
at gml_Object_objTrigger_StartRoomEvent_1 (line 1) - if (!persist) global.trigger[trg]=0;
############################################################################################
Spike Creation Code: (https://i.imgur.com/brvaugF.png)
Trigger: Trigger Creation Code:(https://i.imgur.com/w1SZ9Ug.png)
Collision with Player Event: global.trigger[trg]=1;
Room Start: if (!persist) global.trigger[trg]=0;
Also, I am using the creation code when you right click an object
Also Also, I am using the SpikeUp object, but plan on using custom spikes in the future
Old Message
Thanks- this is a very weird issue and I have no idea why it hates me
Alright, so i added trg = 0 in the trigger
Now I have this issue and adding trg = 0 to SpikeUp doesn't fix it
FATAL ERROR in
action number 1
of Step Event0
for object spikeUp:
Push :: Execution Error - Variable Get 100109.trg(100061, -2147483648)
at gml_Object_spikeUp_StepNormalEvent_1 (line 2) - if (trg!=0) {
Step event in question:
//if this object has a trigger
if (trg!=0) {
//if it hasn't been triggered yet and the trigger is set
if (!triggered && global.trigger[trg]) {
//start moving
vspeed=vs;
hspeed=hs;
triggered=true;
}
}
EDIT:
Alright, so I used a fresh version of the 0.8 KS Engine and copied the spikeUp and Trigger object code into the old version, and now its giving me this error:
FATAL ERROR in
action number 1
of Other Event: Room Start
for object objTrigger:
Push :: Execution Error - Variable Get 100448.trg(100061, -2147483648)
at gml_Object_objTrigger_StartRoomEvent_1 (line 1) - if (!persist) global.trigger[trg]=0;
EDIT EDIT:
YES, IT WORKS :atkHappy: :IceFairy: :paraKid: :tenKapple: :denMiku_v2:
Adding trg = 0 to Trigger + Copying the triggers + SpikeUp some how fixed it
To help anyone else tat is having this issue, ill describe it
I had custom spikes, parented to SpikeUp
The Custom Spikes had Create and Step Events identical to SpikeUp's
This somehow messed up the SpikeUp
Yeah idk