Jump to content
z1_

(REDACTED) Civilian Presence Module sqf mission export

Recommended Posts

So, I set up a bunch of modules, waypoints, and triggers for the Civilian Presence Module all over the map.  Everything works great in editor.  I wanted to try exporting it to sqf so I could use as a script and not have all the clutter for use in future missions.  It somewhat worked, as everything will load off the script but all the areas become active and spawn as soon as it loads even though nobody set off the trigger.  This only happens if I use script, works fine loaded from editor.  They are all set to any player - present - repeatable and synced to their respective module.  Is there a way to edit the sqf export so it will work correctly and only activate triggers when actually present.  There things I could remove?  If you want to know what I’m looking at set  (at work currently) up the civilian presence mod for one city real quick and do an export.  I know I could just merge with missions but I’d like it to not be cluttered if someone decides to edit the missions I upload.  Any help would be appreciated, I’m not too savvy on scripting but have a general understanding.  I know there’s other options, just want to see if I can get this to work.

Share this post


Link to post
Share on other sites

UPDATE: So I gave up on that for now, and am trying to wrap my head around adding a single civ module, waypoint, and spawn, and sync the trigger in editor to the civ module that the script spawns.  The code below runs without error, but nothing actually happens.  Sure I'm missing something.  Most my knowledge on Arma scripting is very fragmented, could use some help.  Just spawning them all in the same spot atm until I get it working.  This is mostly for my understanding, there's a million civ scripts out there.  I'm sure I could pull it off with actual units a lot easier, but I'd like to understand how to get these modules spawned, synced, and running correctly via script.

 

running it on the trigger activation as

this exec "zciv.sqf";

 

_group = createGroup sideLogic;
_item0 = createUnit ["ModuleCivilianPresence_F",[0,0,0],[],0,"CAN_COLLIDE"];
_item0 = group _group
_item0 synchronizeObjectsAdd [this];
_item0 setPosWorld getPosWorld this;
_item0 setVectorDirAndUp [[0,0,0],[0,0,0]];
_item0 setVariable ["objectArea",[100,100,0,true,-1]];
_item0 setVariable ["#onCreated",compile true];
_item0 setVariable ["#onDeleted",compile true];
_item0 setVariable ["#unitCount",5];
_item0 setVariable ["#usePanicMode",false];
_item0 setVariable ["#useAgents",true];
_item0 setVariable ["#debug",true];
_item0 setvariable ["BIS_fnc_initModules_disableAutoActivation",false];
_item0 setvariable ["BIS_fnc_initModules_activate",true];

_item1 = createUnit ["ModuleCivilianPresenceSafeSpot_F",[0,0,0],[],0,"CAN_COLLIDE"];
_item1 = group _group
_item1 setPosWorld getPosWorld this;
_item1 setVectorDirAndUp [[0,0,0],[0,0,0]];
_item1 setVariable ["objectArea",[0.1,0.1,0,false,-1]];
_item1 setVariable ["#type",1];
_item1 setVariable ["#capacity",3];
_item1 setVariable ["#useBuilding",true];
_item1 setVariable ["#terminal",false];
_item1 setvariable ["BIS_fnc_initModules_disableAutoActivation",false];
_item1 setvariable ["BIS_fnc_initModules_activate",true];

_item2 = createUnit ["ModuleCivilianPresenceUnit_F",[0,0,0],[],0,"CAN_COLLIDE"];
_item2 = group _group
_item2 setPosWorld getPosWorld this;
_item2 setVectorDirAndUp [[0,0,0],[0,0,0]];
_item2 setVariable ["objectArea",[0.1,0.1,0,false,-1]];
_item2 setvariable ["BIS_fnc_initModules_disableAutoActivation",false];
_item2 setvariable ["BIS_fnc_initModules_activate",true];

 

Share this post


Link to post
Share on other sites
52 minutes ago, z1_ said:

The code below runs without error, but nothing actually happens

 

you are creating all the modules at [0,0,0] position

 

 

Share this post


Link to post
Share on other sites
7 minutes ago, gc8 said:

 

you are creating all the modules at [0,0,0] position

 

 

I move them all after the fact on a different line with example:  _item0 setPosWorld getPosWorld this;

With that, I'm trying to move it to where the trigger is. That not doable?

Share this post


Link to post
Share on other sites
Just now, z1_ said:

I move them all after the fact on a different line with example:  _item0 setPosWorld getPosWorld this;

With that, I'm trying to move it to where the trigger is. That not doable?

 

are you sure this variable is working?

Share this post


Link to post
Share on other sites
2 minutes ago, gc8 said:

 

are you sure this variable is working?

That I'm not 100% sure about.  I get lost on the variables when i go between local and global. 

Triggers condition is this and its set anyplayer/present/repeatable with  this exec "zciv.sqf";  in its init

Is the this condition in the trigger referring to the player or the trigger? Do I need to call it differently?

I'm hoping to not have to give the trigger a variable name so I can put it on any trigger, but like i said, I don't know much.

Share this post


Link to post
Share on other sites

I also figured I need the modules to not init until everything spawned and connected

Share this post


Link to post
Share on other sites

I'll try to set all the positions to the player tomorrow and see if i have any luck.  I better crash.  Thanks for the assistance, and anymore you happen to provide. 

Share this post


Link to post
Share on other sites
8 hours ago, gc8 said:

 

are you sure this variable is working?

So just to test it in general with a named trigger.  I named the trigger trig1, then changed all the this in script to trig1.  I would assume it's moving them there now.

Still didn't have any luck.  I even added another object just to see if it would spawn and move there.  Again no errors, but nothing happened.

 

Think I need to start smaller and just understand spawning and moving objects correctly, before I worry about  spawning logics.

 

If anyone comes across this and can shed more light would be cool.

Share this post


Link to post
Share on other sites

Why not simply set the module position when creating it?

_pos = getpos triggernameHere;


_item0 = createUnit ["ModuleCivilianPresence_F",_pos ,[],0,"CAN_COLLIDE"];

 

also make sure you have errors turned on from the launcher

 

 

Share this post


Link to post
Share on other sites
On 7/21/2021 at 7:29 PM, z1_ said:

I wanted to try exporting it to sqf so I could use as a script and not have all the clutter for use in future missions.

@z1_ have you looked at some of the civilian scripts by the community instead of these #$%@ modules by BIS?

If not, I can give you some recommendations, or possibly modifications I've done to a couple of my favorites.

Share this post


Link to post
Share on other sites
On 7/23/2021 at 3:09 PM, panther42 said:

@z1_ have you looked at some of the civilian scripts by the community instead of these #$%@ modules by BIS?

If not, I can give you some recommendations, or possibly modifications I've done to a couple of my favorites.

Yeah, I have a few.  Usually just use Mongos.  Was trying to build my own based off the modules as a learning experience.

 

On 7/23/2021 at 1:32 AM, gc8 said:

Why not simply set the module position when creating it?


_pos = getpos triggernameHere;


_item0 = createUnit ["ModuleCivilianPresence_F",_pos ,[],0,"CAN_COLLIDE"];

 

also make sure you have errors turned on from the launcher

 

 

 

Thanks for the info, I'll give it a try.

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

×