Skip to content

Instantly share code, notes, and snippets.

@Meowmaritus
Last active October 21, 2017 05:23
Show Gist options
  • Save Meowmaritus/b72c8a218fa589b1643f20088d541ce5 to your computer and use it in GitHub Desktop.
Save Meowmaritus/b72c8a218fa589b1643f20088d541ce5 to your computer and use it in GitHub Desktop.
Custom Shy Hollow AI Proof of Concept
function HusiShy250000Battle_Activate (ai, goal)
local actionChance = {}
local action = {}
local basicAttackConfig = {}
--Put default attacks in all the attack slots:
Common_Clear_Param(actionChance, action, basicAttackConfig);
--Distance from target:
local dist = ai:GetDist(TARGET_ENE_0)
--Event message last sent to this character:
local event = ai:GetEventRequest()
--[[
(dist and event can be used to select the pattern here)
--]]
--100% chance of doing action 2:
actionChance[2] = 100
--Note: Because we didn't specifically set the chances of any of the other actions, all of them will have a 0% chance
--Register HusiShy250000_Act02 as action 2
action[2] = REGIST_FUNC(ai, goal, HusiShy250000_Act02);
--I'm not 100% how adjust space's parameters work, so I copied the vanilla hollow ones.
local adjustSpaceParams = {0, 60, 10, 10, 20, 0}
local adjustSpaceFunc = REGIST_FUNC(ai, goal, HumanCommon_ActAfter_AdjustSpace, adjustSpaceParams);
Common_Battle_Activate(ai, goal, actionChance, action, adjustSpaceFunc, basicAttackConfig);
end
function HusiShy250000_Act02 (ai, goal, something)
--Approach target with some parameters I haven't quite figured out. One of them ought to be distance though.
goal:AddSubGoal(GOAL_COMMON_ApproachTarget, 30, POINT_INITIAL, 2, TARGET_SELF, false, -1);
--Not 100% sure what GetWellSpace is but probably something about chance of deciding to keep space between itself and target
GetWellSpace_Odds = 100
return GetWellSpace_Odds
end
function HusiShy250000Battle_Update (ai, goal)
--No update loop logic needed, since Common_Battle_Activate sets up an update thing to choose attacks and stuff for us.
--We return GOAL_RESULT_Continue in order to continue attacking (otherwise you'd return something else obviously).
return GOAL_RESULT_Continue
end
function HusiShy250000Battle_Terminate (ai, goal)
--This isn't ever used much. It would make the character stop attacking. Now when's the last time you saw that happen?
end
function HusiShy250000Battle_Interupt (ai, goal)
--Can not be interrupted. A typical AI will be interrupted on attack whif, player moving too far, etc.
return false
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment