Jump to content
Sign in to follow this  
davewave

Should be easy, not working: createUnit

Recommended Posts

Hi all,

I'm about to give up and I've trawled this site and tried different code and no success. I don't move on in complexity until i can get the simple things working:

in a file called spawn1.sqs:

_grp1 = createGroup west;

_man1 = _grp1 createUnit ["SoldierWB", getMarkerPos "base", [], 0, "CAN_COLLIDE"];

I exec this inside the game using the [] exec "spawn1.sqs" on "RADIO ALPHA".

I have a marker named "base"

Yet, no man/soldier appears! I'm racking my brain and I can't get this simplest of things to work. please help

Share this post


Link to post
Share on other sites

Take a look at your RPT file. There's an error message waiting for you. ;)

In "plain" English:

"SoldierWB" does not contain enough information to be created. It's incomplete.

You've basically tried to create "the blurry idea of a western soldier". Be a bit more specific. Try "USMC_Soldier" instead.

Share this post


Link to post
Share on other sites

no offence, but that was the most unhelpful reply I've received on a forum.

I copied that code STRAIGHT from someone elses forum post in which several others confirmed the code to run properly.

Perhaps I didn't clarify enough.

I'm running ARMA 2 OA (I dont own ARMA 2 so I don't have the classes/objects from that game).

Please help me with the following:

1) The code needed to create a unit from thin air.

2) Somewhere I can find all the internal references to the many objects in the game that can be created.

---Edit---

And one other thing I need strong clarification on:

1) How do I find the NAME of a GROUP

2) How Can I create a group and add units to it.

3) Why don't I see group names/references in the mission.sqm anywhere?

And one more thing:

4) If the leader of that group (say a1) dies, and you create a unit as part of that group, how do you then get the new guys group ID/name?

5) The game only seems to allow me to create a unit and add it to an existing group, but the "createGroup" command does jack all.

This would probably do it.

Regards

David

Edited by davewave
Need clarify

Share this post


Link to post
Share on other sites

http://www.armatechsquad.com/ArmA2Class/

But he's right, "SoldierWB" isn't a unit, it's a units base class (or, one of them). All western units isKindOf "SoldierWB" (same as all soldier units isKindOf "man" - see where this is going?), so without having checked your code, all you need to do is find a unit class you can create (from list I gave you).

Share this post


Link to post
Share on other sites
http://www.armatechsquad.com/ArmA2Class/

But he's right, "SoldierWB" isn't a unit, it's a units base class (or, one of them). All western units isKindOf "SoldierWB" (same as all soldier units isKindOf "man" - see where this is going?), so without having checked your code, all you need to do is find a unit class you can create (from list I gave you).

Ok, this time please read my post above and answer the questions.

Also, I've figured out that by adding a unit in the editor, i can then open up the mission.sqm file to find out that units unique code without the need for that website.

Please, how do I create a unit!! you still haven't answered me!

Ok look at this in my sqs file:

f1 = createGroup west;

"US_Soldier_EP1" createUnit [getMarkerPos "base", group f1];

whats wrong with this then ey?

Share this post


Link to post
Share on other sites

With such a language I won't answer any question.

I'm (we) are not your private support team.

AND:

1) You are in the wrong forum thread. This is for "Addons", not for mission editing / scripting questions. For scripting questions please use: ArmA 2 & OA - MISSION EDITING & SCRIPTING

2) Read the forum rules, please!

Edited by HeliJunkie

Share this post


Link to post
Share on other sites

We all know how annoying it can be when stuff does not work the way we expect it to work. Keep cool.

1. The snippet with the "SoldierWB" was probably for A1. From what I saw it was possible to create them in A1. This is not possible in A2 anymore.

2. Just a guess: If you don't have any other WEST units in your mission, you have to create a so called "Center" first. Every side (west, east, civilian, etc.) requires such a center before any units can be created. Without a center creating groups or units for that side will simply fail without any error message (I think we've all been bitten by that). You can create a center with the createCenter command.

The following works for me:

createCenter west;
wgroup1 = createGroup west;
dude = "US_Soldier_EP1" createUnit [getMarkerPos "base", wgroup1];

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  

×