I am trying to make a snake type map, but I have a weird problem. My map init trigger never runs, even if I set it to run based on time elapsed, it just doesn't fire at all. Here is the trigger:
The only reasons i can imagine why it is not working is that you marked it as not active, marked as initially of or TEMPLATE then it also does not work, it has nothing to do with the content, you just have initilization and no condition so thats fine
Or it says that your trigger crashes on the left side ingame as an error
Try displaying a text that says 'Task Completed' or something like that before and after any conditions, as they are usually what bugs stuff out :)
Also, check whether it's enabled and initially on (right click the actual trigger)
I tried displaying a message at the beginning of the trigger, it never showed. It's enabled, intially on and not a template. Can't seem to figure out what's wrong. :/
Tried that, didn't work either... I can't seem to figure out what's wrong, it worked before I tried to implement multiplayer through a for each integer, but now it just doesn't work.
EDIT: Does an array of size 4 allow me to use indexes 0-4 or only 0-3?
EDIT2: I tried changing the array sizes of all my used arrays from 4->5, but that didn't work either.
array variable[4] means all array from 0-4 are allowed, please check rightlick on your trigger if "template" is activated, or "not yet implemented" for the trigger or for the event.
if tempalte is on it is shown as a small page next to the icon itself, "not yet implemented" has no special symbol, it just deactivates without showing
sometimes certain functions bug out on map inits. maybe you cant use local vars???? i would just delete chunks (a couple lines, starting with the ddeclared local vars, then just X out what needs them to run or whatever) and check if the "TEXT MAP INIT WORK DAMIT!" shows up. ive run into the inexplicable, and just save your map (maybe as a new version) and start deleting to see where the problem is. it only takes a min tops to figure out what the problem is. maybe not how to fix it, but to figure what is cause the issue at least-
Okay, so now I tried changing all local variables in the trigger to global ones, that didn't fix anything either. I checked all the events/actions and the trigger itself, there are no tempaltes and everything is enabled. I'll try disabling stuff one at a time I suppose.
EDIT: I tried disabling everything except for a text message saying "Success!" and even that didn't show. I have checked the trigger numerous times, it's not a template and it's enabled, I'm 100% sure!. I'll attach the map so you can have a look I suppose...
EDIT2: Game init is the trigger that's bugged.
oh, I figured since the variable you are refering to in the periodic trigger was changed from 0 to something else in a map init trigger, it wouldn't matter...
EDIT: Well, that fixed it... Thanks alot for the help everyone!
sure, but if its infinite divided by 0 it seems to be triggered even before the map initialization and i am not sure but i guess it created an infinite loop doing this trigger before any other can be used... and since the triggers are not executed at the same time only this trigger was working and the variable could not be set by map init
People, people, don't you know that dividing by zero will create small black holes to suck up the poor soul who made the mistake?
On a more serious note: The order of initialization in SC2 maps is as follows:
InitLibs();InitGlobals();InitTriggers();
So using a global variable which value has been predefined would probably be OK. Defining the value of a variable in one trigger before using it in another would probably only work when the defining trigger is ABOVE the using trigger. Even that might not work if the TriggerAddEventXXX for all the triggers get registered BEFORE the triggers with TriggerAddEventMapInit() are run.
You can take a closer look on all the by pressing CRTL+F11 (I think) to open up the script view.
HALP
I am trying to make a snake type map, but I have a weird problem. My map init trigger never runs, even if I set it to run based on time elapsed, it just doesn't fire at all. Here is the trigger:
Is there anything wrong with it that causes it to bug and not run?
@TGhostdk: Go
im not a programming pro but my guess would be that the array you have with your points [4] starts with 0 not 1, its just a wild guess tho.
so i would change player 1 to 0, player 2 to 1 etc. then also change the for each integer accordingly.
or set your Integer i to = 1
@TGhostdk: Go
The only reasons i can imagine why it is not working is that you marked it as not active, marked as initially of or TEMPLATE then it also does not work, it has nothing to do with the content, you just have initilization and no condition so thats fine
Or it says that your trigger crashes on the left side ingame as an error
Try displaying a text that says 'Task Completed' or something like that before and after any conditions, as they are usually what bugs stuff out :) Also, check whether it's enabled and initially on (right click the actual trigger)
I tried displaying a message at the beginning of the trigger, it never showed. It's enabled, intially on and not a template. Can't seem to figure out what's wrong. :/
Then just copy all actions and the event into another trigger? :)
Tried that, didn't work either... I can't seem to figure out what's wrong, it worked before I tried to implement multiplayer through a for each integer, but now it just doesn't work.
EDIT: Does an array of size 4 allow me to use indexes 0-4 or only 0-3? EDIT2: I tried changing the array sizes of all my used arrays from 4->5, but that didn't work either.
@TGhostdk: Go
array variable[4] means all array from 0-4 are allowed, please check rightlick on your trigger if "template" is activated, or "not yet implemented" for the trigger or for the event. if tempalte is on it is shown as a small page next to the icon itself, "not yet implemented" has no special symbol, it just deactivates without showing
sometimes certain functions bug out on map inits. maybe you cant use local vars???? i would just delete chunks (a couple lines, starting with the ddeclared local vars, then just X out what needs them to run or whatever) and check if the "TEXT MAP INIT WORK DAMIT!" shows up. ive run into the inexplicable, and just save your map (maybe as a new version) and start deleting to see where the problem is. it only takes a min tops to figure out what the problem is. maybe not how to fix it, but to figure what is cause the issue at least-
@ezbeats: Go
disabling works fine as wlel you dont have to delete for that
Okay, so now I tried changing all local variables in the trigger to global ones, that didn't fix anything either. I checked all the events/actions and the trigger itself, there are no tempaltes and everything is enabled. I'll try disabling stuff one at a time I suppose.
EDIT: I tried disabling everything except for a text message saying "Success!" and even that didn't show. I have checked the trigger numerous times, it's not a template and it's enabled, I'm 100% sure!. I'll attach the map so you can have a look I suppose... EDIT2: Game init is the trigger that's bugged.
@TGhostdk: Go
man.... wtf did you do... look at the first trigger , this one
Events
Timer - Every (2.0 / (Real(j = 0 <Integer>))) seconds of Real Time
Local Variables
Conditions
Actions
Unit - Create 1 Marine2 (Unnamed) for player 15 at (Random point in (Playable map area)) using default facing (No Options)
cant tell you the name since the texts were gone
you cant divide by 0 that crashes the whole triggers lol
you have to set the variable at initial state to somethign else than 0, (i had to rename it to j) state then all your triggers work lol
by the way local variables work perfect
oh, I figured since the variable you are refering to in the periodic trigger was changed from 0 to something else in a map init trigger, it wouldn't matter...
EDIT: Well, that fixed it... Thanks alot for the help everyone!
@TGhostdk: Go
sure, but if its infinite divided by 0 it seems to be triggered even before the map initialization and i am not sure but i guess it created an infinite loop doing this trigger before any other can be used... and since the triggers are not executed at the same time only this trigger was working and the variable could not be set by map init
People, people, don't you know that dividing by zero will create small black holes to suck up the poor soul who made the mistake?
On a more serious note: The order of initialization in SC2 maps is as follows:
So using a global variable which value has been predefined would probably be OK. Defining the value of a variable in one trigger before using it in another would probably only work when the defining trigger is ABOVE the using trigger. Even that might not work if the TriggerAddEventXXX for all the triggers get registered BEFORE the triggers with TriggerAddEventMapInit() are run. You can take a closer look on all the by pressing CRTL+F11 (I think) to open up the script view.
Oh, that's great to remember for another time. In other news, my snake map is now hot and kicking!