Jump to content
Sign in to follow this  
dummy_01

Which side is GameLogic? Trying to spawn a hostile soldier.

Recommended Posts

I have a script that spawns a single OPFOR soldier with location determined by a gamelogic.

spawn.sqs:

_unit1 = "RUS_Soldier1" createUnit [position GL, group GL];

exit

GL is the name of a gamelogic (gamelogic-object-gamelogic) I placed on the map where I want the soldier to appear.

I use a trigger to call the script. Condition: BLUFOR present. And on activation: [] exec spawn.sqs

Now everything works fine. The BLUFOR soldier runs in to the trigger area and the OPFOR soldier is spawned. But he only stands there. He dosen't attack. Not even if you shoot him.

I notice that the text that identifies the spawned soldier is yellow. An OPFOR usually has red text, and BLUFOR has green. What does yellow mean?

As an experiment I placed an OPFOR soldier named GL on the map instead of the gamelogic. Then the spawned soldier was hostile to BLUFOR and the text was red. I then placed a BLUFOR soldier named GL on the map instead of the gamelogic. Then the spawned soldier was hostile to OPFOR and the text was green. This leads me to belive that spawned soldiers inherit side from the group the belong to.

So, what side is gamelogic? Can you decide what side you want it to be?

I tried to put this in the gamelogics init field:

East = side this

and

East = side GL

but both returned the message

missing  ;

:(

I also tried

GL setFriend [WEST,0]

Still with no success.

I don't think that this is a HQ center thing. There is already both OPFOR and BLUFOR soldiers on the map before spawn time.

I would appreciate any help on this.

Share this post


Link to post
Share on other sites

Civ if anything. The thing to remember is if there are no units of a side on the map you need to create a "center" first for them to be able to spawn.

Easiest way is via placing a single OPFOR unit anywhere on the map, with a Condition of Presence of 0% and that'll do it.

Or else you can script the whole createCenter commands and stuff.

Share this post


Link to post
Share on other sites

Thanks, but I don't think the problem is caused by a lack of command center. There is already both OPFOR and BLUFOR soldiers on the map before the spawn takes place.

Share this post


Link to post
Share on other sites

Gamelogic is a special side. Don't use it.

Spawn your soldier into a different (East) group. If a suitable one does not exist, create one.

Share this post


Link to post
Share on other sites

How can I spawn him into another east group and still acomplish what I want? I want just one soldier. Not two or more. :(

Share this post


Link to post
Share on other sites

spawn.sqf:

_grp = createGroup east;
_unit = "RUS_Soldier1" createUnit [position GL, _grp];

This will create a new eastern group and spawn 1 single soldier into it at the position of your gameLogic called "GL"

Share this post


Link to post
Share on other sites

Thanks, but I'm sorry. That didn't work. :(

Still yellow text. Still not attacking BLUFOR.

I also tried to give position with a marker instead of gamelogic:

spawn.sqs

_grp = createGroup east;
_unit = "RUS_Soldier1" createUnit [getMarkerPos "marker1", _grp];
exit

...but with same result.

Does the script above work for others?

Share this post


Link to post
Share on other sites

Yellow text? What?

The code i posted above works for me in ArmA2. How far away are you creating this guy? If it's too far away your player might not know about it (even though you the human can clearly see him) and mark it as a generic "Man", with a yellow icon. If you're not making noise than it might not attack you either.

Move the marker or gamelogic directly in front of your player and try it again.

Share this post


Link to post
Share on other sites

On the subject of spawning I have a problem when using the first of these spawns.

_unit = "RU_Soldier_AR" createUnit [position _pos, _grp,"", 0.5, "Private"];

_unit = _grp createUnit ["RU_Soldier_AR", getPos _pos, [], 0, "FORM"]

Both create a unit but only the second one will allow me to manipulate it using the _unit variable.

After creating the uint I place _unit setdamage 1 only the unit created in the second script will die.

I'm not creating two units in the script I'm using one or the other.

Share this post


Link to post
Share on other sites
_unit = "RU_Soldier_AR" createUnit [position _pos, _grp,"", 0.5, "Private"];

This version of the command will not return a the unit. This is the old syntax from OFP, shouldn't use it anymore.

Share this post


Link to post
Share on other sites

Yellow text, what do I mean? This:

hsp72t.jpg

This OPFOR soldier was spawned in ArmA 2 editor using:

_grp = createGroup east;
_unit = "RUS_Soldier1" createUnit [position GL, _grp];
exit

where GL is the name of a game logic.

I am standing in front of the OPFOR and he does not attack. Not even if I shoot his leg.

But if it works in ArmA 2 for you, kylania, then that is helpful anyway. Then I know my problem is not the code, but to be found elsewhere. I'll be tinkering some more with this. Spawning a single soldier can't be THAT hard! I'll post my results in this thread should I succeed. Then maybe som other newbie can avoid doing the same mistake.

Also, I didn't know the syntax had changed. So thanks, BigDawg, I will experiment some with the new syntax as well. I have seen something looking like what F2k Sel wrote in other forum posts, when looking for some code to steal.

I've read Mr. murrays guide, and learned a lot from this forum post /tutorial: http://www.armaholic.com/forums.php?m=posts&q=7329

...but it appears syntax has changed since then.

Share this post


Link to post
Share on other sites

Try this:

_grp = createGroup east;
_unit = _grp createUnit ["RUS_Soldier1",position GL,[],0,"NONE"];

The syntax you used would not assign the new unit to the _unit variable anyway. Also it appears you are using SQF syntax, which means you don't need the exit.

Share this post


Link to post
Share on other sites

I was originally using SQS, as found in mr Murrays editing guide. Then after reading lots of forum posts I started mixing it (not knowing there was a difference).

When I get home I will rename my script file spawn.sqf and copy and paste your code.

Once again, thank you!

Share this post


Link to post
Share on other sites

YES! That worked!

The ArmA 2 community is so great. I knew nothing about editing a few months ago. But now I actually enjoy playing around in the editor more than playing the game.

If the mission I'm working on is ever released it sure will have a long list of names in the aknowledgement section. Big Dawg KS beeing on top of that list. This isn't the first time you have solved editing problems for me. Thank you so much!

..off to editing now. :)

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  

×