pd3 25 Posted January 7, 2013 I was wondering if anyone could help me figure out a small problem I'm having with a mission I'm trying to customize. I would like to figure out if there's a script command that I can use in conjunction with a while statement to check if the player has a trigger activated? I've been looking through the comref, however I'm not terribly sure if I've really found anything useful. Share this post Link to post Share on other sites
tryteyker 28 Posted January 7, 2013 while {true} do { if (player in thisList) then { //code }; }; Constantly checks if player is within trigger area. Only works within a specific trigger. Share this post Link to post Share on other sites
iceman77 18 Posted January 7, 2013 (edited) you maybe can do it this way aswell.trytekers way is better though, i think. trigger: condition: isPlayer in thislist // or player in thislist onAct: someVariable=true; publicVariable "somevariable"; _handle=[]execVM "list.sqf" DeAct: somevariable=false;publicVariable "somevariable" list.sqf while {somevariable} do { ...code...}; Edited January 7, 2013 by Iceman77 Share this post Link to post Share on other sites
pd3 25 Posted January 7, 2013 Thanks for the replies however I think I may be in over my head, lol. Okay, it seems like it might be a bit more tricky to implement these solutions given my skill level. For me scripting has always been like knowing how to read french, but never being able to speak it or write it, in school. The actual truth is I'm trying to make an amendment to a script from one of Thompsonb's awesome Flashpoint - series dynamic missions. I'm converting it for use with Emita city, and I would prefer to adjust the variables: spawnMAX spawnMIN Under certain conditions, which IIRC is the minimum and maximum possible radius at which enemies can spawn. The existing system works great for open field combat, however once you move into more densely populated areas, the acceptable field combat radius makes for some very lonely times while navigating the actual city. This is the script that determines the conditions for spawning infantry and vehicles. What I would like to do is create a separate condition in which it tests to see if the player has activated a certain trigger, at which point a more "MOUT friendly" spawn radius is used as opposed to spawnMAX, and spawnMIN. _pos = SPAWN_CENTER; _offset1 = spawnMAX; _offset2 = spawnMIN; _maxX = (_pos select 0) + _offset1; _minX = (_pos select 0) - _offset1; _maxY = (_pos select 1) + _offset1; _minY = (_pos select 1) - _offset1; _newX=_minX + (random (_maxX - _minX)); _newY=_minY + (random (_maxY - _minY)); while{(surfaceIsWater [_newX,_newY])OR([_pos,[_newX,_newY]]call xyPosDist > _offset1)OR([getPos player,[_newX,_newY]]call xyPosDist < _offset2)}do{ _newX=_minX + (random (_maxX - _minX)); _newY=_minY + (random (_maxY - _minY)); }; [_newX,_newY] Share this post Link to post Share on other sites
Ghost113 10 Posted January 8, 2013 Correct me if I'm wrong but I think this should work given the examples above. Place down a trigger and in the on condition put this; and set the activation to BLUFOR or whatever side you're using. In the activation put something like nul = [] execVM "spawnUnits.sqf"; spawnUnits.sqf would look something like: while {true} do { if (player in thisList) then { //code _pos = SPAWN_CENTER; _offset1 = spawnMAX; _offset2 = spawnMIN; _maxX = (_pos select 0) + _offset1; _minX = (_pos select 0) - _offset1; _maxY = (_pos select 1) + _offset1; _minY = (_pos select 1) - _offset1; _newX=_minX + (random (_maxX - _minX)); _newY=_minY + (random (_maxY - _minY)); while{(surfaceIsWater [_newX,_newY])OR([_pos,[_newX,_newY]]call xyPosDist > _offset1)OR([getPos player,[_newX,_newY]]call xyPosDist < _offset2)}do{ _newX=_minX + (random (_maxX - _minX)); _newY=_minY + (random (_maxY - _minY)); }; [_newX,_newY] }; }; Share this post Link to post Share on other sites
panther42 50 Posted January 8, 2013 What I would like to do is create a separate condition in which it tests to see if the player has activated a certain trigger, at which point a more "MOUT friendly" spawn radius is used as opposed to spawnMAX, and spawnMIN. triggerActivated Share this post Link to post Share on other sites
pd3 25 Posted January 8, 2013 (edited) Correct me if I'm wrong but I think this should work given the examples above.Place down a trigger and in the on condition put this; and set the activation to BLUFOR or whatever side you're using. In the activation put something like nul = [] execVM "spawnUnits.sqf"; spawnUnits.sqf would look something like: while {true} do { if (player in thisList) then { //code _pos = SPAWN_CENTER; _offset1 = spawnMAX; _offset2 = spawnMIN; _maxX = (_pos select 0) + _offset1; _minX = (_pos select 0) - _offset1; _maxY = (_pos select 1) + _offset1; _minY = (_pos select 1) - _offset1; _newX=_minX + (random (_maxX - _minX)); _newY=_minY + (random (_maxY - _minY)); while{(surfaceIsWater [_newX,_newY])OR([_pos,[_newX,_newY]]call xyPosDist > _offset1)OR([getPos player,[_newX,_newY]]call xyPosDist < _offset2)}do{ _newX=_minX + (random (_maxX - _minX)); _newY=_minY + (random (_maxY - _minY)); }; [_newX,_newY] }; }; Does this mean I need two separate scripts for each, regular and modified trigger-initiated spawning? Because I think that might be a problem as the spawn script activates at intervals to generate new forces as they're killed. If you have two running in tandem, it could probably result in a pretty big cluster. I'm not exactly sure what that little bit at the top does, but how does it know if a trigger is activated? Because this script is already technically running from the get-go, wouldn't activating the script from the trigger itself be like turning the key on a car that's already running? I think in theory what I need is something within the existing script to basically say: Are we trying to spawn over water? If no, continue Is "triggerxxy" activated? If yes, then use new offset variables (lets say _offset3 = spawnMIN_MOUT, _offset4 = spawnMAX_MOUT) Additionally, would this mean that the trigger would have to be set to "repeatedly" instead of once, in case the player leaves the urban environment? triggerActivated That's probably what I was looking for, thanks much. Edited January 8, 2013 by Pd3 Share this post Link to post Share on other sites