Home   Help Search Login Register  

Author Topic: Creatunit with ai  (Read 1007 times)

0 Members and 1 Guest are viewing this topic.

chill

  • Guest
Creatunit with ai
« on: 23 Sep 2002, 02:40:47 »
Any one know if the command creatunit can make a tank with the ai? I want to make tanks respawn with ai already in their positions eg gunner, driver ,commander. Is their a way to do it without assigning them to a empty vehicle?

chill

  • Guest
Re:Creatunit with ai
« Reply #1 on: 23 Sep 2002, 09:26:37 »
I have the scripts By Backoff & DeaDMeaT Productions but i cant seem to delete the tanks and then get them to respawn. Any one know how? Heres a script but doesnt seem to work!


#start

~random(5)
[EastT80Squad, getpos EastStart, groupCharlie, groupDelta, "none", 1, "Corporal"] exec "createsquad.sqs"
CreateSquadRunning = true
@!CreateSquadRunning
_leader = NewSquad select 0
group _leader move getpos destination
"_x allowfleeing 0" foreach _units
goto "loop"

#loop
? NOT(alive player): exit
?(("Alive _x" count units _group) == 0): goto "here"
_group move getpos destination
~random(3)
goto "loop"

#here

~random(4)
"deletevehicle _x" foreach _units
goto "start"
;-----------------------------------------------------------
« Last Edit: 23 Sep 2002, 10:14:31 by chill »

CrashnBurn

  • Guest
Re:Creatunit with ai
« Reply #2 on: 23 Sep 2002, 12:01:21 »
Thats one of my scripts, although its been modified somewhat. Here's an alternative way to create a tank with crew and check the moving and firing capability of the tank, and then delete it when it's disabled and create a new one. It uses 2 scripts, but all you have to do is call the first one. This is for a single tank with crew. Check this out-

;-----------------------------------------------------------
;start of script 1
~random(10)
[T80, getpos gamelogic1, groupCharlie, groupDelta, "mount", 1, "Sergeant"] exec "createsquad.sqs"
CreateSquadRunning = true
@!CreateSquadRunning
_leader = NewSquad select 0
group _leader move getpos destination
[NewVcl select 0] exec "checkt80.sqs"

exit
;end of script 1
;-----------------------------------------------------------

;-----------------------------------------------------------
;start of script 2
_vcl = _this select 0
_group = _this select 1
_crew = units _vcl
"_x allowfleeing 0" foreach _crew

goto "loop"

#loop

? NOT(alive player): exit
?(("Alive _x" count units _group) == 0): goto "here"
? NOT(canfire _vcl): goto "here"
? NOT(canmove _vcl): goto "here"
~random(5)
goto "loop"

#here

_vcl setdammage 1
~random(3)
"deletevehicle _x" foreach _crew
~10
deletevehicle _vcl
[] exec "t80.sqs"

exit
;end of script 2
;-----------------------------------------------------------

Name the first script "t80.sqs" and the second script is called "checkt80.sqs". When the tank is deleted, it calls the first script again to create a new one and repeats.....
In the init.sqs you'll need this line for the first script to work- T80 = [["T80",1,"vcl"]]
The t80 tank should already be defined in the vclclass.sqs

« Last Edit: 23 Sep 2002, 12:13:40 by CrashnBurn »

chill

  • Guest
Re:Creatunit with ai
« Reply #3 on: 23 Sep 2002, 13:11:35 »
Thank you so much!!! :D Any chance it can be only one script as i would like to make M1, Bmp ect respawn?
« Last Edit: 23 Sep 2002, 16:52:10 by chill »