Jump to content
Sign in to follow this  
jnx

Graah I'm losing my mind with even the simplest of scripts

Recommended Posts

Please would someone tell me why this isn't working

_cdfGroup1 = createGroup West;
CdfMan1 = _cdfGroup1 createUnit ["CDF_SOLDIER_TL", getPos "cdfUral1", [], 0, "FORM"];
CdfMan2 = _cdfGroup1 createUnit ["CDF_SOLDIER", getPos "cdfUral1", [], 0, "FORM"];
CdfMan3 = _cdfGroup1 createUnit ["CDF_SOLDIER", getPos "cdfUral1", [], 0, "FORM"];
_cdfGroup1 moveInCargo "cdfUral1";

I've tried several variations but i just can't get this thing to work. I have a truck (cdfUral1) which i want to have troops in right away. This script is launched from the truck init field with

nul = [] execVM "grpspawn.sqf";

Im so noob with this shit :E

Share this post


Link to post
Share on other sites

Have you checked the .RPT file for what errors you are getting?

Are the troops created but not getting into the truck?

I believe the last line is incorrect, you could try something like:

{_x  moveInCargo cdfUral1;} forEach units _cdfGroup1;

* corrected code string

which will replace _x with a unit from the group _cdfGroup1 and iterate over each unit

Edited by jimbojones

Share this post


Link to post
Share on other sites

That probably would've been issue as well. But the beginning doesn't work either. The troops are not spawned :(

Share this post


Link to post
Share on other sites

whats the arma2.RPT say? If you cannt find it just use the windows search feature to find it....i believe its under Document & Settings\yourusername\Local Data\Application Data\ArmA2

Also, here are some examples

http://community.bistudio.com/wiki/createUnit

http://www.armaholic.com/page.php?id=4847

Edited by jimbojones

Share this post


Link to post
Share on other sites

1. You have a west center in the mission? ( createCenter - command) You need this if there's no west unit in the mission yet but you want to spawn them.

2. The create unit command syntax is different from yours.

_CdfMan1 = "CDF_SOLDIER_TL" createUnit [getPos cdfUral1, _cdfGroup1, "", 0];

3. If you're starting the script from the truck init line it's elegant to reference the truck object via this. This way the truck doesnt need a name:

nul = [this] execVM "grpspawn.sqf";

_truck = _this select 0;

_CdfMan1 = "CDF_SOLDIER_TL" createUnit [getPos _truck, _cdfGroup1, "", 0];
...

4. You can't use a group with moveincargo. Look up moveincargo in the biki.

Edited by ])rStrangelove

Share this post


Link to post
Share on other sites

If you haven't placed any enemy units on the map then before you start to fiddle arround with createCenter (you have to use setFriend too to make it actually work) simply place a CDF unit somewhere on the map, percentage 0. It's easier for a beginner.

One more thing...

getPos "cdfUral1" in the createUnit command doesn't work.

getPos cdfUral1 is correct.

Next:

{_x moveInCargo "cdfUral1";} forEach units _cdfGroup1

That won't work too. cdfUral1 is an object.

{_x moveInCargo cdfUral1} forEach units _cdfGroup1;

is the way to go.

Xeno

Share this post


Link to post
Share on other sites

... getPos "cdfUral1" ...

Looks like cargo cult cut'n'paste from the BIKI... ;)

You're trying to get the position of a string. This won't work. What you really want is to get the position of an object. So remove the double quotes.

Share this post


Link to post
Share on other sites

Great now it works. Thank you ppl :D

off to generate more questions. Fear not, next one won't be about a helicopter.

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  

×