Search Unity

[UPDATED] ICECreatureControl v1.4.0 - creature AI for enemies, animals, monsters, zombies ...

Discussion in 'Assets and Asset Store' started by icetec, Aug 11, 2015.

  1. Carmexx

    Carmexx

    Joined:
    Jul 29, 2014
    Posts:
    63
    ah, right got it. I have my own damage/health scripts, so wanted to control death in my scripts, but I moved the death part back into ICE - got it working perfectly, I still use my own scripts but I just fake in ice the death of the npc and hey presto the death part works, with no sliding all over the place.

    Thanks for the help Pit, the clue was favoured on behaviors, cheers.

    Carme
     
  2. icetec

    icetec

    Joined:
    Mar 11, 2015
    Posts:
    592
    Hello Carme, to integrate your own damage / health handler, you can find some helpful examples in the ICEWorldDamageAdapter.cs (receive) and the ice_objects_integration.cs (send) ...

    Here is a complete sample script that you can customize for your own damage handler ...
    Code (CSharp):
    1.    
    2.  [RequireComponent(typeof(ICEWorldEntity))]
    3. public class YourCustomDamageHandler : YourOriginalDamageHandler { // ToDo: could be also derived from MonoBehaviour
    4.  
    5.    // Entity represents the base class of a creature or other ICE world objects
    6.    protected ICEWorldEntity m_Entity = null;
    7.    public ICEWorldEntity Entity{
    8.        get{ return m_Entity = ( m_Entity == null ? ICEWorldEntity.GetWorldEntity( this.gameObject ) : m_Entity ); }
    9.    }
    10.  
    11.    // IMPORTANT: this overrides the EntityDamageConverter.DoHandleDamage method with the
    12.    // customized damage method and allows to use the original damage handler of the asset.
    13.    private YourDamageConverter _dc = new YourDamageConverter();
    14.  
    15.    // Your damage method
    16.    public void YourPublicDamageMethod( float _damage )
    17.    {
    18.        //base.YourPublicDamageMethod( _damage ); // just in cases YourPublicDamageMethod overrides a method of your base class
    19.        
    20.        if( Entity == null )
    21.            return;
    22.        
    23.        // applies the damage to the cretaure ...
    24.        Entity.ApplyDamage( _damage );
    25.        
    26.        // you can also call AddDamage in cases your damage method provides additional infomation ...
    27.        //Entity.AddDamage( float _damage, Vector3 _damage_direction, Vector3 _damage_position, Transform _attacker, float _force = 0   );
    28.    }
    29. }
    30. // this class expands the ICE damage handling and allows your ICE creatures to use your damage handling instead
    31. public class YourDamageConverter : EntityDamageConverter
    32. {
    33.  
    34.    public YourDamageConverter(){
    35.        HandleDamage = DoHandleDamage;
    36.    }
    37.  
    38.    public new static bool DoHandleDamage( GameObject _sender, GameObject _target, DamageTransferType _impact_type, float _damage, string _damage_method, Vector3 _damage_point, DamageForceType _force_type, float _force )
    39.    {
    40.        if( _target == null || _sender == null || _target == _sender )
    41.            return false;
    42.  
    43.        bool _handled = false;
    44.  
    45.        YourOriginalDamageHandler _health = _target.GetComponent<YourOriginalDamageHandler>();
    46.        if( _health != null )
    47.            _health = _target.GetComponentInParent<YourOriginalDamageHandler> ();
    48.  
    49.        if( _health != null )
    50.        {
    51.            _health.YourPublicDamageMethod( _damage );
    52.            _handled = true;
    53.        }
    54.        else
    55.        {
    56.            _target.SendMessageUpwards( "YourPublicDamageMethod", _damage, SendMessageOptions.DontRequireReceiver);
    57.            _handled = true;
    58.        }
    59.  
    60.        return _handled;
    61.    }
    62. }
    63.  
    I hope this will be helpful to you but please feel free to contact me whenever you have further questions.

    Have a great day!

    Pit
     
  3. icetec

    icetec

    Joined:
    Mar 11, 2015
    Posts:
    592
    Hi zenGarden, in such a case, ICE can not read the given animations properly. Are you sure the ignored animations are actually legacy animations?
     
  4. Pvt_Hudson

    Pvt_Hudson

    Joined:
    Jan 20, 2016
    Posts:
    41
    Hello. Watched a couple of the quick start videos. Have a fox and a rabbit, and they face each other initially about 10metres apart. They each have their own home to the rear of their initial position/direction.
    The rabbit has no interactions for the fox.
    The fox has 2 interactions for the Rabbit (based on tag): RUN and ATTACK. This works fine when Selection Range and Angle are unlimited...the fox chases the rabbit.

    If i change the Selection Range to 20metres, and/or Selection Angle to 180...
    1) I notice the gizmo for selection angle/range is not on the fox, but is radiating from front of the rabbit ????
    2) the fox does not detect the rabbit anymore.

    Do i need to do something else to get selection angle/range to work ?

    thanks
     
  5. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    My bad, the prototype character had legacy and mecanim folders animations with same names. Thanks.
     
    Last edited: Apr 29, 2017
  6. redmotion_games

    redmotion_games

    Joined:
    May 6, 2013
    Posts:
    84
    Just getting started with ICE. As a test, I'm trying to get it working with the free Unity Ethan model.

    Dropped in the model. Removed everything from Root other than Animator. Added ICE creature control. Followed Manual setup in the manual section 3.3.

    1. It moves but doesn't do the animations.
    2. It wanders off the ground in another direction.
    3. Can't see any debug info apart from names of objects. (which includes a home for the ethan character).
     
  7. TonanBora

    TonanBora

    Joined:
    Feb 4, 2013
    Posts:
    493
    Make sure you setup the animations for Ethan's behaviors.
     
  8. DivineMercy

    DivineMercy

    Joined:
    Jun 28, 2016
    Posts:
    33
    @icetec , when is the next available time for you to be on skype?

    This is a screenshot of my dino poolings, I have several more set up like this. For some reason, I have the spawn point set up but after they die they always respawn at the origin.

    Update: Upon setting the spawn delay to 0 on the wave intervals, they spawn right back to the spawn point (yay!)- but how I do I make them not respawn, only spawn in initially?

    Also, is there a way to use box colliders for the hit boxes of creatures instead of the overlap prevention? I really need to fix the spinning issue and spawning issues :\
     

    Attached Files:

    Last edited: Apr 29, 2017
  9. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    Make sure in "default behaviours" to edit each animation and choose
    Wrapmode = loop
    Speed = 1 (or another value >0)

    In menu "Essentials" , check "Ground Handling" is "Raycast" and check your floor or terrain has the layer "walkable surface"

    Add a "Ice creature control debug component" to your character , and check "Use advanced Gizmos"

    I recommend you to try the basics tutorial
     
  10. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    @icetec


    We would need clans feature because the predefined trophic level is not enought.
    For example and eagle can eat a rabit but won't eat a cow.
    And clans are better to manage multiple characters groups interacting with the player also each ennemy or friendly to player and others.

    EDIT: We can use tags.



    Thanks.
     
    Last edited: May 4, 2017
    Ryuichi173 likes this.
  11. Pvt_Hudson

    Pvt_Hudson

    Joined:
    Jan 20, 2016
    Posts:
    41
    still need help getting selection range/distance working. Attached 2 screenshots. First shows fox and rabbit facing each other, and the interactions on the fox character as they relate to the rabbit.


    Second screenshot shows at runtime, both just start running away towards their home (which is zero priority). Even though the fox is selected, the blue selection angle/distance arc appears at front of rabbit...not the fox ?!?!!?
     
  12. TonanBora

    TonanBora

    Joined:
    Feb 4, 2013
    Posts:
    493
    Selection angle can be a little confusing at first.
    It does not represent the angle in front of the creature, but the angle in front of the TARGET.
    For example, in the last screen shot, the Fox will only attack the rabbit when the Fox (not the rabbit) is within a 30 degree arch in front of the rabbit.
     
    Ryuichi173 likes this.
  13. Pvt_Hudson

    Pvt_Hudson

    Joined:
    Jan 20, 2016
    Posts:
    41
    not particularly intuitive, but explains why it's on the rabbit. Though even the RUN part isn't working..since they are facing each other at the scenario start.

    the idea was...i want fox to only see the rabbit if the rabbit is in forward hemisphere of the fox (forward 180degrees), then only play attack animation if the rabbit is almost directly in front on fox (30degrees). Where do i define these parameters ?

    Edit: Seems i need to 'enable Sensoria' according to manual...that is done where ?

    Edit2: OK its on the Status tab, not the Essentials tab (which is what manual screenshot looks like). FOV Enabled...fox won't chase rabbit (in front of it). FOV disabled...fox chases rabbit??

    thanks
     
    Last edited: Apr 30, 2017
  14. Firlefanz73

    Firlefanz73

    Joined:
    Apr 2, 2015
    Posts:
    1,316
    Hello TonanBora and icetec,

    the last Topics I read here like the rabbit and the fox would also be solved if we had presets at least for hermivores and carnivores.

    In my opinion it would be great to have some in the upcoming update included!

    Great would be
    - hermivore (rabbit, cow)
    - carnivore (Fox, Lion)
    - Monster (Zombie)
    - NPC just wandering a small area
    - Monster with blunt weapon, Monster with range weapon would make it complete and perfect!


    If I had a wish there would be a new demo Scene with all kinds of These included too. Also fighting and stuff. Maybe with small dark hermivore teddybears and light larger carnivore teddybears :)

    Besides that, it would be great and really helpful for me if you could send me some presets!


    Thanks a lot and have a nice Weekend!
     
  15. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    If the plugin must respond to each user specific creatures categories needs it's impossible to manage.
    The best would be the plugin let users use pre defined categories, or let users define their own categories, this way the plugin will adapt to any user needs (herbivore big, herbivore medium , herbivore small , zombie, alien , titan ...)
     
    Firlefanz73 likes this.
  16. redmotion_games

    redmotion_games

    Joined:
    May 6, 2013
    Posts:
    84
    So I tried something it little different. I placed in the Dungeon Skeleton Demo model from asset store.

    I setup creature behaviours eg: HOME_TRAVEL, etc etc. Not any default behaviours.

    What I've discovered is It's basically not reading animations from animation controller and they can't be selected via LEGACY interface, if you make changes AFTER adding the ICE controller. Is there a way to refresh the ice controller so it rereads the animation controllers clip list?

    Mecanim setup on Ethan just doesn't seem to work following manual and vids. There must be something that needs changing in the Mechanim setup.
     
  17. Firlefanz73

    Firlefanz73

    Joined:
    Apr 2, 2015
    Posts:
    1,316
    That would be even greater. This way the user could just Chose what Kind his creature is, and ICE would do the rest. And each developer who wants more detailed stuff can use the existing possibilities after that, too. Then ICE would really be a big help for all users who do not want and Need to get too deep into it...
     
  18. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    I had the same issue, if you close Unity, re launch and it should be refreshed.
     
  19. TonanBora

    TonanBora

    Joined:
    Feb 4, 2013
    Posts:
    493
    Here is the YouTube Video of my last Stream:


    Check the video description for a link to the Golem.cs script!
     
    icetec, jonfinlay, zenGarden and 2 others like this.
  20. Firlefanz73

    Firlefanz73

    Joined:
    Apr 2, 2015
    Posts:
    1,316
    Hi TonanBora,

    thanks for your Video Clips :)

    How about sending me some presets I can try?

    That would be really helpful for me :)
     
  21. Pvt_Hudson

    Pvt_Hudson

    Joined:
    Jan 20, 2016
    Posts:
    41
    still looking for some sort of doco/guidance how to get creature A only seeing/pursuing creature B if B is in A's FOV...
     
  22. Firlefanz73

    Firlefanz73

    Joined:
    Apr 2, 2015
    Posts:
    1,316
    This error does not keep me from starting, but how do I get rid of it (Unity 5.6p3)?

    C:\Unity\Biotopia3D\Assets\ICE\ICECreatureControl\Scripts\Core\Editor\Configuration\ice_creature_editor_text.cs(56,56): Error CS1513: } erwartet. (CS1513) (Assembly-CSharp-Editor)

    I do not understand it. I entered a }} there, after that it get other Errors:

    C:\Unity\Biotopia3D\Assets\ICE\ICECreatureControl\Scripts\Core\Editor\Core\Base\ICECreatureEntityEditor.cs(40,40): Error CS0117: 'ICE.Creatures.EditorInfos.Info' enthält keine Definition für 'ATTRIBUTE_ADD'. (CS0117) (Assembly-CSharp-Editor)

    C:\Unity\Biotopia3D\Assets\ICE\ICECreatureControl\Scripts\Core\Editor\Components\Items\ICECreatureRangedWeaponEditor.cs(93,93): Error CS0117: 'ICE.Creatures.EditorInfos.Info' enthält keine Definition für 'PRIMARY_WEAPON'. (CS0117) (Assembly-CSharp-Editor)

    And tons of these.
     
  23. TonanBora

    TonanBora

    Joined:
    Feb 4, 2013
    Posts:
    493
    For the interactors, make sure the FV box is highlighted.
    If it is greyed out, go to the creature's Status options, scroll down, and enable Sensora and define the creature's FOV.
    Check my Golem video for these steps.

    Also, would you guys like me to do a YouTube series with short videos on ICE related topics, instead of these 1 hour long Twitch streams?
     
    recon0303 and inoj like this.
  24. TonanBora

    TonanBora

    Joined:
    Feb 4, 2013
    Posts:
    493
    Any in particular that you would like?
     
  25. r-dotfunky

    r-dotfunky

    Joined:
    Sep 11, 2012
    Posts:
    12
    Hey there,

    How do I go about making something "fly" using the controller? I have the basics working but have been unable to make something fly around the scene. Is there a tutorial somewhere that I missed?
     
  26. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,151
    Yo TonanBora!

    I think it would be awesome if you could do a video on this UFPS damage handler & maybe a bit more complex mechanim animations, like using 2-3 different attack animations, and how to do the hit damage.. ragdoll spawning on death...Creatures fighting each other.. that would be great =)
     
  27. Firlefanz73

    Firlefanz73

    Joined:
    Apr 2, 2015
    Posts:
    1,316
    Hermivores and carnivores would be great!

    I have bought this pack here (animals):
    https://www.assetstore.unity3d.com/en/#!/content/5032

    And if possible later some Monsters with blunt and range weapons or something which could a good base for that would be great, I have also These (Skeletons):
    https://www.assetstore.unity3d.com/en/#!/content/7110

    I saw Mr.Necturus who made the Skeletons is being thanked in the Manual. So is there maybe something already done with those?

    It would be great to have something in that direction, thanks a lot!
     
    icetec likes this.
  28. paulodell

    paulodell

    Joined:
    Feb 27, 2017
    Posts:
    1
    Hi,
    Do you have a Discord channel for Support?
    https://discordapp.com/

    It would be really useful and also another way to contact you (and communicate with other devs)

    Thanks

    Paul
     
  29. jonfinlay

    jonfinlay

    Joined:
    Aug 25, 2015
    Posts:
    535
    Hey Tonan, I was watching your Mecanim tutorial yesterday and it was a huge help, thanks a lot for doing that. I've spent the last few hours trying to setup the Jerboa (from the same Complete animals pack as you are using) using your techniques, so it woke up at night and proceeded to look for food, although it would be great if you have time to show the proper use of the Mecanim turning using a turn animation with root motion as your YouTube video didn't cover it. I had some success, but some problems as well.

    Also, I noted you created an interacter as the home. Does the advanced method not allow for random behaviours within a behaviour such as idle? I did attempt to do it, but had some problems and was wondering whether it was currently supported with mecanim/advanced. Using the invisible object to lead the fish was a great idea as well, I normally just create a "leader" animal, but your method is both quicker and safer in the case the leader is killed.

    As Mattis above mentioned, I'd too love to see some more complex mecanim tutorials. But do what you are happy doing, whatever you do is sure to help someone whatever their level.
     
    SimoneDunzendorfer likes this.
  30. TonanBora

    TonanBora

    Joined:
    Feb 4, 2013
    Posts:
    493
    Yah, I originally intended to do the rotation animations, but it just skipped my mind, and I did not have enough time to do it. However, I do plan on doing a series of YouTube tutorial videos about setting up a mecanim, parameter controlled creatures.

    I did the Interactor based Home because it gave me a little more control, and freedom with regards to what behaviors and animations I wanted my creature to perform such as sleeping, which you cannot do with normal Home behaviors since you cannot check for the time of day. Having different Idles is quite possible, just use an IntData parameter that controls which Idle animation to play, and setup a Behavior with as many rules as you have idle animations. Then have these rules change the IntData, and set the rule selection to random. :)

    If you want complex, I can go over how I setup the ICE Mechs that I teased in a previous post:


    :p
    But yes, I can definitely do more complex things, and even do some programming tutorials that show what can be done with ICE on the scripting side.
     
  31. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    Hi @icetec

    The more i use the kit, the more i discover it already manages a wide range of possibilities.
    I have some requests that would improve it, without needing the user to create custom scripts.

    1) Unspwan and culing :
    Could we have some unspawn or culling and creature deactivation when they are far from the player for performance ? Culling option do nothing and there is nothing on the manual about it.

    EDIT : it works, make sure your camera as the tag "MainCamera"


    2) Pause animations while wandering :
    Creatures should be able to pause while wandering at some random moment with a time intervall the user could specify.

    EDIT : You can already add many actions in LEISURE and select random or priority for them to play.

    3) Interactor actions new condition option using random :
    Could we have some option for an action to launch with defined conditions, and an optionnal random value range. The condition is verified when the random value is equal to the action defined value ?
    This would make it possible to launch randomly different attacks actions or different seek actions with different speed and animations.

    4) Flying projectiles Direction option :

    Have some option to choose the direction of the projectile
    - Actual forward direction of Weapon
    - Player direction + Y offset ( or player child gameobject)
    When the weapon is a magic missile, there is no weapon and the projectile direction at start should be the player.

    EDIT : I done the modification for specific ranged weapons or magic firing in direction of the player whatever the weapon direction is.

    5) Ice Tools animations option :
    About ICE Tools type objects , it would be good to allow animations for "stand by" and "use" actions.
    For example some tools could be mechanical an animated.


    Thank you.


    Tips :
    Don't set any transitions between animations if you use Animation controller, otherwise animations will not be played exactly as set up in ICE Creatures.
     
    Last edited: May 6, 2017
    jabevan and Ryuichi173 like this.
  32. jonfinlay

    jonfinlay

    Joined:
    Aug 25, 2015
    Posts:
    535

    OK great! Looking forward to seeing them. You could also try adding swim up and swim down animations to your sardines, I know most (if not all) of Junnichi's fish and birds have a up and down animation, which should work similar to the turn animations.
     
    icetec likes this.
  33. TonanBora

    TonanBora

    Joined:
    Feb 4, 2013
    Posts:
    493
    Ah, but I can't, at least, not without doing some scripting.
    This is because Pit has not put anything in to check the x rotation (up-down rotation) of the creature, so I cannot set any mecanim parameters to account for this.

    This is a feature I had requested @icetec add in, as it would work similar to the Angular Speed, or at least the Move Direction dynamic parameters.
     
  34. jonfinlay

    jonfinlay

    Joined:
    Aug 25, 2015
    Posts:
    535
    Ah ok not to worry then, hopefully it'll be put into the next update. ;)
     
  35. TonanBora

    TonanBora

    Joined:
    Feb 4, 2013
    Posts:
    493
    Have you watched my Mecanim tutorial video?
    I setup transitions just fine. :p



    Make sure you set the animation control type to Advanced, setup the Animation Controller's parameters, and set them within the creature's behaviors.
     
    Ryuichi173, icetec and zenGarden like this.
  36. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    This is the code base i use for a projectile without using ICEProjectile and directly working with player script.
    Code (CSharp):
    1. public class fireBall : MonoBehaviour {
    2.     // Use this for initialization
    3.  
    4.  
    5.     public float speed = 10f;
    6.     public float playerYOffset = 0.5f;
    7.  
    8.     void Start () {    
    9.    
    10.         GameObject playerGo = GameObject.FindGameObjectWithTag("Player");
    11.  
    12.         if (playerGo != null) {
    13.        
    14.             Vector3 playerPositionOffset = playerGo.transform.position;
    15.             playerPositionOffset.y +=  playerYOffset ;
    16.             Vector3 dir = (playerPositionOffset - transform.position).normalized;
    17.  
    18.             Rigidbody rb = gameObject.GetComponent<Rigidbody> ();
    19.             rb.velocity = dir * speed;
    20.  
    21.         } else {
    22.             Debug.logger.Log ("No player");
    23.         }
    24.  
    25.     }
    26.  
    27.  
    28.     void OnCollisionEnter(Collision collision){
    29.         if (collision.collider.tag == "Player") {
    30.             PlayerScript scriptTps = collision.gameObject.GetComponent<PlayerScript> ();
    31.             scriptTps.damage (25);
    32.         }
    33.  
    34.         //Launch effect
    35.  
    36.         // Kills the game object
    37.         Destroy(gameObject);
    38.     }
    39. }
     
  37. TonanBora

    TonanBora

    Joined:
    Feb 4, 2013
    Posts:
    493
    Use Gravity is specified within the Rigidbody component of the Projectile prefab, which is why ICE does not have this option (because it does not need it).
    Muzzle Velocity is what controls how fast the projectile is fired, and if you want it to keep this velocity, set the projectile's drag value in the rigidbody to 0.
    Drag effectively slows the projectile's velocity down over time, so setting it to zero means it will not slow down unless it hits something.

    Lifespan and Destroy on Hit works fine for me.
    Make sure to give your projectiles colliders AND rigidbodies.
    If you don't want them effected by physics, then simply toggle "Is Kinimatic" to true, but in order for collisions to be detected within Unity, one of the GameObjects MUST have a rigidbody on it.
     
    Ryuichi173, icetec and zenGarden like this.
  38. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,151
    Hello!

    I have tried everything with this UFPS adapter thing... I have the eneny walking and everything that is easy.. I have added the World adapter script, and also added the ICE_UFPS to player settings.. I have the enemy wandering and coming at me when he sees me FOV.. But I do t know how to apply damage to enemy nor to player.. the enemy is a meele character.. I dont know how to use the event system .. PLEASE allmighty pit or tonan, anybody?! .. Tutorial on using ufps :) please! Thank you for your time :)
     
  39. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    Custom modification : Ice Weapon firing in player direction whatever weapon direction

    For example i have a Doom like creature launching fireballs from hands , there is no weapon and the projectile direction must be the player when the fireball is launched.


    Make this modification to IceCreatureWeapon.cs
    line 285

    Code (CSharp):
    1. Rigidbody _rb = _projectile.GetComponent<Rigidbody>();
    2.                         if( _rb != null )
    3.                         {
    4.                             //ZenGarden modification
    5.                             Vector3 playerPosition = _target.position ;
    6.                             playerPosition.y += 0.1f;
    7.                             Vector3 dir = (playerPosition - ProjectileSpawnPoint.transform.position).normalized;
    8.                             _rb.velocity = dir * ProjectileMuzzleVelocity;
    9.                        
    10.                            //_rb.AddForce( ProjectileSpawnPoint.transform.TransformDirection( new Vector3(0,0, ProjectileMuzzleVelocity ) ) );
    11.                         }

    Thanks , this was the Muzzle Velocity that was missing. The name "Projectile Velocity" would do more sense, i thaught Muzzle was about an effect.
    Yep, the Life Span works for me also.
     
    Last edited: May 6, 2017
  40. icetec

    icetec

    Joined:
    Mar 11, 2015
    Posts:
    592
    Hello Firlefanz73, they can do this by selecting the targets by tags instead of their names, simply add a tag for hermivore, flesh eaters, etc., and assign them to their creatures according to the species. Now open the desired Interactor Section and change the selection option of the Target from 'Name' to 'Tag'. In this way, you can create Interactor Rules for any categories.


    Hope this will be helpful to you!

    Have a great day!

    Pit
     
    Ryuichi173 and Firlefanz73 like this.
  41. icetec

    icetec

    Joined:
    Mar 11, 2015
    Posts:
    592
    Hi mattis89, basically attacks as well as the damage handling are working always in the same way, independent of the respective adapter.

    How a Creature can damage its targets
    By default your ICECreatureControl creatures will have a peaceful nature and will be unprotected and defenceless, but there are several ways to change this.

    Target Events
    The easiest way to make your creature damaging other objects are Target Events. You’ll find such an event section within the Target Settings of your creatures, just enable the feature, add a new event and select the desired method name and value. In addition to that you can also specify the interval settings to repeat the specified event as desired. If you want to sync the event with an animation you can activate the ‘TRG’ flag to trigger the event by an AnimationEvent. Simply set ‘TriggerTargetEvent’ with the desired event index parameter (btw. you can handle this in the Animation Section of the target related behaviour).

    By default you’ll get a menu with suggested methods and if your target contains an entity component you’ll find here the above-mentioned ApplyDamage method, but you can also activate the custom flag to enter your own damage method (e.g. ‘Damage’ while using UFPS). If this is done your creature will call the specified method whenever the associated target become active.

    Body Part Impacts
    In addition to damaging a target by using the Target Events, which serves the purpose but could be too imprecise for your desired scenario, you can use the Impact feature of your creatures Body Parts. As already mentioned you can define body parts of your creature by using the ICECreatureBodyPart component. Such BodyParts can receive and transfer damage but they can also strike back and deal powerful punches and kicks.

    All you need is to select the desired body part within your creature’s hierarchy and add the ICECreatureBodyPart component to it. Enable the Impact feature and define the desired damage values. In addition to that you can define also an impact sound and/or an impact effect, also you could define a layer mask to restrict the impacts to specific objects, so your creature will not destroy your complete world like a bull in a china shop. Finally you have to define the dimension of the body part by using a suitable resized collider/trigger. Here please consider that your creature or at least its target requires at least one Rigidbody, otherwise the body part can’t detect impacts.


    If this is done there is nothing more to do, your creature can use now the prepared body part as weapons and can damage and destroy all and everything, just define the desired attack behaviours and enjoy the brawl.

    Melee Weapon Impacts

    By using Body Parts with the Impact feature your creature is ready and well versed in the art of self-defence, but in addition to that your creature can also use other objects as weapons.

    For this purpose you can add the ICECreatureMeleeWeapon component to all your typical melee weapons (e.g. swords, knifes, hatchets, clubs etc.), so your creature can find and use such weapons.



    But in principle, similar to the real world, each moveable object could be divert from its intended use to inflict harm or damage on someone or something, therefore each Item or rather each object with a derived ICECreatureItem component contains an Impact section and could be used as weapon.



    In this example you can see the Impact Settings of a rock item. Attach now the rock object to the desired hierarchy element (here the left hand) and your creature will be equipped and ready to use its new item.

    Btw. see also the inventory options of your creature (Creature Status Settings). If you assign such an attached item also to the inventory of your creature you will get several possibilities to control the equipment during the runtime (e.g. hiding an item, changing its mount point or detach items while your creature is dying etc.).

    Ranged Weapons

    In addition to the above-mentioned methods your creature are also able to use guns, pistols, bows or any other kind of ranged weapons to inflict harm or damage on its enemies.

    For this purpose you can add the ICECreatureRangedWeapon component to all your typical ranged weapons, so your creature can find and use such weapons.


    Additional to the above-mentioned Impact option, which allows to use an item as melee weapon, the ICECreatureRangedWeapon component provides two ranged weapon systems, in which the primary system represents the main weapon while the secondary could be optionally used for an integrated grenade launcher or a similar weapon attachment. Both systems are identical and will be used in the same way. Furthermore there are settings for a Flashlight and a Laser system, which could be optionally used dependent to the desired weapon configuration.

    Regarding to the damage handling, all required settings can be found in the weapon sections. The weapon sections provides several settings to define the desired Ammunition, Fire Rate (Automatic), Launching Sound and Effect, Muzzle Flash and the Shell Ejection. However, all damage related settings can be done directly in the Ammunition part.


    The Ammunition section of the ICECreatureRangedWeapon component offers three Ammunition Types, which represents different methods to handle the shooting procedure.

    1. ‘Simulated’ will simulate a shot by damaging an aimed target directly.
    2. ‘Projectile’ will place the Projectile directly at the hit-point of the targeted destination.
    3. ‘Ballistic Projectile’ will launch the Projectile as a visible object on a ballistic trajectory.


    Projectile Impacts
    In contrast to the ‘Simulated’ method, which is able to damage a target directly, the projectile based methods (2+3) require an additional object to inflict damage on a target.

    For this purpose you can add the ICECreatureProjectile component to all your bullets, arrows, cannonballs or similar projectiles.


    The ICECreatureProjectile represents an item with specific abilities but finally the damage handling based of the already-mentioned Impact method and is therefore identical to the damage handling of all other item types. Important here will be the Impact Behaviour settings, which defines the behaviour of your projectile during an impact.

    You can find the full description in the manual or here ...
    http://www.icecreaturecontrol.com/files/ICEDamageHandling.pdf

    Btw. please also note that your creature will need at least a suitable collider and a rigidbody to receive damages.

    I hope this will be helpful to you but please feel free to contact me whenever you have further questions and in urgent cases you can contact me also via skype.

    Have a great day!

    Pit
     
    jabevan, Tethys and jonfinlay like this.
  42. AndyNeoman

    AndyNeoman

    Joined:
    Sep 28, 2014
    Posts:
    938
    Really awesome asset this. So much more I am finding than just AI.

    I was wondering if you can create ICE locations at runtime?

    I want to create a bed in game. My player has a item he is carrying. If he drops the item and the tag is of bed item then that location becomes ICE location 'bed'. Then if player goes near again they can either add to the bed with another item or sleep in bed.
     
  43. Pvt_Hudson

    Pvt_Hudson

    Joined:
    Jan 20, 2016
    Posts:
    41
    Had already enabled sensoria and clicked on FOV on the interaction per previous post. Search range/angle are infinity/360.

    When FOV is off (grey?)....fox will chase rabbit. When FOV (160degrees, 50metre visiblity) is on (blue?), Fox cannot see rabbit (Fox is facing Rabbit at range of just 10metres at start)
     
  44. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,151
    Okay! Thanks! Sounds harder than it probably really is.. So my creature needs a collider and a rigidbody to recieve damage ? (Using UFPS)
     
  45. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    @TonanBora
    Hi,

    About your last tutorial with the animation event, the function was never called.
    To make it work, i had to put the script object "fireBallLauncher" in the "object" field.


    I hope it can help people having the same issue.
     
    Last edited: Jun 15, 2017
  46. TonanBora

    TonanBora

    Joined:
    Feb 4, 2013
    Posts:
    493
    The object field is actually an object parameter to pass to the "fireBallEvent" function.
    I have noticed that at times, for what ever reason, Animation events don't fire off, and I have to go back, delete the event, and add it again.
     
  47. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    It worked as a basic test without Ice Creatures, but when i try to make it work with ICe Creatures, it does not trigger (there is Unity issues with animation events).
    Deleting and re adding the event didn't fix it.
    It would be nice to have in Ice Creatures a frame number option to launch attacks for ranged weapons instead of timer based , because timer based with intervall and delay falls off after some time letting the creature repeating the action.
     
    Last edited: May 3, 2017
  48. Deleted User

    Deleted User

    Guest

    Hey, there! I just bought ICE Creature Control and it's by far the best AI system I've found on the Unity Asset Store. I'm creating a horror game similar to Slender using ICE and wanted to know how to make an enemy AI creature chase the player around a map and be afraid of light. I've already added a creature register, player object and creature object. I'm new to ICE, so some guidance would be very helpful. Thanks in advance!

    P.S. - here's a video of what I'd like the creature to act like:
     
  49. twda

    twda

    Joined:
    Oct 25, 2012
    Posts:
    111
    @icetec I would (like Aceego) also like to ask about Ootii's Motion Controller implementation for ICE AI.
    Thank you very much.
     
  50. Carmexx

    Carmexx

    Joined:
    Jul 29, 2014
    Posts:
    63
    Hi Pit (@icetec),

    I'm getting two errors with the photon pun integration.

    Unity 5.6.0f3
    Photon pun v1.83
    ice 1.3.6
    Using a blank project

    1) When I click on Ice/Integration, then 'Identify supported assets '. I get an
    <<error Assets/ICE/ICEIntegration/Scripts/Components/ICEWorldNetworkSpawner.cs(92,13): error CS0103: The name `vp_MPMaster' does not exist in the current context>>

    I can create a network manager, but then cannot choose ''add network adapter' its greyed out.

    If I click the error and comment it out: << else if( vp_MPMaster.Phase == vp_MPMaster.GamePhase.Playing )>>

    I can then add adapters.

    2) Not sure if its related to point 1. On playing my game, two clients connected. When the master leaves, the ice creature moves to a location, and then stops moving, the animations keep walking, but its not moving. debug just shows its trying to move to 0.0.0.0 etc etc ie not moving..
    (I played around, and if by script I disable ice control on the creature, then wait 2 seconds and enable it (after watching for a pun master change..)- the creature resets and starts working fine again. I obviously dont ideally want a 2 second pause to all ice creatures on a master change.

    Regards

    Carme