A Community discussion forum for Halo Custom Edition, Halo 2 Vista, Portal and Halo Machinima

Home  Search Register  Login Member ListRecent Posts
  
 
»Forums Index »Halo Custom Edition (Bungie/Gearbox) »Halo CE Technical / Map Design »Random AI Spawns

Author Topic: Random AI Spawns (7 messages, Page 1 of 1)
Moderators: Dennis

austen1000
Joined: Sep 4, 2012


Posted: Sep 7, 2013 01:24 PM    Msg. 1 of 7       
Greetings. I was wondering, would it be possible to make a script or something that spawns random AI squads, like how AI spawn randomly in New Mombasa in Halo 3 ODST, including random dropships?


kirby_422
Joined: Jan 22, 2006

Apparently public enemy number 1?


Posted: Sep 7, 2013 03:39 PM    Msg. 2 of 7       
Theres a billion ways to do it, heres one example
(global short rnd 0)
(global ai encounter enc/squad0)
(script static void dropship_00
(object_create dropship_00)
(ai_place ai_dropship/squad00)
(vehicle_load_magic dropship_00 "" (ai_actors ai_dropship/squad00))
(recording_play_and_hover dropship_00 00_entry)
(sleep (+ (recording_time dropship_00) 90))
(unit_open dropship_00)
(sleep 30)
(vehicle_unload dropship_00)
(sleep 90)
(unit_close dropship_00)
(sleep 30)
(vehicle_hover dropship_00 0)
(recording_play_and_delete dropship_00 00_exit)
(set encounter ai_dropship/squad00)
)
(script continuous placing_random_ai
(set rnd (random_range 0 5))
(cond
((= rnd 0) (set encounter enc/squad0))
((= rnd 1) (set encounter enc/squad1))
((= rnd 2) (set encounter enc/squad2))
((= rnd 3) (set encounter enc/squad3))
)
(if (< rnd 4) (ai_place encounter)
(cond
((= rnd 4) (dropship_00))
;;Insert moarrr dropships here, after increasing random_range
)
)
(sleep_until (= (ai_living_count encounter) 0) 30)
)


casual mods
Joined: May 2, 2013

I be chillin


Posted: Sep 7, 2013 03:40 PM    Msg. 3 of 7       
it wouldnt be random in the sense of the game choosing when and what ai to place.

it would be alot of script checks for ai living count for each squad you create for the map.
and checks for which ai squad that is currently placed on the map
as well as how many ai are left in each squad before spawning the next.

really it would be a matter of pre planning squad spawn timing and ai living count
in a number of different ways using script checks.

and making it seem that the spawns are randomized...


kirby_422
Joined: Jan 22, 2006

Apparently public enemy number 1?


Posted: Sep 7, 2013 07:22 PM    Msg. 4 of 7       
If he uses what I already posted, its already randomly choosing what AI to place. If you want a random when, rather than death, then (sleep (random_range 0 1800)) instead of waiting until they're dead, and then it no longer even needs to track the encounters.


austen1000
Joined: Sep 4, 2012


Posted: Sep 8, 2013 10:39 AM    Msg. 5 of 7       
@kirby_422

Alright, I copied the script that you posted into a text document. I'll probably need to look over your scripting tutorial and the scripting bible to get a better understanding at what I am looking at. So, could I also use this method to spawn vehicles for the AI to drive? Also, what would a script look like if I were to have the random squad spawn like they were already on the ground and patrolling, with or without vehicles? I forgot to mention that I also want to make it so if you return to an area you previously fought in, another AI squad might spawn in the same place. Will this script let that happen?
Edited by austen1000 on Sep 8, 2013 at 11:37 AM


kirby_422
Joined: Jan 22, 2006

Apparently public enemy number 1?


Posted: Sep 8, 2013 12:09 PM    Msg. 6 of 7       
The script I posted places a new random AI every time the old ones have been killed. So, you can put a copy of that script for each area, then anytime you go to an area and clear it, that area will repopulate.

For spawning random vehicles, you'd also want to take into account including something like
(ai_vehicle_enterable_distance <unit> <real>)

Any of the vehicle_enterable commands, just to allow the AI hop in of their own free will.


austen1000
Joined: Sep 4, 2012


Posted: Sep 9, 2013 12:08 PM    Msg. 7 of 7       
@kirby_422

Alright, I bookmarked this thread so I can reference it in the future. Thank you for the help. Also, check your PM inbox.

 

 
Previous Older Thread    Next newer Thread







Time: Thu January 19, 2023 7:12 AM 297 ms.
A Halo Maps Website