Jump to content
Sign in to follow this  
thetrooper

Spawn unit & at elevation.

Recommended Posts

Hi all,

1. can someone tell me what the class is for an opfor rifleman? Also, I'm looking under cfg vehicles and can't find it

2. Because its a spawned unit, how do I give him an elevation? This is so I can put him on a roof.

On top of that, this doesn't seen to be working.

O_Soldier_F = "en3_1" createVehicle markerPos "en3_1pos";

Any ideas?

Edited by TheTrooper

Share this post


Link to post
Share on other sites
_unit = "O_Soldier_F" [url="https://community.bistudio.com/wiki/createUnit"]createUnit [/url]markerPos "en3_1pos", _groupName;
_unit setPos [getPos _unit select 0, getPos _unit select 1, 50];

Edited by cobra4v320

Share this post


Link to post
Share on other sites

This bit in itself isn't working for some reason. ?

_unit = "O_Soldier_F" createUnit markerPos "en3_1pos", _groupName;

Edited by TheTrooper

Share this post


Link to post
Share on other sites

using createUnit;

_unit = "O_Soldier_F" createunit [markerPos "en3_1pos", _groupname];

using createuinit array

_unit = _groupname createunit ["O_Soldier_F", makerpos "en3_1pos", [],0,"NONE"];

Decide on which command you are going to use, createunit array is a more recent command and is much more efficient. Either way, you need to have created a group beforehand.

Share this post


Link to post
Share on other sites

ok, still not working so I'm doing something wrong.

I've set up a trigger so if something is present then execute a sqf file with the following below: (Have a marker called en3_1pos)

_unit = "O_Soldier_F" createunit [markerPos "en3_1pos", _groupname];

No joy...

I would kind of expect a unit to appear?

Share this post


Link to post
Share on other sites
ok, still not working so I'm doing something wrong.

I've set up a trigger so if something is present then execute a sqf file with the following below: (Have a marker called en3_1pos)

_unit = "O_Soldier_F" createunit [markerPos "en3_1pos", _groupname];

No joy...

I would kind of expect a unit to appear?

Check out the example at the bottom of the page:

https://community.bistudio.com/wiki/createUnit_array

Share this post


Link to post
Share on other sites

ok, well for a test, I got this...

_grp = createGroup west;
unit = _grp createUnit ["B_sniper_F", position player, [], 100, "FORM"] ;

How is this straight from an example and still not working?

Share this post


Link to post
Share on other sites

what exactly do you mean by not working?

does it give an error? I notice that the sniper is in a 100m radius. For testing, I'd move him closer in.

Also, are you using the showscripterrors switch in your game?

http://forums.bistudio.com/showthread.php?121163-Script-not-working-Use-the-showScriptErrors-parameter!

Share this post


Link to post
Share on other sites

ok, well this is basically the simple script that I want to use.

_group = createGroup east;
_unit = "O_Soldier_F" createUnit markerPos "en3_1pos", _group;

My unit simply isn't there :confused:

should happen straight away

Share this post


Link to post
Share on other sites

is the script actually running, I don't know why but if my mission can't find the script.sqf file I don't get an error just that nothing happens.

Share this post


Link to post
Share on other sites

yes, I've run a hint underneath the script and the hint displays

I have spawned vehicles before, but I've never managed to do a unit. Why I have no idea

Here is the file. If anyone can work it out then great. I can't

https://www.mediafire.com/?g5ztw549i0y992a

Edited by TheTrooper

Share this post


Link to post
Share on other sites

Sorry forgot the brackets [].

_unit = "O_Soldier_F" createUnit [markerPos "en3_1pos", _groupName];

Share this post


Link to post
Share on other sites

We're IN!!! Thanks Cobra ;) My first unit has spawned!

---------- Post added at 09:15 PM ---------- Previous post was at 09:03 PM ----------

New question.

Trying to dress him up. Not able to dress him up.

en3_1Grp = createGroup east;
en3_1 = "O_Soldier_F" createUnit [markerPos "en3_1pos", en3_1Grp];

sleep 1;

removeheadgear en3_1;
removegoggles en3_1;
dostop en3_1;
removeallweapons en3_1;
removeallassigneditems en3_1;
removeuniform en3_1;
removevest en3_1;
removebackpack en3_1;
en3_1 adduniform "U_IG_Guerilla3_2";
en3_1 addmagazine "30Rnd_65x39_caseless_green";
en3_1 addmagazine "30Rnd_65x39_caseless_green";
en3_1 addweapon "arifle_Katiba_F";

hint "code working";

Share this post


Link to post
Share on other sites

Don't use the old createunit it causes all sorts of issues the main one being that en3_1 isn't the name of the unit. It doesn't seem to contain anything and can be left off.

use this instead.

en3_1 = en3_1Grp createUnit ["O_Soldier_F",markerPos "en3_1pos",[],0,"CAN_COLLIDE"];

Edited by F2k Sel

Share this post


Link to post
Share on other sites

Im not sure of what the hell is wrong with that file you sent. I could not get any units to spawn in that file. Delete the mission file and start a new one.

This worked fine for me.

_group = createGroup east; 
_unit = _group createUnit ["O_Soldier_F", markerPos "spawnMrk", [], 0, "FORM"];

removeHeadgear _unit; 
removeGoggles _unit; 
removeAllWeapons _unit; 
removeAllAssignedItems _unit; 
removeUniform _unit; 
removeVest _unit; 
removeBackpack _unit; 

_unit adduniform "U_IG_Guerilla3_2"; 
_unit addmagazine "30Rnd_65x39_caseless_green"; 
_unit addmagazine "30Rnd_65x39_caseless_green"; 
_unit addweapon "arifle_Katiba_F"; 


hint "code working";

Share this post


Link to post
Share on other sites

Thanks for your help guys. Took a while but got there. That opens some new doors.

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  

×