Home   Help Search Login Register  

Author Topic: AI Spawn  (Read 2667 times)

0 Members and 1 Guest are viewing this topic.

Offline dale0404

  • Members
  • *
AI Spawn
« on: 04 May 2009, 21:54:20 »
 :-[

I have looked all over for a script or something that explains how I spawn new units in a mission and I cant find what I am looking for anywhere, can anyone help please?

What I need is for new units to spawn once other units have died or they spawn via the use of a trigger once a player crosses the line.

Also, how do I get enemy units to paradrop in from a heli or just from the sky?

Thanks in advance.

Dale

Offline sardaukar17

  • Members
  • *
Re: AI Spawn
« Reply #1 on: 07 Jun 2009, 09:34:13 »
I am no help here cause I have a similar problem.. Been at this for 4 days now... scripting for 4 days...  so be kind to me.

Like dale here I need AI to respawn, but I want the AI being respawned to be playable slots not filled by players during mp maps. The normal respawn in the description.sqs would work but I want it to be controlled by a radio trigger activated by the player... but only effect respawn of AI playable units..

Sounds complicated but this is the simple version or, for right now, all I need help with...

I need a way of basically doing this:

Winf1 setdamage 0;

lol sounds easy... This works fine on vehicals... but not on playable infantry. or.. atleast I can't get it to work. Most of what I have found in the forums is talking about nonplayable units.
This is what I have looped through the entire squad on both sides:

   
Code: [Select]
#w1
?! isFormationLeader player : goto "leader";
? (winf1 == player) : goto "w2";
?alive winf1: goto "w2";
winf1 setdamage 0;
winf1 setPos [getPos player select 0, getPos player select 1, getpos player select 2];
[winf1] join player;
goto "exit";


#w2
? (winf2 == player) : goto "w3";
? (alive winf2) : goto "w3";
winf2 setdamage 0;
winf2 setPos [getPos player select 0, getPos player select 1, getpos player select 2];
[winf2] join player;
goto "exit";

ignoring any issues you may see besides the "setdamage 0" line what am I doing wrong? How this currently behaves is a dead guy that appears under my feet upon activation of the radio command. every now and then he is alive just for a second and in the group.. but then dead again 1/2 second later.

----------------------------------------------------------------------------------------------
In regards to Dale I was flirting with just creating the new units on the radio trigger. I don't have the command lines I was using but it was centered around the createunit command there is also creategroup and createvehicle. You will need a list of unit, vehicle, and group names. here is a link to the command I looked at.

http://www.ofpec.com/COMREF/index.php?action=details&id=85

for the unit and vehical names:

http://community.bistudio.com/wiki/ArmA:_Weapons

I think most of it is there.. if not it will get you started. As far as the parachuting in... I haven't a clue. I am going to assume you would first have to equip them each with a parachute and then use the whole setpos array in a way that effects elevation???? but I am guessing.

Anyway dale lol if I helped at all I DEMAND a merit badge!!
« Last Edit: 07 Jun 2009, 09:48:36 by sardaukar17 »

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: AI Spawn
« Reply #2 on: 07 Jun 2009, 15:02:55 »
Yes, you can only repair vehicles with setDamage. No Lazarus in this game...

To spawn a new group, just use something like:
Code: (createEastInfantry.sqf) [Select]
// [getMarkerPos "markerToAppearAt"] execVM "createEastInfantry.sqf"
private ["_pos", "_group"];
_pos = _this select 0;

_group = createGroup east;
"SquadLeaderE" createUnit [_group, _pos, [], 0, "FORM"];
"SoldierEMedic" createUnit [_group, _pos, [], 0, "FORM"];
// etc...

A better way to generate AI squads, however, is to use an existing script, like DAC.
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline sardaukar17

  • Members
  • *
Re: AI Spawn
« Reply #3 on: 07 Jun 2009, 18:17:00 »
I was afraid of that. I appricate the help spooner

Offline sardaukar17

  • Members
  • *
Re: AI Spawn
« Reply #4 on: 10 Jun 2009, 20:04:14 »
On a side note I realized I can create the new units and rename them to the same names as the now destroyed units so that the rest of the script still works on the new units. Fake Lazarus.

In the init field of the createunit array you can enter ,Name=this, for anyone who might have had the same problem. "name" would be what ever name you want to give the unit.