Data Realms Fan Forums http://45.55.195.193/ |
|
The CC B30 AI and mods (how to make the AI use your weapons) http://45.55.195.193/viewtopic.php?f=1&t=32748 |
Page 1 of 1 |
Author: | Abdul Alhazred [ Sat Nov 24, 2012 1:57 pm ] |
Post subject: | The CC B30 AI and mods (how to make the AI use your weapons) |
The AI and Groups By adding your actors and weapons to certain groups in the ini-file you help the AI use them better. Code: AddToGroup = Light Infantry // mobile AHumans AddToGroup = Heavy Infantry // less mobile AHumans AddToGroup = Mecha // crabs with offensive capability AddToGroup = Anti-Air AddToGroup = Crates // drop-crates AddToGroup = Grenades // hand grenades AddToGroup = Payloads // bombs dropped from crafts AddToGroup = Primary Weapons // offensive weapons. the CPU-team actor's will select these if available in the actor's inventory AddToGroup = Secondary Weapons // self-defense weapons. very light sidearms AddToGroup = Light Weapons // primary weapons that does not restrict mobility much AddToGroup = Sniper Weapons // weapons with a high SharpLength and long range AddToGroup = Heavy Weapons // weapons that restrict mobility AddToGroup = Explosive Weapons // weapons with a blast radius All groups except Primary Weapons and Secondary Weapons can be combined. Example: a 10kg assault rifle should belong to both Primary Weapons and Light Weapons, but if it also have a huge SharpLength it may also be added to Sniper Weapons. Weapons Since v1.0 the AI looks at the projectile in the magazine and tries to calculate how to aim the weapon based on the projectile's properties. This means that if your weapon fires a null bullet (e.i. HitsMOs = 0) with a tiny life time, the AI will think that the weapon have a very short range. So if you make a lua-based weapons that does not use the projectile in the mag to do damage, you still have make the properties of the projectile in the mag similar to the properties of the lua-based attack. The script look at the following properties: Weapon.RateOfFire Round.FireVel Override by setting AIFireVel (in m/s) on the Round. Projectile.ClassName The AI may try to shoot through cover if MOPixel. Projectile.Mass Projectile.Sharpness Projectile.GlobalAccScalar Projectile.AirResistance Projectile.AirThreshold Projectile.Lifetime Override by setting AILifeTime (in ms) on the Round. If your weapon have an area effect you can set AIBlastRadius (in pixels) on the Magazine. Note that crabs still use the B29 AI scripts so they can only reliably use weapons with a flat trajectory. |
Author: | Arcalane [ Sat Nov 24, 2012 2:38 pm ] |
Post subject: | Re: The CC v1.05 AI and mods |
Regarding AI and Groups, do these various groups take priority over one-another, or should all the applicable groups be added? For instance, if I have a compact assault rifle, would it be a Primary Light weapon, or just a Light weapon compared to an assault rifle that would be a Primary weapon? Is a rocket launcher a Primary Heavy Explosive weapon, or just an Explosive weapon? etc. etc. Might be worth adding a 'Sniper Weapons' group as well, so actors know to switch to a different primary or a secondary if enemy actors are at very close range rather than trying to hit a close and mobile enemy with a slow-firing long-range weapon, unless they're scripted to do that already. Also, a tip for weapons; remember you can make projectiles not hit MOs, and give them very low sharpness. That should avoid any weirdness with invisible bullets shredding terrain and enemy actors taking more damage than expected, without interfering with the range/target-finding scripts. I think. |
Author: | Abdul Alhazred [ Sat Nov 24, 2012 2:55 pm ] |
Post subject: | Re: The CC v1.05 AI and mods |
Thanks for the feedback Arcalane, I will update the OP to answer your questions better. There actually is a Sniper Weapons group. I just forgot to add it. Unfortunately CC does not have any mechanisms to search the inventory exposed, so the AI can't reason all that much about when to use what weapon. |
Author: | weegee [ Sat Nov 24, 2012 3:52 pm ] |
Post subject: | Re: The CC v1.05 AI and mods |
Thanks for the info about projectiles, I was just wondering why in the hell AI don't shoot my Lua-based weapons )) To avoid any troubles with AI-code I've just attached all my scripts to actor's head, and then that scripts searched for it's parent actor during Create call. |
Author: | Shook [ Sat Nov 24, 2012 5:18 pm ] |
Post subject: | Re: The CC v1.05 AI and mods |
Good to hear, thanks for the heads up, and great job! Little question though, which properties does the AI look at when checking out the projectiles? LifeTime and FireVelocity are given, but what about GlobalAccScalar (for hitscan weapons)? I suppose it isn't that big a deal if you just up the FireVelocity enough, but it'd be nice to know. |
Author: | xenoargh [ Sat Nov 24, 2012 5:55 pm ] |
Post subject: | Re: The CC v1.05 AI and mods |
So, you guys basically copied the approach I used? Great, that's definitely the way to go. Has the load per AI thread decreased substantially? |
Author: | Abdul Alhazred [ Sat Nov 24, 2012 6:35 pm ] |
Post subject: | Re: The CC v1.05 AI and mods |
The script look at the following properties: Weapon.RateOfFire Round.FireVel Projectile.ClassName (if AEmitter: FireVel = max(FireVel, Sharpness) if MOPixel: the AI may try to shoot through cover) Projectile.Mass Projectile.Sharpness Projectile.GlobalAccScalar Projectile.AirResistance Projectile.AirThreshold Projectile.Lifetime |
Author: | Shook [ Sat Nov 24, 2012 6:54 pm ] |
Post subject: | Re: The CC v1.05 AI and mods |
Oh wow, that's pretty extensive! Thanks for the list. So let me get this straight, if the projectile's an AEmitter, it takes Sharpness for a fire velocity if it's higher than the actual fire velocity? Because if it does, that pretty much eliminates any problems that could arise from using an AEmitter to bypass recoil and what not, which saves me a lot of work. Awesome. |
Author: | Abdul Alhazred [ Sat Nov 24, 2012 8:53 pm ] |
Post subject: | Re: The CC v1.05 AI and mods |
Yes that is right. The sharpness thing is a bit of a hack really. If you just want to circumvent recoil you can use RecoilTransmission = [0..1] in the ini-file instead. The script is in the GetProjectileData function in HumanBehaviors.lua, by the way. Note that the ACrab-class does not have these functions exposed to lua (yet?) so crabs can only reliably use weapons with a flat trajectory. |
Author: | Asklar [ Tue Dec 18, 2012 4:23 am ] |
Post subject: | Re: The CC v1.05 AI and mods |
Ugh, this thread should have been stickied long ago! I didn't know why the AI wouldn't fire my AEmitter based weapons, but hopefuly I read this: Abdul Alhazred wrote: Projectile.ClassName (if AEmitter: FireVel = max(FireVel, Sharpness) if MOPixel: the AI may try to shoot through cover) |
Author: | Grimmcrypt [ Tue May 13, 2014 8:19 am ] |
Post subject: | Re: The CC v1.05 AI and mods |
I believe that this post should be bump up because it's pretty important. I just found it by mistake. This post should be linked in the first one where it say's Everything you need to know about Modding CC I already found so it doesn't matter to me but other people might not even Know about it. Just saying man, just saying. |
Author: | Apollon [ Tue May 13, 2014 9:39 pm ] |
Post subject: | Re: The CC B30 AI and mods (how to make the AI use you weapons) |
Yea this would have saved me hours last night. |
Page 1 of 1 | All times are UTC [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |