Skip to content

Instantly share code, notes, and snippets.

@Suor
Created December 5, 2020 17:30
Show Gist options
  • Save Suor/5e72aa3e8d668c4dad1e6e449322d119 to your computer and use it in GitHub Desktop.
Save Suor/5e72aa3e8d668c4dad1e6e449322d119 to your computer and use it in GitHub Desktop.
Inherit ai
this.tb_orc_berserker_agent <- this.inherit("scripts/ai/tactical/orc_berserker_agent", {
m = {},
function create()
{
this.orc_berserker_agent.create();
this.m.Properties ...
}
function onAddBehaviors()
{
this.orc_berserker_agent.create();
this.addBehavior(this.new("scripts/ai/tactical/behaviors/ai_split"));
}
})
this.orc_berserker_agent <- this.inherit("scripts/ai/tactical/agent", {
m = {},
function create()
{
this.agent.create();
this.m.ID = this.Const.AI.Agent.ID.OrcBerserker;
this.m.Properties.TargetPriorityHitchanceMult = 0.5;
this.m.Properties.TargetPriorityHitpointsMult = 0.25;
this.m.Properties.TargetPriorityRandomMult = 0.0;
this.m.Properties.TargetPriorityDamageMult = 0.25;
this.m.Properties.TargetPriorityFleeingMult = 0.8;
this.m.Properties.TargetPriorityHittingAlliesMult = 0.1;
this.m.Properties.TargetPriorityFinishOpponentMult = 3.0;
this.m.Properties.TargetPriorityCounterSkillsMult = 0.5;
this.m.Properties.TargetPriorityArmorMult = 0.8;
this.m.Properties.OverallDefensivenessMult = 0.33;
this.m.Properties.OverallFormationMult = 0.0;
this.m.Properties.OverallMagnetismMult = 0.0;
this.m.Properties.EngageFlankingMult = 1.5;
this.m.Properties.EngageTargetMultipleOpponentsMult = 0.75;
this.m.Properties.EngageTargetArmedWithRangedWeaponMult = 1.5;
this.m.Properties.EngageTargetAlreadyBeingEngagedMult = 1.5;
this.m.Properties.EngageAgainstSpearwallMult = 1.1;
this.m.Properties.EngageRangeMin = 1;
this.m.Properties.EngageRangeMax = 2;
this.m.Properties.EngageRangeIdeal = 2;
}
function onAddBehaviors()
{
this.addBehavior(this.new("scripts/ai/tactical/behaviors/ai_flee"));
this.addBehavior(this.new("scripts/ai/tactical/behaviors/ai_defend"));
this.addBehavior(this.new("scripts/ai/tactical/behaviors/ai_charge"));
this.addBehavior(this.new("scripts/ai/tactical/behaviors/ai_engage_melee"));
this.addBehavior(this.new("scripts/ai/tactical/behaviors/ai_break_free"));
this.addBehavior(this.new("scripts/ai/tactical/behaviors/ai_attack_default"));
this.addBehavior(this.new("scripts/ai/tactical/behaviors/ai_attack_thresh"));
this.addBehavior(this.new("scripts/ai/tactical/behaviors/ai_attack_splitshield"));
}
function onUpdate()
{
local item = this.getActor().getItems().getItemAtSlot(this.Const.ItemSlot.Mainhand);
if (item != null)
{
if (item.isItemType(this.Const.Items.ItemType.TwoHanded))
{
this.m.Properties.EngageTargetMultipleOpponentsMult = -1.0;
}
else
{
this.m.Properties.EngageTargetMultipleOpponentsMult = 0.75;
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment