Vexitron
New member
Hi. I had a programmer help me 2 years ago to get Zombies to Attack the player in Opsive (V2). I am on my own now, and a bit unfamiliar with the correct method for updating Opsive V2 to V3 custom Tasks (scripts).
Would anyone be able to tell me how to update this? I tried to apply it to an Agent in DeathMatch (I set up via DeathMatch Agent setup), then I customized a V3 Death Match Agent (Zombie) to use a customized/slightly updated version of the 'Solo' Behavior Tree - by replacing the 'Attack' Task with this custom 'Zombie Attack' Task (script) - which worked before in V2, but doesn't appear to be working in V3.
How to get poor Zombie to attack (it animates, walks to the player, just does not attack, plus it also does not do damage via melee)?
Again, I figure out stuff on my own, but this one has not been solved, and more time than I would like to admit. Your help would be most appreciated:
using UnityEngine;
using BehaviorDesigner.Runtime;
using BehaviorDesigner.Runtime.Tasks;
using Opsive.UltimateCharacterController.Character;
using Opsive.UltimateCharacterController.Character.Abilities.Items;
public class ZombieAttack : Action
{
public SharedGameObject target;
private UltimateCharacterLocomotion characterLocomotion;
public override void OnStart()
{
base.OnStart();
characterLocomotion = GetComponent<UltimateCharacterLocomotion>();
}
public override TaskStatus OnUpdate()
{
if (characterLocomotion != null)
{
var useAbility = characterLocomotion.GetAbility<Use>();
if (useAbility != null)
{
characterLocomotion.TryStartAbility(useAbility);
return TaskStatus.Success;
}
}
return TaskStatus.Failure;
}
}
Would anyone be able to tell me how to update this? I tried to apply it to an Agent in DeathMatch (I set up via DeathMatch Agent setup), then I customized a V3 Death Match Agent (Zombie) to use a customized/slightly updated version of the 'Solo' Behavior Tree - by replacing the 'Attack' Task with this custom 'Zombie Attack' Task (script) - which worked before in V2, but doesn't appear to be working in V3.
How to get poor Zombie to attack (it animates, walks to the player, just does not attack, plus it also does not do damage via melee)?
Again, I figure out stuff on my own, but this one has not been solved, and more time than I would like to admit. Your help would be most appreciated:
using UnityEngine;
using BehaviorDesigner.Runtime;
using BehaviorDesigner.Runtime.Tasks;
using Opsive.UltimateCharacterController.Character;
using Opsive.UltimateCharacterController.Character.Abilities.Items;
public class ZombieAttack : Action
{
public SharedGameObject target;
private UltimateCharacterLocomotion characterLocomotion;
public override void OnStart()
{
base.OnStart();
characterLocomotion = GetComponent<UltimateCharacterLocomotion>();
}
public override TaskStatus OnUpdate()
{
if (characterLocomotion != null)
{
var useAbility = characterLocomotion.GetAbility<Use>();
if (useAbility != null)
{
characterLocomotion.TryStartAbility(useAbility);
return TaskStatus.Success;
}
}
return TaskStatus.Failure;
}
}