Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
Sign in to follow this  
lorlkoy

about spawn AI question

Recommended Posts

Hi !

This script is used in the AA1.

but i want used to AA2 .

I tried to use, but the AI can only be spawn once.

anyone help me ,much thanks!

1.Create east side unit(init:RandomGroup=Group this;deleteVehicle this;)

2.add trigger(name:RandomZone).

(On Activation:[player,RandomZone,20,50,"east",RandomGroup,9,"aware","full",100] exec "Random.sqs")

;Random.sqs-->

[RandomCentre,RandomZone,NearestDistance,FarestDistance,Side,RandomGroup,RandomNumber,"Behaviour","Speed",EndKill] exec

"Random.sqs"

_Centre = _this select 0

_RandomZone = _this select 1

_Nearest = _this select 2

_Farest = _this select 3

_Side = _this select 4

_RandomGroup = _this select 5

_Num = _this select 6

_behaviour = _this select 7

_speed = _this select 8

_Death = _this select 9

_Range = _Farest - _Nearest

_Count = 0

_kill = 0

#NewCentre

~3

?(!randomOn):hint "Random Off";

_x = getPos _Centre select 0

_y = getPos _Centre select 1

_z = getPos _Centre select 2

#ChooseX

_YesNo = random 1

?(_YesNo <= 0.5):goto "Right"

?(_YesNo >= 0.5):goto "Left"

hint "Random X Error"

#Right

_Xu = _x + _Nearest + random _Range

goto "ChooseY"

#Left

_Xu = _x - _Nearest - random _Range

goto "ChooseY"

#ChooseY

_YesNo = random 1

?(_YesNo <= 0.5):goto "Up"

?(_YesNo >= 0.5):goto "Down"

hint "Random Y Error"

#up

_Yu = _y + _Nearest + random _Range

goto "ChooseType"

#down

_Yu = _y - _Nearest - random _Range

goto "ChooseType"

#ChooseType

_Pickup = random 9

?(_Pickup <= 1 && _side== "east"):goto "EB"

?(_Pickup <= 1 && _side == "west"):goto "WB"

?(_Pickup <= 2 && _side == "east"):goto "ESP"

?(_Pickup <= 2 && _side == "west"):goto "WSP"

?(_Pickup <= 3 && _side == "east"):goto "EAR"

?(_Pickup <= 3 && _side == "west"):goto "WSF"

?(_Pickup <= 4 && _side == "east"):goto "EAT"

?(_Pickup <= 4 && _side == "west"):goto "WAT"

?(_Pickup <= 5 && _side == "east"):goto "EMED"

?(_Pickup <= 5 && _side == "west"):goto "WMED"

?(_Pickup <= 6 && _side == "east"):goto "EMG"

?(_Pickup <= 6 && _side == "west"):goto "WMG"

?(_Pickup <= 7 && _side == "east"):goto "EAA"

?(_Pickup <= 8 && _side == "east"):goto "EGL"

?(_Pickup <= 9 && _side == "east"):goto "EFN"

hint "Random Type Error"

#EB

_type = "TK_INS_Soldier_TL_EP1"

goto "Create"

#ESP

_type = "TK_INS_Soldier_Sniper_EP1"

goto "Create"

#EAR

_type = "TK_INS_Soldier_AR_EP1"

goto "Create"

#EAT

_type = "TK_INS_Soldier_AT_EP1"

goto "Create"

#EMED

_type = "TK_INS_Bonesetter_EP1"

goto "Create"

#EMG

_type ="TK_INS_Soldier_MG_EP1"

goto "Create"

#EAA

_type ="TK_INS_Soldier_AA_EP1"

goto "Create"

#EGL

_type ="TK_INS_Soldier_2_EP1"

goto "Create"

#EFN

_type ="TK_INS_Soldier_4_EP1"

goto "Create"

#WB

_type = "US_Delta_Force_Assault_EP1"

goto "Create"

#WSP

_type = "US_Delta_Force_Assault_EP1"

goto "Create"

#WSF

_type = "US_Delta_Force_Assault_EP1"

goto "Create"

#WAT

_type = "US_Delta_Force_Assault_EP1"

goto "Create"

#WMED

_type = "US_Delta_Force_Assault_EP1"

goto "Create"

#WMG

_type ="US_Delta_Force_Assault_EP1"

goto "Create"

#Create

_bornZone = [_Xu,_Yu,0]

_type CREATEUNIT [_bornZone,_RandomGroup,"",0.55,"private"]

_RandomGroup setBehaviour _behaviour

_RandomGroup setSpeedMode _Speed

_RandomGroup move [_Xu + random _Farest,_Yu + random _Farest,0]

_Count = _Count + 1

~3

"if (getPos _x select 2<-1) then {deleteVehicle _x; _Count = _Count - 1}" ForEach Units _RandomGroup

?(_Count < _Num):goto "NewCentre"

#ReCount

"if (!Alive _x) then {_Count=_Count-1; _kill=_kill+1; hint format [{%1 %2 %3},_side,_kill,{killed}]; [_x] join grpNull}"

ForEach Units _RandomGroup

"if (_Centre Distance _x > _Farest+20) then {deleteVehicle _x; _Count=_Count-1}" ForEach Units _RandomGroup

?(_kill >= _Death):hint "Area cleared"; exit

?(!(_centre in list _RandomZone) && !(Vehicle _centre in list _RandomZone)):exit

#CountNum

?(_Count < _Num ):goto "NewCentre"

goto "ReCount"

Share this post


Link to post
Share on other sites

Might want to rewrite the script in .sqf.

Share this post


Link to post
Share on other sites
Sign in to follow this  

×