Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

[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. sunseeker1988

    sunseeker1988

    Joined:
    Jul 10, 2014
    Posts:
    455
    Hello,

    I cannot get past the generate button in the wizard. Everything is set up correctly to my knowledge but clicking the button is doing nothing, I cannot get past this part.
     
  2. inoj

    inoj

    Joined:
    Feb 27, 2014
    Posts:
    21
    we are in same boat my friend! Im complete beginner with one-two week experience, had 1st try about 2-3 years ago. No coding skills, no modeling skills, but atleast we have assetstore with incredible artists providing us stuff to practise! Im not totally sure does the US integration that way work for us properly, but Im maybe using both as separate assets and waiting for developer integration, tho it might work alot better still! :)

    My sounds and those muzzle problems was because of that dublicate player, but as soon as i disabled that Pool thing in my player from creatureregister, im able to spawn to my ICE generated map and buildsnap, sounds work nice! About to try how i can get AI things work today, just to mess around, im sure Pit and Winterbyte does the integration way better than I do, but atleast this is incedible fun learning experience to atleast try to get things work somehow! (I've gotteng long list what to not to do) :D Hope you are having great time with both assets Sorrowthief, we have same thought, Ultimate survival + ICE and i have everything i've so far imagined i want to have combined for my game!
     
  3. TonanBora

    TonanBora

    Joined:
    Feb 4, 2013
    Posts:
    493
    Close the window, and click on the creature in the scene. :)
    The ICE Wizard stays open after clicking the generate button, in case you want to generate another creature, or modify other settings.
     
  4. Sorrowthief

    Sorrowthief

    Joined:
    Dec 14, 2016
    Posts:
    48
    TonanBora, I joined your twitch channel and saw that you take request for future streams and videos. I have gotten pretty decent with a lot of the Ai stuff and have acomplished some very cool fight sequences so far. The one thing I continue to fail at is with throwing objects. I was following the manual on the part that describes how to place and or hide inventory items on your NPC's. As I use the steps described I was trying to have my NPC reach down to the ground lime he is grabbing a rock, and then throw the rock at my player if the player is inside the range I specified. I am able to get most of this to work. I have a Mixamo animation that reaches down as if he is grabbing a rock. I was able to get him to play this animation at the range I specified. I can never seem to get the rock to throw though. I have been successful with getting the rock to appear in his hand once but it still did not launch it.

    I would love to see a tutorial on this, especially ballistic type ammo that you actually see flying through thr air. That whole process is a little confusing to me no matter how many times I go through that section of the manual. For me this would be a huge help and I appreciate all the time and info you provide for us. Likewise I know you are probably flooded with request. Thanks.
     
    TonanBora likes this.
  5. TonanBora

    TonanBora

    Joined:
    Feb 4, 2013
    Posts:
    493
    Have you seen my ICE Mech teaser video on the previous page? ;)
    Those mechs are running off of ICE (using a couple of small custom scripts).

    I actually just added a mech that shoots a laser beam.

    In any event, I could easily create a tutorial tackling ranged weapons. :)
     
    Nateply likes this.
  6. Sorrowthief

    Sorrowthief

    Joined:
    Dec 14, 2016
    Posts:
    48
    Hey thanks for the quick reply. If you decide to make it can you also demonstrate the whole inventory part as well? There has been more than a few times I have tried to add that rock to his hand from his inventory and I somehow get his whole arm stretching across the map lol. I have added his body parts so I really don't have a clue where I am going wrong. Using the ballistic ammo would be what I need to actually see the rock fly through the air correct?

    Oh yea I saw the mechs and had the asset store not been down last night I probably would have went and bought all that stuff and given my wife a heart attack lol. Good stuff
     
    TonanBora likes this.
  7. TonanBora

    TonanBora

    Joined:
    Feb 4, 2013
    Posts:
    493
    This is correct.
    Make a prefab of the rock, add a rigidbody, collider (if it is a mesh collider, tick the "convex" box, as rigidbodies don't work well with mesh colliders), and add the ICE Projectile, or ICE Item and enable the impact settings.

    Then, if you have not already, add a ICE Ranged Weapon to an empty child object of the character's hand, and assign the rock prefab to it's ammunition, and adjust the muzzle velocity as needed.
     
  8. Sorrowthief

    Sorrowthief

    Joined:
    Dec 14, 2016
    Posts:
    48
    Maybe thats what I did wrong. I'm not in front of my cpu atm but I think I just treated the hand as the weapon. I'll give it another go tonight and see what happens. Thank you much. Getting the animation and the timing of the rock to fly out of the hand at the right spot will be a task but I do beleive I can handle that with the wait times thing(I forget the exact name that its called).
     
  9. volak_

    volak_

    Joined:
    Feb 21, 2017
    Posts:
    7
    So anyone know of the best way to setup a creature to react to damage by attacking the attacker?

    My creatures generally idle around, if an enemy gets in melee range they attack but I also need them to attack anyone who attacks them.

    I've setup something using advanced statuses like Debility - but it doesn't work exactly right because I can't specify the target that caused the damage I can only do "if damaged"

    Anyone done this?
     
  10. volak_

    volak_

    Joined:
    Feb 21, 2017
    Posts:
    7
    Ok I got a working solution but its just a hack for me. If anyone else wants to do this this is what I did:

    On ICEWorldEntity I added 2 new fields "GameObject LastAttacker", and "float LastDamage"
    both of which are set in AddDamage

    Code (CSharp):
    1. public virtual void AddDamage( float _damage, Vector3 _damage_direction, Vector3 _damage_position, Transform _attacker, float _force = 0  )
    2.         {
    3.             // use RootEntity instead of m_RootEntity to make sure that the root will be up-to-date
    4.             if( IsChildEntity && Status.UseDamageTransfer )
    5.                 RootEntity.AddDamage( _damage * Status.DamageTransferMultiplier, _damage_direction, _damage_position, _attacker, _force );
    6.             else
    7.                 Status.AddDamage( _damage * Status.DamageTransferMultiplier );
    8.  
    9.             m_LastDamage = Time.time;
    10.             // Don't change last attacker more than once every 5 seconds
    11.             if ((Time.time - m_LastAttackerSet) > 5.0f)
    12.             {
    13.                 m_LastAttacker = _attacker.gameObject;
    14.                 m_LastAttackerSet = Time.time;
    15.             }
    16.         }
    Then in ICECreatureCharacter I changed "React()" with a special case interactor

    Code (CSharp):
    1.  
    2.                     // PREDECISIONS INTERACTORS
    3. foreach( InteractorObject _interactor in Creature.Interaction.Interactors )
    4. {
    5.        if (_interactor.AccessType == TargetAccessType.OBJECT)
    6.        {
    7.                // remove last attacker if hasn't been damaged in > 10 seconds
    8.                 if ((Time.time - LastDamage) > 10.0f)
    9.                        _interactor.SetTargetByGameObject(null);
    10.                 else                          
    11.                        _interactor.SetTargetByGameObject(LastAttacker);
    12.                 }
    13.  
    14.                  _interactor.PrepareTargets( transform.gameObject );
    15.                  foreach( TargetObject _target in _interactor.PreparedTargets )
    16.                         Creature.AddAvailableTarget( _target );
    17.                 }
    Then in your creature interactor setup create a new interactor for a gameobject and dont set the gameobject. Add your logic to attack the current attacker using this interactor the code above will set the gameobject when the creature is attacked.
    Works great for me, but requires that your creature doesn't interact with any other specific gameobjects obviously.
     
    montyfi likes this.
  11. monte_carlo

    monte_carlo

    Joined:
    Mar 26, 2015
    Posts:
    19
    Just wondering if this is the right place to ask for help?
    Having issues with damage to the player, so colliders seem to be working although the percentage doesn't add up, so hit value of 10 with a health of 100 kills the player in 11 hits with damage modifier @ 1, but what I cant work out is the player death animation or ragdoll, its tps and the player vanishes when it dies and I cant find options to refer to an animation or ragdoll ?
    Thank you, sorry if its the wrong place for the post or I didn't provide enough info.
     
  12. TonanBora

    TonanBora

    Joined:
    Feb 4, 2013
    Posts:
    493
    No worries Monte, this is indeed the correct place! :)
    The process for ragdoll death, and animation death are a little different;
    For Ragdoll:
    1) Create a ragdoll corpse for the creature.
    (Optional) ) Assign the tag "Corpse" to this corpse object. This is in case you have creatures that interact with corpse objects. If you don't have any of these, you can skip this step. :)
    2) Create a prefab of this corpse object, and delete it from the scene.
    3) Open the Status settings for your creature (the alive version).
    4) Scroll down, and enable the Corpse settings.
    5) Assign the corpse object prefab you just created to the gameObject field in the corpse settings.

    For Animation:
    1) Go into the creature's behaviors, and make sure it has a death behavior, if it does not, then you need to add a new behavior that will play the creature's death animation.
    2) Go into the creature's Essential settings, find the Default Behaviors section, and make sure the Dead behavior is enable, and using the correct behavior.
    3) Finally, go into the Status settings for the creature, find the "Remove Delay" setting, and set it to how long you want the corpse to stay before despawning.

    Hope this helps! :)
    Feel free to ask any ICE related questions here, there are plenty of nice, helpful people who might be willing to lend a hand (if they know the solution that is :p ).
     
    AndyNeoman likes this.
  13. AndyNeoman

    AndyNeoman

    Joined:
    Sep 28, 2014
    Posts:
    912
    Was just going to ask similar question. I have done all this but my creature goes straight to corpse without playing the death animation. I do have it enabled as default and have an animation that should play is there anything else I am missing?
     
  14. TonanBora

    TonanBora

    Joined:
    Feb 4, 2013
    Posts:
    493
    You should not have both a death animation, and a corpse set.
    If the Corpse is enabled, and set, it will use the corpse instead of the animation.
     
    AndyNeoman likes this.
  15. AndyNeoman

    AndyNeoman

    Joined:
    Sep 28, 2014
    Posts:
    912
    ahh ok,my mistake, I thought the manual said it played animation first. I will remove corpse.

    Cheers.
     
    Ryuichi173 likes this.
  16. xxhaissamxx

    xxhaissamxx

    Joined:
    Jan 12, 2015
    Posts:
    131
    i have issue with unity NavmeshAgent i'm making zombie enemies but my problem enemy keep pushing each other to get the player like this pic they didn't avoid each other did this asset can help me to make enemies avoid each other ?? thanks
     

    Attached Files:

  17. volak_

    volak_

    Joined:
    Feb 21, 2017
    Posts:
    7
    Give them larger stop distance in the interactors you've setup. By default they'll stop 2 units away which is far too close.

    Another option is to change "Overlap protection" so they avoid overlaps by offseting their movement position away from the overlap
     
    icetec likes this.
  18. yummybrainz

    yummybrainz

    Joined:
    Jan 14, 2014
    Posts:
    67
    I just purchased the asset and running into some issues.

    First, when I use the wizzard and click on generate after it selects the terrain. This deletes the current terrain and loads in some terrain I was working on in another scene with gaia. That terrain isn't even in this scene and it also shrinks the size as the max you can set it to is 2000. Is there another way to setup the scene besides the wizzard?

    Second, when I add a creature and plug everything in it doesn't animate. I'm using the African Animal pack. It looks like they start animating then pause even the animations are on a loop. Is that related to the wizzard terrain issue?

    Looking forward to some integration with Ultimate Survival asset as well!

    Thanks
     
  19. icetec

    icetec

    Joined:
    Mar 11, 2015
    Posts:
    592
    Hi yummybrainz,
    the terrain option of the wizard allows you to quickly create a test environment. Whenever you have already a terrain in your scene you can ignore this feature. Just ensure that the creatures are using the correct ground layer of the given terrain.

    Related to the animation issue, please ensure that the loop options are correctly specified in the animation settings, which is particularly important when multiple creatures share a controller and use the same animations at the same time. Also ensure that the correct WrapMode is defind in the Behaviour Animation setting of your creatures.

    Btw: The next update will include the integration for APEX, uMMORPG, Ultimate Survival and Invector.

    Have a great day!

    Pit
     
    Ryuichi173 and yummybrainz like this.
  20. yummybrainz

    yummybrainz

    Joined:
    Jan 14, 2014
    Posts:
    67
    Awesome! Really looking forward to how this progresses with Ultimate Survival. I have been using UFPS and Realistic FPS for years and love what these guys are doing.

    Looks like I had to switch it back and forth from walk to run back to walk under behaviors for some reason.

    Is the body rotation QUADRUPED what handles it's rotation on slope hills? It looks like I have to go in and set those manually even after declaring it a QUADRUPED in the wizard.
     
  21. monte_carlo

    monte_carlo

    Joined:
    Mar 26, 2015
    Posts:
    19




    Really appreciated, sorry it took so long coming back, thanks for the info, really useful..

    M
     
  22. Mafutta

    Mafutta

    Joined:
    Sep 30, 2014
    Posts:
    32
    Hi all. Is there a tutorial or notes on how to use with Gaia without using the wizard? ie not changing my terrain.
     
  23. TonanBora

    TonanBora

    Joined:
    Feb 4, 2013
    Posts:
    493
    Yah, don't use the ICE Wizard to setup your terrain. :p

    If you already have a working terrain, then all you have to do is make sure that the terrain's layer is added to the Creature Register's list of terrain layers (as well as your creature's list found in their Essential >> Pathfinding settings).
     
    icetec, Ryuichi173 and evilangel89 like this.
  24. Ryuichi173

    Ryuichi173

    Joined:
    Apr 12, 2015
    Posts:
    141
    Hi Pit,

    Think about it, how about prepare wizard for setup pre-build terrain, that mean, prepare choice for build demo scene automatic or setup current terrain for ICE?

    Even if how easy it is, beginner would confuse about setup becuase ICE has a lot of thing have to learn for start.
    Because of that, "detailed direction wizard for first setup" would prevent from impression of inaccessible, I think.

    regards,

    Ryuichi.
     
    icetec likes this.
  25. icetec

    icetec

    Joined:
    Mar 11, 2015
    Posts:
    592
    Yes, you are right. The additional terrain options can be really confusing for newcomers, so it is actually better to handle the terrain options in a separate wizard, so the Creature Wizard fully focuses on the creature settings.
     
    Ryuichi173 and evilangel89 like this.
  26. montyfi

    montyfi

    Joined:
    Aug 3, 2012
    Posts:
    548
    @icetec What is the easiest way to move creature at some point? I would like to slowly move creature after death from scene. It seems ICE prevents any movements from the code outside.
     
  27. icetec

    icetec

    Joined:
    Mar 11, 2015
    Posts:
    592
    Hi Montyfi,
    the easiest way to move a creature is to move its active target, so the creature will follow automatically, but you can handle it also by an own script. Here a small example for custom movements. Currently, the custom motion is only used when the creature is dead or seriously injured, but you can customize and extend the conditions as you wish.

    Code (CSharp):
    1.  
    2. using UnityEngine;
    3.  
    4. using ICE.Creatures;
    5. using ICE.Creatures.EnumTypes;
    6.  
    7. public class ICECreatureCustomMovements : MonoBehaviour {
    8.  
    9.     private ICECreatureControl m_Controller = null;
    10.     protected ICECreatureControl AttachedCreatureController{
    11.         get{ return m_Controller = ( m_Controller == null ? GetComponent<ICECreatureControl>() : m_Controller ); }
    12.     }
    13.  
    14.     void Update () {
    15.  
    16.         if( AttachedCreatureController == null )
    17.             return;
    18.  
    19.         // check conditions (adapt the conditions as desired)
    20.         if( AttachedCreatureController.Creature.Status.IsDead || AttachedCreatureController.Creature.Status.DurabilityInPercent < 5 )
    21.         {
    22.             // enable custom moves (this will stop all internal moves)
    23.             AttachedCreatureController.Creature.Move.MotionControl = MotionControlType.CUSTOM;
    24.  
    25.             // deactivate the internal gravity (this will stop internal gravity impacts)
    26.             AttachedCreatureController.Creature.Move.UseInternalGravity = false;
    27.  
    28.             // here you can insert your custom moves ... (example)
    29.             if( transform.position.y < 200 )
    30.                 transform.Translate( transform.up * 2 * Time.deltaTime );
    31.         }
    32.     }
    33. }
    Hope this will be helpful so far.

    Have a great day!

    Pit
     
    Last edited: Mar 31, 2017
    montyfi likes this.
  28. anunnaki2016

    anunnaki2016

    Joined:
    Jun 16, 2016
    Posts:
    93
    helloooo,

    Thanks for this asset

    i just buy this assets, but dont have any tutorial for ufps mp ;(( help me please
     
    icetec likes this.
  29. icetec

    icetec

    Joined:
    Mar 11, 2015
    Posts:
    592
    Hi anunnaki2016,
    thank you for purchasing ICE, I hope you will like it and enjoy the work with it.

    Before you start with ICE and UFPS MP, you must first combine PUN and UFPS with ICE. For this, we start with the UFPS integration, so please follow the steps below ...

    1. Open your Player Settings and add ICE_UFPS to the Scripting Define Symbols.
    2. Add the ICEWorldDamageAdapter to your creatures.

    Now the UFPS integration is done and you can start to prepare your creature as desired e.g. equip it with a ICECreatureRangedWeapon or ICECreatureMeleeWeapon or use the UFPS weapons and enjoy the fight ...

    The next task is to integrate PUN, for this, please follow the steps below ...

    1. Open your Player Settings and add ICE_PUN and ICE_CC to the Scripting Define Symbols.
    2. Add the ICEWorldNetworkView to your creatures and adapt the desired options.
    3. Add the ICEWorldNetworkSpawner to your CreatureRegister to handle the network spawning.

    Once this is done ICE works fine with PUN and UFPS. Finally, you can integrate the UFPS Multiplayer Kit, for this just open your Player Settings again and add ICE_UFPS_MP to the Scripting Define Symbols.

    But please note that there is an issue with spawning creatures and items while using the deathmatch scenario of the multiplayer kit. If all creatures and objects are already existing while loading the scene, everything works as expected, but if you instantiate objects during runtime, users who join the room later will not be able to see them.

    This issue based on a sycn problem, because the connection handling of the UFPS multiplayer kit reloads the scene as soon as the player character is created, but at this point, PUN has already performed its automatic synchronization (including all new spawned creatures), so that the sycn result will be overwritten by the later reload.

    You can use the ICEWorldNetworkManager to handle the connection independent of vp_connection and vp_master. By doing so, creatures and objects will be spawned correctly, but now the clients will not be able to see the remote player-character of the master client. But don't worry, I'm still working to provide a sollution for this and maybe someone here have also an idea to fix it or have already a sollution how to spawn objects during a UFPS multiplayer session or to sync a scene manually afterwards.

    Here you can find further information about the integration ...
    http://www.icecreaturecontrol.com/files/ICEIntegration.pdf
    ... and here about the damage handling ...
    http://www.icecreaturecontrol.com/files/ICEDamageHandling.pdf

    I hope this will be helpful to you so far but please feel free to contact me whenever you have questions or if you run into a problem with ICE and in urgent cases you can contact me also via skype.

    Have a great day!

    Pit
     
    Last edited: Mar 31, 2017
  30. Shadex

    Shadex

    Joined:
    Dec 18, 2013
    Posts:
    88
    Sweet, i've actually been waiting for the Invector integration.

    Questions:

    1) I know you handle flying enemys aka dragons, how does ICE handle the flight path, swooping down, etc?
    2) Does ICE handle spawning, or does it include a spawner? I'm mainly worried about performance, as i have 4kx4k terrains with 300-400 enemies.
     
  31. montyfi

    montyfi

    Joined:
    Aug 3, 2012
    Posts:
    548
    Thank you, works perfectly, had to disable RVO controller too.
    I have one more problem, in a small space, e.g. 5x5 meters, escape behavior often ends up rotating around itself in endless loop. Both with internal pathfinding and with A*. Anything I can fine tune to fix that?
     
  32. anunnaki2016

    anunnaki2016

    Joined:
    Jun 16, 2016
    Posts:
    93

    Thanks @icetec for the reply,

    i have small bug, My creatures slips instead of having the animations, I forget something?

    thanks for help
     
    Last edited: Apr 1, 2017
  33. progmeer

    progmeer

    Joined:
    Oct 5, 2012
    Posts:
    36
    Thanks for the tip! It doesn't fall to the ground anymore.
    Any suggestions for making the sword hit a creature when the swing animation is played?
     
    icetec likes this.
  34. anunnaki2016

    anunnaki2016

    Joined:
    Jun 16, 2016
    Posts:
    93
    Please i need help all creatures slips instead of having the animations ,
     
  35. icetec

    icetec

    Joined:
    Mar 11, 2015
    Posts:
    592
    Hi anunnaki2016, don't worry ... just ensure that the animation is running as loop. To do so, you can select the WrapMode LOOP in the animation settings of the behavior and if this does not work for you, open the respective animation directly and activate it as a loop pose.

    Have a great day!

    Pit
     
  36. anunnaki2016

    anunnaki2016

    Joined:
    Jun 16, 2016
    Posts:
    93
    @Ryuichi173 thanks i have found is just need add loop to wrapmod

    @icetec 100% work is loop yes i need add thanks my friend for help
     
  37. icetec

    icetec

    Joined:
    Mar 11, 2015
    Posts:
    592
    Hi progmeer, add the ICECreatureMeleeWeapon script and a suitable collider for the blade to your sword and define the impact values. Now add the sword as child object to the desired body part (e.g. hand) of your attacker. Please note, to receive damages an opponent will need one or more colliders (e.g. you can define single body parts by using the ICECreatureBodyPart script, so you can specify different impacts by adapting the "Damage Transfer Multiplier" of the body part status settings)

    Tip: your creature can use also its body parts or items as melee weapon, just activate the impact option and define the damage settings.

    Have a great day!

    Pit
     
  38. icetec

    icetec

    Joined:
    Mar 11, 2015
    Posts:
    592
    You are welcome!
     
  39. Ryuichi173

    Ryuichi173

    Joined:
    Apr 12, 2015
    Posts:
    141
    Oh my... it just slipped my mind!o_O
    That mean, I would met same problem in nearly future if you didn't ask this question!:D
     
    anunnaki2016 and icetec like this.
  40. icetec

    icetec

    Joined:
    Mar 11, 2015
    Posts:
    592
    Hi montyfi,
    if a creature is rotating around itself it has normally achieved the "Stopping Distance" of its last move position and need a new position or have to change its behaviour. You can stop this twisting behaviour by enable the BAN button of the "Stopping Distance", so a creature will stop as soon as it has reached the defined range.

    But if your creature is in a small room, it can be also that a creature can not reach the given position because of obstacles or shortage of space. Dependent to the given movements (e.g. forward and angular speed) and/or optional avoidance settings (e.g. Obstacle Avoidance or Overlap Prevention), the given move values (e.g. turning radius) could be simply unsuitable to run an exact maneuver. In such a case, it is helpful to exclude conceivable causes (e.g. deactivate the optional obstacle avoidance, decrease the speed or increase the angular speed and especially in your case, adapt the escape settings).

    If all this will not be helpful to you, it would be great if you could send me additional information about your scenario and maybe also a small clip which shows the issue. Also please feel free to contact me in skype, so we can check the scenario in realtime.

    Have a great day!

    Pit
     
  41. emperor12321

    emperor12321

    Joined:
    Jun 21, 2015
    Posts:
    52
    I've integrated with rfps and creatures can kill character but the rfps health is not affected. Is that how it is supposed to work?
     
  42. rasto61

    rasto61

    Joined:
    Nov 1, 2015
    Posts:
    334
    @icetec
    @TonanBora
    Any suggestions about what would be the best way to get ICE cc to move in right angles only?
     
  43. icetec

    icetec

    Joined:
    Mar 11, 2015
    Posts:
    592
    Hello Emperor12321, in v1.3.6 the RFPSP integration affects only the ICE based damage values, but you can change that quickly with a small script.

    Code (CSharp):
    1.  
    2. using UnityEngine;
    3.  
    4. using ICE.Integration;
    5. using ICE.Integration.Objects;
    6.  
    7. namespace ICE.Integration.Adapter
    8. {
    9.     public class ICERFPSPPlayerHealth : MonoBehaviour {
    10.        
    11.         // This overrides the EntityDamageConverter.DoHandleDamage method with the
    12.         // customized damage method and allows to use the original damage handler of the asset.
    13.         // Please note, after calling the constructor, there is no need to touch _dc anymore.
    14.         private DamageConverter _dc = new DamageConverter();
    15.     }
    16. }
    Here you can download the required script directly ...
    http://www.icecreaturecontrol.com/files/scripts/ICERFPSPPlayerHealth.unitypackage

    Just add this script to your creatures and all the rest will be handled automatically by the given integration scripts. ICE v1.3.7 will contain this feature directly in the ICEWorldDamageAdapter of ICEIntegration package.

    Have a great day!

    Pit
     
    emperor12321 likes this.
  44. emperor12321

    emperor12321

    Joined:
    Jun 21, 2015
    Posts:
    52
    Perfect! I appreciate it
     
  45. icetec

    icetec

    Joined:
    Mar 11, 2015
    Posts:
    592
    Hi rasto61,
    here you can find an example how you can adapt the given movements ...
    www.icecreaturecontrol.com/files/scripts/ICEGridMovements.unitypackage

    The script is using two delegates to adjusts the given positions and rotations of a creature to an adjustable grid and overrides the default values so that a creature can only move on the grid-lines to its targets. To use this script, just add it to your prepared creature-objects and adjust the grid size.


    Code (CSharp):
    1.  
    2. Controller.Creature.Move.OnUpdateMovePosition += DoUpdateMovePosition;
    3. Controller.Creature.Move.OnUpdateStepRotation += DoUpdateStepRotation;
    4.  
    Code (CSharp):
    1.  
    2.     /// <summary>
    3.     /// DoUpdateMovePosition can be used to override the default move position of a creature. This delegated method will be called on each frame update
    4.     /// </summary>
    5.     /// <param name="_sender">Sender.</param>
    6.     /// <param name="_origin_position">Origin position.</param>
    7.     /// <param name="_new_position">New position.</param>
    8.     private void DoUpdateMovePosition( GameObject _sender, Vector3 _transform_position, ref Vector3 _new_move_position )
    9.     {
    10.         // just to make sure that all required objects are available
    11.         if( Controller == null || Controller.Creature.ActiveTarget == null )
    12.             return;
    13.  
    14.         // the active target move position is the final destination the creature have to reach
    15.         Vector3 _target_move_position = Controller.Creature.ActiveTargetMovePosition;
    16.  
    17.         // this will adapt the target move position to the grid
    18.         Vector3 _grid_target_move_position = GetGridPosition( _target_move_position );
    19.  
    20.         // here we apapt the level of the new move position
    21.         m_GridMovePosition.y = transform.position.y;
    22.  
    23.         // if the creature is near to the given node point we have to generate the next one
    24.         if( Vector3.Distance( m_GridMovePosition, transform.position ) < Controller.Creature.Move.DesiredStoppingDistance )
    25.         {
    26.             // direction to the original target move position of the active target
    27.             Vector3 _dir = ( _target_move_position - transform.position ).normalized;
    28.  
    29.             // here we get the next grid position according to the direction and the specified grid size
    30.             Vector3 _next_grid_pos = GetGridPosition( transform.position + ( _dir * GridSize ) );
    31.  
    32.             // We do not want to allow diagonal movements, so we have to adjust all the paths that are longer than the grid size.
    33.             if( Vector3.Distance( m_GridMovePosition , _next_grid_pos ) > GridSize + Controller.Creature.Move.DesiredStoppingDistance )
    34.             {
    35.                 // ... in this case the selection of the direction will be done by chance
    36.                 if( UnityEngine.Random.Range( 0, 1 ) == 0 )
    37.                     _next_grid_pos.x = m_GridMovePosition.x;
    38.                 else
    39.                     _next_grid_pos.z = m_GridMovePosition.z;
    40.             }
    41.  
    42.             // we take the new position only if this is closer to the target than the current one
    43.             //if( ( _next_grid_pos - _grid_target_move_position ).magnitude < ( m_GridMovePosition - _grid_target_move_position ).magnitude )
    44.                
    45.             m_GridMovePosition = _next_grid_pos;
    46.             m_GridMoveRotation = Quaternion.LookRotation( ( m_GridMovePosition - transform.position ).normalized );
    47.                
    48.         }
    49.         else
    50.         {
    51.             // this code block makes sure that a creature is always on the grid
    52.             float _speed = ( Controller.Creature.Move.DesiredVelocity.z > 0 ? Controller.Creature.Move.DesiredVelocity.z : 1 ) * Time.deltaTime;
    53.             Vector3 _move_direction = ( m_GridMovePosition - transform.position );  
    54.             if( Mathf.Abs( _move_direction.x ) < Mathf.Abs( _move_direction.z ) )
    55.                 transform.position = Vector3.Lerp( transform.position, new Vector3( transform.position.x + _move_direction.x, transform.position.y, transform.position.z ), _speed );
    56.             else if( Mathf.Abs( _move_direction.z ) < Mathf.Abs( _move_direction.x ) )
    57.                 transform.position = Vector3.Lerp( transform.position, new Vector3( transform.position.x, transform.position.y, transform.position.z + _move_direction.z ), _speed );
    58.         }
    59.            
    60.         // here we finally override the default move position of the creature
    61.         _new_move_position = m_GridMovePosition;
    62.  
    63.     }
    64.  
    Code (CSharp):
    1.    
    2.     /// <summary>
    3.     /// DoUpdateStepRotation can be used to override the default step rotation of a creature. This delegated method will be called on each frame update
    4.     /// </summary>
    5.     /// <param name="_sender">Sender.</param>
    6.     /// <param name="_origin_rotation">Origin rotation.</param>
    7.     /// <param name="_new_rotation">New rotation.</param>
    8.     private void DoUpdateStepRotation( GameObject _sender, Quaternion _origin_rotation, ref Quaternion _new_rotation ){
    9.  
    10.         // here we adapt the rotation of the creature by using Quaternion.Lerp to turn the creature smoothly ...
    11.         _new_rotation = Quaternion.Lerp( _new_rotation, m_GridMoveRotation, Controller.Creature.Move.DesiredAngularVelocity.y * Time.deltaTime );
    12.  
    13.         // ... but you could also adjust the rotation directly without smoothing
    14.         //_new_rotation = Quaternion.LookRotation( ( m_GridMovePosition - transform.position ).normalized );
    15.     }
    16.  

    Have a great day!

    Pit
     
    Last edited: Apr 5, 2017
    Ryuichi173 likes this.
  46. rasto61

    rasto61

    Joined:
    Nov 1, 2015
    Posts:
    334
    Much obliged. Ill give this a go as soon as I can.
     
  47. anunnaki2016

    anunnaki2016

    Joined:
    Jun 16, 2016
    Posts:
    93
    helloo again @icetec

    Monster dont attack my player UFPS i have add all script but is just go run in map and no attack, what i need add ? for monster attack players ? i have add ICEWorldDamageAdapter and ICECreatureMeleeWeapon to creature , and script IceCreaturePlayer in my player UFPS, but creature dont attack me ;(

    thanks for help
     
    Last edited: Apr 6, 2017
  48. icetec

    icetec

    Joined:
    Mar 11, 2015
    Posts:
    592
    Hello anunnaki 2016,
    if a creature is to interact with other scene objects, it must be able to recognize the other objects as the target. For this you have to add these target objects as interactors and define the desired Interaction settings. Your creatures can have as much interactors as you want, but just one interactor will be active at a time. By using the Target Selection Criteria you can specify which interactor will be selected in a specific situation.

    The selection posibilities (especially by using the Advanced Selection Criteria) are nearly unlimited, but beside of all given conditions, the Priority will be the crucial factor, because in cases your creature will have more than one valid target at the same time, the final target will be selected by chance (e.g. the home location has a default priority of 0 and should always be the most insignificant target, but if your creature have an other target with the same priority, it could be that your creature will simply ignore it).

    To avoid such conflicts, just make sure, that your most relevant targets will have a higher priority than less significant targets.

    Here you can find some helpful video tutorials that show you how to set up interactors ...

    ICECreatureControl 1.1.18 - Interactors

    TonanBora's ICE basics

    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
     
  49. anunnaki2016

    anunnaki2016

    Joined:
    Jun 16, 2016
    Posts:
    93
    helloo @icetec

    i have small problem creature after die dont have corpse
    and Creature get dammage If he goes against the player

    thanks for help
     
    Last edited: Apr 11, 2017
    icetec likes this.
  50. Alex3333

    Alex3333

    Joined:
    Dec 29, 2014
    Posts:
    342
    There is a problem. If one player kills a creature, then only one player has a corpse. The other does not. (UFPS MP)
     
    icetec likes this.
unityunity