Jump to content
Sign in to follow this  
Cookie77

Setting npc position?

Recommended Posts

Hey guys,

I am working on a mission and im trying to set npc positions in a building.. I was wondering if there is an easier/quicker method to do this without using the 2d editor that arma 3 has. I tried setting the NPC position via mission.sqm but no luck. If anyone can explain/show/tell me how to do this it would bem uch appreciated

Share this post


Link to post
Share on other sites

I use a script that gets called at launch and just setPosATL the unit where I want them. There are good scripts out there to put a getPos on a radio trigger so you can just walk around and stand where you want the other unit, hit the trigger and then paste the result into the script directly. This works a treat for my missions.

Das

Share this post


Link to post
Share on other sites

class Item417

{

position[]={16749.439,9.309804,13637.644}; Am i editing this with that pos?

azimut=-50.0602;

id=622;

side="EMPTY";

vehicle="Land_Dome_Small_F";

skill=0.60000002;

text="fed_dome";

init="this enableSimulation false; this allowDamage false;";

};

Also if you could post the script id love you.

Share this post


Link to post
Share on other sites

For editing's sake, place a trigger on the map. Make it repeatable and make it a radio trigger on whatever channel you want (say Alpha). In the onAction field, put this...

 copyToClipboard format ["this setPosATL %1;this setDir %2;",getPosATL player, getDir player];

Now, you can preview the mission and walk to where you want the soldier to be. Facing is important as this will handle that also (You can have your guards on both sides of the door facing out). Once you are happy with the placement, tab out of ARMA and go to an editor and hit <ctrl>-v to paste the result into a script.

you will see something like this...

this setPosATL (5021.2,132.0, 12.5);this setDir 182;

lets go ahead and assume our soldier is gonna be called mySoldier1. Change the line to look like this...

mySoldier1 setPosATL (5021.2,132.0, 12.5);mySoldier1 setDir 182;

repeat this until you have all the specifically placed units you want. Be aware that the downside of this is each soldier has to be a group of only 1 guy (or else the others will move into formation at mission start). You can get around this by turning of movement (mySoldier1 disableAI "MOVE"). The downside of that is the soldier will never move from that spot. Lets assume for this purpose that we are putting down 4 soldiers to guard the general so we end up with four of the calls.

In the editor, place down four soldiers (not grouped) and name them mySoldier1 to mySoldier4.

Also in the editor, put down a very large trigger (like 50,000 in size). Make it fire only once, and be onPresent blufor (or you could just make it true for the condition but this way will wait until all units are down before firing). set the onAct to be a call to you script (I usually call this script missionPrep.sqf).

nul = execVM "missionPrep.sqf";

that script you were editing before, call it missionPrep.sqf. It might look like this...

if (!isServer) exitWith {};

mySoldier1 setPosATL (5019.4,131.3, 12.5);mySoldier1 setDir 182;
mySoldier2 setPosATL (5020.2,112.6, 12.5);mySoldier2 setDir 132;
mySoldier3 setPosATL (5024.6,121.2, 12.5);mySoldier3 setDir 181;
mySoldier4 setPosATL (5028.1,135.5, 12.5);mySoldier4 setDir 115;

The ifServer call at the start makes it only fire once on the server. You can use this to populate special items like light poles onto the map or do a variety of things. Lemme know if this works for you.

Das

ps - gotta give props where due... This is based heavily on work done by Garthra.

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
Sign in to follow this  

×