Jump to content
Sign in to follow this  
AdirB

createUnit not working (new at this)

Recommended Posts

Hello,

I've tried to use createUnit but I couldn't get it working since I'm new to this.

 

This is the script:

if (isServer) then {
guardgrp = creategroup west;

_pos = [14745.541,17.91,16732.02];
guard1 = guardgrp createUnit ["Exile_Guard_01", _pos ,[],0,"form"];
guard1 setDir 270;
guard1 setPosATL _pos;

_pos = [14732.757,17.91,16731.408];
guard2 = guardgrp createUnit ["Exile_Guard_02", _pos ,[],0,"form"];
guard2 setDir 270;
guard2 setPosATL _pos;

_pos = [14737.639,17.91,16731.543];
guard3 = guardgrp createUnit ["Exile_Guard_03", _pos ,[],0,"form"];
guard3 setDir 270;
guard3 setPosATL _pos;

_pos = [14741.549,17.91,16731.746];
guard4 = guardgrp createUnit ["Exile_Guard_01", _pos ,[],0,"form"];
guard4 setDir 270;
guard4 setPosATL _pos;
};

Which called from an addAction command.

Everything else I'm adding to the script above is working, that means the commands are wrong.

I have no errors both in from the showScriptErrors and the RPT file.

I'd apperciate it if you help me to solve it :)

Share this post


Link to post
Share on other sites

The action is called by a client . So it will never be the server (if isServer). You have to remoteExec it in the addaction command.

( I didn't check the syntax, but it seems to me this may be the problem.)

Share this post


Link to post
Share on other sites

The action is called by a client . So it will never be the server (if isServer). You have to remoteExec it in the addaction command.

( I didn't check the syntax, but it seems to me this may be the problem.)

Hello, thanks for your response.

If I do remoteExec, won't it do the same action everytime a player joins the server?

Share this post


Link to post
Share on other sites

Sorry guys but when I read this... I see three elements in the _pos arrays and the third is not zero, so it seems you are creating the units 16731.408 meters over the terrain.... Not tested but, try to player setPos [14732.757,17.91,16731.408];

Share this post


Link to post
Share on other sites

Sorry guys but when I read this... I see three elements in the _pos arrays and the third is not zero, so it seems you are creating the units 16731.408 meters over the terrain.... Not tested but, try to player setPos [14732.757,17.91,16731.408];

Hello, thank you for your response.

Tried setPos to the unit's spawn coordinates, it didn't work.

Share this post


Link to post
Share on other sites

then the problem is at the coordinates....

 

Check the .rpt (google where is arma .rpt) and tell me what is says (if says something)

Share this post


Link to post
Share on other sites

Where are you getting to co-ords from.

I do remember that one method actually does it like this  x,z,y  or y,z,x either way you need x,y,z which is almost certainly what is happening as the last number is too large for a unit on the ground.

 

 

Also do you actually have the "Exile_Guard_01" they're not part of A3, if you don't have the addon that contains them nothing will be created. Try using a unit you know is in the original.

Share this post


Link to post
Share on other sites

If you look in mission.sqm they are in the wrong order for things like setpos or position.

 

so you can't just copy and paste them from mission.sqm

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  

×