A Unity ID allows you to buy and/or subscribe to Unity products and services, shop in the Asset Store and participate
in the Unity community.
Discussion in 'Works In Progress' started by squared55, Mar 2, 2015.
How Can I integrate it with opsive's Third person controller?
This is just not work. AI just stand like an idiot and do nothing. Where is normal melee behavior?!
While I don't offer any official support for Opsives TPC, I believe there was a user who posted a video where he explained his integration set-up a few pages back.
Beyond the rigging/preparation stuff listed before, you'll want to set your agent's combat behavior to Berserker in order to make them charge the enemies (in the base script).
Also, increasing the melee range (which often has to be larger than it might first appear) and decreasing the min dist to enemy out of cover setting (also in the base script) may help. And, of course, make sure you've enabled melee.
Are you getting any errors?
I am using the Realistic FPS Prefab and have extended its AI to be fairly decent for my needs, I am currently only using it for the melee AI's tho , I have some ranged AI but i purchased your package specifically for the advanced ranged combat tactics and all, I got this today and i am still wrapping my head around the workflow but basically i followed your guide to setup a new AI character.
I have one annoying problem though.. When starting the scene i see my character running around and firing at me. I still want to play with tweaking the animation because the skating annoys me but before i can get to that i need to solve another problem.
When starting the scene i can see the player run and the animations working... but only in the beginning, after about a couple of seconds the animations stop working and it sits in Idle animation only whilst still moving around and shooting me.. There is no errors.. I start the game, the movement animations works, but after a couple of seconds he just stays in idle animation and slides all over the place.
Its almost like it just starts to ignore the animation states after a couple of seconds.. .what could this be? I can take a video if you like..
The AI itself is pretty awesome tho, They gun play mechanics and spot checking/dynamic features are pretty cool. Do you have support for this with Root Motion animation?
Is there anyw ay to interface this with A* pathfinding instead of just the navmesh? Unity's navmesh is far inferior to the a* pathfinding.
Is there anyway I can try a demo before I buy? (RFPS)
All the interaction with the navmesh is done via a separate class.script. You can modify the code in each of this classes's method so that they work with A* instead of Unity's navmesh (although I think it's gotten a lot better with the last update.)
Sure, here's an demo where I integrated the package with RFPS (the previous version- I see they recently updated the package so I might need to make a few tweaks- but I imagine things should be pretty much the same):
The RFPS player is messed up? For some reason, importing TSAI into a project with RFPS in it removes all the animations called "run" from the RFPS animators (I have no idea why this happens). Simply replacing the animations should solve the issue.
And unfortunately (with the exception of a few contextual animations) root motion isn't supported at this time.
Is there anyw ay to interface this with A* pathfinding instead of just the navmesh? Unityadfasf
Thank you for respdonding!
I've been working in your demo1 and demo2 map and i've encountered a problem where no one's bullets hit each other.
People only die by grenade.
Sounds like an issue with the layermasks on the bullets.
Hi - so you were right, the layermask was set to nothing in the bullets, so I put them on the default layer, and now I am getting collisions on the enemies, but still no one is taking any damage?
Thank you again for the responses, its awesome!
Just bought and starting to integrate. Is there a way to make rfps grenades and shields work?
Another issue, agents are bent over backwards and i get this error 999+ times:
VisibleBody.Update () (at Assets/RFPSP/Scripts/Player/VisibleBody.cs:250)
And finally, player cannot damage the agents with any weapons
RFPS 1.24, latest version of TSAI
You'll probably need fix the RFPS animators which were likely broken by a glitch in Unity's import process- just replace the animations that were removed (most likely the "run" animation).
Look to the included RFPS_Integration .txt file (it goes over both bullets and explosions; you'll need to copy/paste 2 small pieces of code and uncomment a few more). If the WeaponBehaviour script is unchanged in the most recent update, those instructions should still work.
As for shields, attaching a collider to the shield which is on a physics layer that the bullets are set to interact with will probably do the trick.
In the meantime, I'll download the new version and if there's any changes that need to be made to the integration instructions, I'll post them here and also submit an updated package to the store. However, you might still be able to find the segment of code in question by doing a Control-F search for
And then just inserting the "else if" statement in the integration instructions somewhere in the if-else code block.
Have you checked to make sure the damage values are set high enough? You may be doing 1 damage per shot against an enemy with a million HP. Also, make sure you changed the LayerMask variable in the script, not the Layer on the object. You can tell the difference (aside from the locations) because you can select more than 1 layer for the LayerMask, but only 1 for the object's Layer.
The damage is 1, the HP is 100, the layers for bullets, player and in the script is default layer
You know the damage isn't a problem, i've already fixed it.
I've also added a targetscript to my main playable character so ai attacks me and i've run into an issue.
I do have another issue, if my character goes behind a wall, the AI just continues firing at the wall wihtout moving around or moving at all. Is this the behavior?
Also i have never seen any ai in any of the demos actually cover, just dodge
Hi Squared 55,
I found the issue that is causing my Tactical shooter AI walking animations to not work.... First of all, yes.. the run animation gets unloaded from the Public animation clips on the scripts but thats okay since you mentioned it in the text file and sorted it out, What i was talking about was the AI walk animations on my own characters stop working in mid-gameplay at runtime after they initially worked..
So the cause of the walk/run animations breaking was the RFPS menu... When starting the game you will find the TSAI agents walking/running as per normal, AS SOON AS YOU Press Esc to bring up the RFPS menu to either "save or set invulnerability" for testing , when you take the menu away again the TSAI agents to dont walk/run anymore but slide.
I think it might be the menu script of RFPS that sets the Time to 0 and then back to 1 when continuing the game, Perhaps this disturbs the TSAI animation script somehow, I but just adding a line of code to the RFPS Esc menu when "closing" the menu, to re-initialize the Animation scripts for TSAI, or call a OnAwake or something.
Please note this issue when testing with the new RFPS.
Check the layermask variable on the AI Controller Object (I believe it's on the object that holds all the cover nodes in the demo scene). Make sure this includes the physics layers that your level parts are on. Also, the default demo scenes may have their layers removed by Unity's import process, so you might also need to assign them a physics layer as well. Finally, check the layermasks on the cover node objects themselves.
In summary, fixing the layermasks should resolve both those issues.
Ah, that problem. If I remember correctly, I resolved that (in RFPS 1.23) by setting the Timescale to 1 in the project settings (RFPS has it set to 0 by default).
I'm still having troubles, any chance you could release a small integration pack for rfps users like me?
Would you be able to expand on your point in Edit 3? I've got everything set up and the agents are running through their moves and shooting and damaging me but I can't get the RFPS weapons to damage them. I feel sure its a layer issue but the 'World Collision' layer you mentioned does not exist anymore, everything is on Default which is also where my level parts are. Is it a case of moving the level parts to a different layer? Cheers!
DOH! Put the weapon behavior scrip changes in the wrong place - all working now!
Could you explain what you did to me? I have the same problem. Thanks
Indeed. You have to pay attention to where to change the scripts. I glossed over it a bit too quickly and ended up putting them in the wrong place. They go at the end of the sections that manage NPC damage. Check the RFPS integration text file that is included in the package for the code and locations.
Just a quick question on the Dismemberment script - I've got this working nicely with the effect following the agent as he falls and it's a great visual player reward for a well aimed head shot. My issue is with the generation of the transparent parts. At the moment, the whole agent goes transparent rather than just the head/neck hitbox area that I would like to remove, the whole agent disappears with just his gun (and the transparent colliders) left behind for a short while. Any ideas of how to prevent this? Cheers!
First you'll need to divide your agents mesh into two materials in your 3D modelling program- one covering the part that you want to disappear, and the other covering the rest of the body. It's OK if they both use the same Unity material, but you should be able to replace one slot with a transparent material and still get the desired effect. Then, you'll need to fill in the material set that you want in the script itself (ie: replace the material you want to vanish with a transparent one). When the effect is triggered, the original material array will be replaced with the one in the script.
Hopefully this makes sense.
(Also, you'll want to make sure that you seal up the model in your 3D modelling app or else the opposite side of your zombie/robot/soldier/whatever will be transparent.)
Nice one! Much appreciated and thanks for the help!
If using the UFPS integration, do AI drop UFPS weapons / ammo when killed? Or at least can we specify in the inspector an object to spawn when the character is killed?
Hi again and thank you for all your help. My ai is working great except still no cover.
I checked layer masks but I don't know what I'm looking for and like I said the demos don't work. I don't even see where in the cover script I should specify a layer but even advanced cover doesn't work. Neither cover bode based no advanced cover works and I've tried tactical berserker and other modes to try to get it to work.
You can use the OnAIDeath() method on any script attached to do stuff when the AI dies.
So, something like this in a new script.
public GameObject dropPrefab;
public void OnAIDeath()
GameObject.Instantiate(dropPrefab, transform.position, transform.rotation);
(I just wrote that code chunk down off the top of my head, so no guarantees it will work, but you'll want something similar.)
There is a variable in the cover node script called "Layer Mask." It is a dropdown menu.
It is the 4th variable from the top, after "Sight Node Off Set", "Node Radius Visualization", and "Always Display". The script is on the cover nodes themselves, not the agents.
Select all the physics layers which your map objects are on, or everything if you don't know. Do the same on the Controller Script. It is the second variable from the top here, after "Min Dist For Dynamic Cover Similarity."
The demos may not work out of the box if you import the package into a premade project, which will result in different layer settings than the demo scenes expect.
Do TSAI agents have a headshots option with UFPS (basically a damage multiplier on the head collider)?
Also I keep getting this:
NullReferenceException: Object reference not set to an instance of an object
TacticalAI.Patrol.AICycle () (at Assets/Tactical Shooter AI/Tactical AI/Csharp/AI Behaviour Scripts/CustomAIBehaviour.cs:433)
TacticalAI.BaseScript+<AICycle>c__Iterator1.MoveNext () (at Assets/Tactical Shooter AI/Tactical AI/Csharp/AI Behaviour Scripts/BaseScript.cs:245)
UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress) (at C:/buildslave/unity/build/Runtime/Export/Coroutines.cs:17)
TacticalAI.BaseScript:Start() (at Assets/Tactical Shooter AI/Tactical AI/Csharp/AI Behaviour Scripts/BaseScript.cs:203)
Using Unity 5.5.3.
EDIT: Actually, this error was just because one of my AIs was set to patrol without any waypoints. No problem.
Each collider can have it's own unique damage modifier. By default, sphere colliders are given a 2x damage multiplier.
Hi you can help me i creating a battle field like game but the enemy guns dont are the correct for my game how i change the guns? sorry for my english i from brazil
Making the agents use a different gun should just involve replacing the gun mesh in the editor. Nothing special required (unless you need a different aiming animation, in which case you will have to modify the animation controller with your new animations).
Hey squared - would you ever consider consulting for a fee to help lay out your AI in a game?
To be honest, I can't think of any scenarios where a forum post wouldn't cut it.
Anything in particular you want help with?
I feel like I have so many questions, and forum posts have a 24 hour turnaround typically. I was hoping to pay you for something more interactively, hourly or for the project, just to perfect the AI for my game.
I still don't understand why AI covers sometimes, and not other times. AI still comes too close to me when I go out of LOS and stands literally on top of me. Things like grenades don't always throw right. I can't seem to get shout distances correct, and enemies attack from off screen etc.
Anyway, if you are not interested no prob. I just thought if you wanted to make more money than just what you do off the asset itself, and actually make an integration fee, I'd be willing to pay, just so I don't have to wait, and perhaps you could give me some ideas of how to use the asset better, since you created it.
-The agents stop getting closer when they both have line of sight to the target and are within the minimum distance to the target when out of cover as specified in the base script.
-Grenades use the last position with line of sight to the target by default, but that can be toggled off in the Gun Script.
-Shout distances are mostly just trial and error.
-Not entirely sure what you mean by "enemies attack from off screen".
I'm not entirely opposed to the idea of a consultation, but I'm also not certain I can do it either. Feel free to send me a PM about it, though.
Hey I shot you a PM. Please respond here if you don't get it. I couldn't just view your profile to send a message because you blocked it, so I kind of shot it blindly.
Thanks in advance!
Wanted to ask a few questions about TSAI.
1. Sadly, after 5 years, all the other popular AI systems are still using capsule colliders, and this approach just screams out, "My first game!" due to grossly inaccurate collision. My question is, using TSAI's ragdoll approach, do you see it being difficult to implement something like this? The hit reaction system really sells the immersion, as the AI's ragdoll colliders react to being shot. I'd imagine this may have more to do with UFPS and how its damage is dispensed, but thought I'd ask for your thoughts anyway since you have ragdoll hitboxes. My theory is that if TSAI allows ragdolls that are made externally, that this ragdoll system would work, so long as bullets can apply force to affect those ragdoll colliders.
2. Did the zombie tutorial ever happen? I'm just looking for meandering AIs who, when in proximity, chase the Player and try to attack them via melee.
3. Does TSAI support manual waypoints AI can loop on? As in, 4 waypoints that form a square, and the agent travels to each point, eventually looping that path.
4. Does TSAI support respawning? While only an estimate for now, I'd like to keep 50-100 agents in the scene at all times, with only a 3-5 second delay between respawns when an agent is killed (and corpse removed).
5. I'd assume this is the case, but wanted to check anyway: does TSAI allow dropping items that the Player can pick up?
Thanks for reading!
Edit: 2 more questions!
6. Noticed in "Demo2" that the winning AI team just freezes in place when there are no enemies remaining. Is there a way to get them back to idle, wandering, etc.?
7. Just noticed that every single surface in "Demo2" is on the "PlayerSurface" layer. What is the reason for this, and is there associated overhead in this approach?
1. I've never used that system, but as long as it doesn't get overridden by animations, it should work (but you may need a custom bullet script). By default, the agents can play a stumble animation when hit by an attack. Once the agent runs out of health, the ragdoll is fully affected by physics.
2. I never made a zombie tutorial. Creating zombies *should* just be a matter of tweaking the appropriate settings in the base script, assigning a melee animation, and switching off the gunscript/taking away it's bullets.
3. Yep, use the Patrol idle behavior and assign the points in the base script.
4. Unfortunately, TSAI really doesn't play nice with pooling systems. I've always just instantiated new agents.
5. You can use the OnAIDeath() method to do stuff (like instantiate a pickup) when the agent dies. I think I posted a sample script a little while back- it's only about 4 lines long.
6. You're probably using the search idle behaviour. If there's nothing to search for, they won't search!
7. For me it's "Level Parts". Unity just takes whatever is your 7th (might not be the 7th; its just a number I picked out of thin air) layer in your project on import. Sometimes you'll even get a blank layer if you don't have enough layers in your project. You can move it to whatever layer you want, so long as you also update the layermask variables on the AI Controller and the Cover Nodes.
I have a problem
when I add Agents to scene I have these errors:
after running the game - agents dont attack each other !
BUT in demo scene everything is OK !!
Make sure you have added an AI Controller to your scene.
Problem solved in new project with same assets and scene items!! But some thing else happens!
The Agents start attacking each other but there is only shooting sound and Shooting animation and there is no Bullet! they walk and fight but no dmg! sometimes they through grenade and that dmg a little!
Just grabbed the latest update, great stuff Seems to work so much nicer these days!!
Check the bullet prefabs and the gun scripts, as well as the layermasks. Also make sure they have low enough health.
Looks like its working ok with my clown character but he doesnt always aim directly at me sometimes shoots the wall or ground etc. Also as he shoots me he slowly rotates his upper body, until he is not facing me, then he rotates back, looks strange. Also why do the people walk all the time even when they stop to shoot?
Screenshot of him missing me, he doesnt always do this but sometimes https://dl.dropboxusercontent.com/u/4194619/Snap 2017-06-04 at 15.03.41.png if i move a bit he regains aim. I cant actually remember what theyre aiming at to get to me, is it player tag? I did the ufps integration a long time ago, is there a way to check his current target?
edit: printed out his target it appears to be mxiamo:neck, so thats right, but he doesnt always rotate and shoot towards it.
edit: doh! my minimum distance to aim was set too high seems to be going good now!!!
One problem I am having is that the AI seem to aim at people sometimes who arent in view, for example they will shoot the ceiling if someone is above them, or through a wall that someone is on the other side of, any way to fix this ? Other than that I am quite amazed how well this works (amazing job!!!), despite all my questions yesterday ))
II fixed the always walkign by tinkering with the anim controller, its still all coming up as "paragon" here so I wonder if things are working unoptimally, like in your real demo in a fresh scene do they walk when they are still shooting for example?
Also I have 40 pedestrians that are targets, they seem to kill all of them before they come after me, is there some priority that orders this?
There should be a setting in the GunScript which determines how thin walls can be and still have the agents try and shoot them- the idea is for there to be suppressing fire.
You can set the priority of each target in it's respective TargetScript.
Some problems can occur if you update without a fresh import. It might be best to make a backup, then delete the old package (meta files and all), and re-import. This might be especially helpful if you were using a really old version of the package before. Importing the package into a completely blank project, I don't see any issues with walking and firing.
Thanks very much, although I dont see this parameter? One other weird issue is when I kill them and they ragdoll, if I look away then look back at them, they ragdoll again, as in they appear to stand up then fall down immediately, even though theyre dead. Any idea how I stop this ?