Jump to content
aseliot

Call doesn't work inside trigger

Recommended Posts

So me calling SHK_Pos in a trigger doesn't appear to work for some reason.

I init SHK_pos like this.

call compile preprocessfile "SHK_pos\shk_pos_init.sqf";

I call this all the time and works fine, but I tried to move some code that worked inside a trigger, but it gives a zero divider error at shk_pos_fnc_isinellipse.sqf.

So note that it works fine outside the trigger. For some reason the size in this script is set to 0.

 _sitetrg setTriggerStatements ["player in thislist",
    "
      _checked = thisTrigger getVariable ['_checkScavengeSite',false];
      if (!_checked) then {
        0 = [] spawn {
          _markername = thisTrigger getVariable ['_trigMarkerName','NOTFOUND'];
          for '_l' from 0 to _lootnum do {
            _junkpos = [_markername,false,[]] call SHK_pos;
            [_junkpos, (selectRandom junkarr)] call rvgCoC_spawnLootObj;
          };

          _thistrigx = ((getMarkerSize _markername) select 0)*2;
          _thistrigy = ((getMarkerSize _markername) select 1)*2;
          _maxloot = round((_thistrigy+_thistrigx) / 10);
          _lootnum = round((random (_maxloot/2))+(_maxloot/2));

          _mrksize = _thistrigx+_thistrigy;
          _scvgnmrk = createMarker ['_scvngsite'+(str _sitepos),_sitepos]; _scvgnmrk setMarkerShape 'Ellipse';
          _scvgnmrk setMarkerSize [_mrksize, _mrksize]; _scvgnmrk setMarkerAlphaLocal 0;
          mrkskiplist pushBack _markername;
        };
      };
    ",""];

I thought calling SHK_pos would be global.

Share this post


Link to post
Share on other sites

_trigger is not defined, at least inside your spawn code.

_trigger = thisTrigger;

_trigger spawn {_trigger = _this; _markerName = _trigger setVariable....

 

Share this post


Link to post
Share on other sites
20 hours ago, pierremgi said:

_trigger is not defined, at least inside your spawn code.

_trigger = thisTrigger;

_trigger spawn {_trigger = _this; _markerName = _trigger setVariable....

 

Aw man, that was supposed to be a thisTrigger.

But sadly still gives the same error.

a3err.png 

Yeah I know there's also something else is in there but i doubt it has anything to with it.

Share this post


Link to post
Share on other sites
23 hours ago, aseliot said:

_markername = _trigger getVariable ['_trigMarkerName','NOTFOUND'];

Looks to me as if the variable isn't defined. Check it with systemchat or diag_log. I guess that the trigger size will be 0 then and that leads to this error:

52 minutes ago, aseliot said:

a3err.png 

beacuse you can't divide by 0.

Share this post


Link to post
Share on other sites
On 10/5/2017 at 7:23 PM, 7erra said:

Looks to me as if the variable isn't defined. Check it with systemchat or diag_log. I guess that the trigger size will be 0 then and that leads to this error:

beacuse you can't divide by 0.

 

Yeah i get that.

But stupid me, it was another script that caused it. Not like the hint you get is any indication.

Share this post


Link to post
Share on other sites

If multiple things throw errors at once it causes things like that. Always best to isolate code when testing I guess

Share this post


Link to post
Share on other sites

Is there a reason to "call compile" it, instead of "execVM"? Performance?

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×