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 General Discussion »AI weapon switch without using actor transformations

Author Topic: AI weapon switch without using actor transformations (10 messages, Page 1 of 1)
Moderators: Dennis

JadeMcLain
Joined: Nov 13, 2018


Posted: Mar 10, 2019 10:31 AM    Msg. 1 of 10       
Not sure there are limits to how many actors you can transform, but using recorded anims can make named bipeds switch weapons.


(script continuous ai_switchwep
(if (<= (objects_distance_to_object m0 (unit (list_get (ai_actors floods) 0))) 5)
(begin
(recording_play m0 wepswitch)
(sleep -1)
)
)
)


https://www.youtube.com/watch?v=dgaOdMih4rk

you could have the marine use a sniper for distant enemies, the assault rifle for medium range, and the shotgun when it comes up close
Edited by JadeMcLain on Mar 10, 2019 at 01:21 PM


DeadHamster
Joined: Jun 8, 2014


Posted: Mar 10, 2019 10:36 AM    Msg. 2 of 10       
Well that's pretty interesting.

Edit: Apparently, taking the firing values into consideration is pretty necessary. If it's setup to be an AR for example and switches to a shotgun, that's going to be wonky.
Edited by DeadHamster on Mar 10, 2019 at 10:37 AM


JadeMcLain
Joined: Nov 13, 2018


Posted: Mar 10, 2019 01:27 PM    Msg. 3 of 10       
Quote: --- Original message by: DeadHamster

Well that's pretty interesting.

Edit: Apparently, taking the firing values into consideration is pretty necessary. If it's setup to be an AR for example and switches to a shotgun, that's going to be wonky.
Edited by DeadHamster on Mar 10, 2019 at 10:37 AM


Thats true, I edited the main post. The sniper AI for example would still behave like a sniper, so it would be best to give him his own setup. They would switch only when necessary, and would switch back to their default weapons after. So if a flood or whatever came up close to bother the sniper, he would pull out his shotgun and blast it, then go back to using the sniper.

We could also just migrate them to an encounter based on their weapon.
Edited by JadeMcLain on Mar 10, 2019 at 01:27 PM


DeadHamster
Joined: Jun 8, 2014


Posted: Mar 10, 2019 03:27 PM    Msg. 4 of 10       
Quote: --- Original message by: JadeMcLain
We could also just migrate them to an encounter based on their weapon.
Edited by JadeMcLain on Mar 10, 2019 at 01:27 PM



That seems the best choice. At least for me, with the setup I'm currently running. Watching the AI just unload with the sniper in the beginning, while humorous, is not good for gameplay.

I already have a RA for switching weapons on the player in Mombasa, which is used for the Weapon Armory. So I'm highly interested in something like this, that could be implemented so seamlessly.

I'd be looking to have Elites and Brutes switch from Carbines to PRs or Energy Swords once their AI encounters got below a certain threshold. Basically they no longer have support to utilize range, and now need to switch to attacking directly.



BTW, how are you giving the AI a second weapon to start with?
Edited by DeadHamster on Mar 10, 2019 at 03:31 PM


JadeMcLain
Joined: Nov 13, 2018


Posted: Mar 10, 2019 05:26 PM    Msg. 5 of 10       
Quote: --- Original message by: DeadHamster

Quote: --- Original message by: JadeMcLain
We could also just migrate them to an encounter based on their weapon.
Edited by JadeMcLain on Mar 10, 2019 at 01:27 PM



That seems the best choice. At least for me, with the setup I'm currently running. Watching the AI just unload with the sniper in the beginning, while humorous, is not good for gameplay.

I already have a RA for switching weapons on the player in Mombasa, which is used for the Weapon Armory. So I'm highly interested in something like this, that could be implemented so seamlessly.

I'd be looking to have Elites and Brutes switch from Carbines to PRs or Energy Swords once their AI encounters got below a certain threshold. Basically they no longer have support to utilize range, and now need to switch to attacking directly.



BTW, how are you giving the AI a second weapon to start with?
Edited by DeadHamster on Mar 10, 2019 at 03:31 PM


Bipeds can be given two weapons, but spawned actors only have one. You would need to name bipeds and attach them with AI for this way to work.


DeadHamster
Joined: Jun 8, 2014


Posted: Mar 10, 2019 10:11 PM    Msg. 6 of 10       
Quote: --- Original message by: JadeMcLain
Bipeds can be given two weapons, but spawned actors only have one. You would need to name bipeds and attach them with AI for this way to work.


Oh that's incredibly unfortunate.


JadeMcLain
Joined: Nov 13, 2018


Posted: Mar 11, 2019 02:06 AM    Msg. 7 of 10       
Quote: --- Original message by: DeadHamster
Quote: --- Original message by: JadeMcLain
Bipeds can be given two weapons, but spawned actors only have one. You would need to name bipeds and attach them with AI for this way to work.


Oh that's incredibly unfortunate.


Its unfortunate but doable for me. I'm still looking for a way to give actors more weapons.

Edited by JadeMcLain on Mar 11, 2019 at 02:54 AM


DeadHamster
Joined: Jun 8, 2014


Posted: Mar 11, 2019 06:57 AM    Msg. 8 of 10       
player_add_equipment doesn't seem to impact AI units as far as I could tell, but I only tried it in Sapien and I wasn't able to use unit_kill either.

(unit (list_get (ai_actors test) 0))

Was how I got to the unit itself. Might not work for all functions, I was able to verify the health was 1 instead of -1, but again direct commands didn't seem to affect him. Might've been a Sapien thing, didn't care enough to keep looking.


JadeMcLain
Joined: Nov 13, 2018


Posted: Mar 11, 2019 10:46 AM    Msg. 9 of 10       
Quote: --- Original message by: DeadHamster
player_add_equipment doesn't seem to impact AI units as far as I could tell, but I only tried it in Sapien and I wasn't able to use unit_kill either.

(unit (list_get (ai_actors test) 0))

Was how I got to the unit itself. Might not work for all functions, I was able to verify the health was 1 instead of -1, but again direct commands didn't seem to affect him. Might've been a Sapien thing, didn't care enough to keep looking.


Was thinking of having the actor spawn a biped from an effect, giving that biped an effect that damages, using recent_damage.unit from opensauce to detect when the actor is damaged, and then attaching AI to the detected biped.

So basically the encounters actors will spawn bipeds and attach AI to them, then delete themselves.

EDIT: It turns out spawned actors can have more than one wep. I will post more on this. It just seems to work. I took away the weapon in the actor tag so it uses the biped weapons. I think the marine major upgrade or something was screwing with me because it just works now.
Edited by JadeMcLain on Mar 12, 2019 at 09:22 AM


Spartan314
Joined: Aug 21, 2010

Former biped rigger & FP animator


Posted: Mar 13, 2019 04:49 AM    Msg. 10 of 10       
Bump for updates

 

 
Previous Older Thread    Next newer Thread







Time: Mon March 25, 2019 5:03 PM 390 ms.
A Halo Maps Website