Jump to content

Recommended Posts

Hi!

I'm currently working on a mod (3 player coop - http://steamcommunity.com/sharedfiles/filedetails/?id=172291214) and we have 1 really big problem with 2player, he cannot attack(

I press attack button 2player turns to enemy-target, but does nothing.

 

Here is code what 2player use to attack:

 

{Code from 2player controlling (file in mod-folder called "playercontroller_3")}

Function PlayerController_3:DoAttackButton()
local attack_target = self:GetAttackTarget()
if attack_target and self.inst.components.combat.target ~= attack_target then
local action = BufferedAction(self.inst, attack_target, ACTIONS.ATTACK)
self.inst.components.locomotor:PushAction(action, true)
else
return
end
end

 

Function PlayerController_3:AttackActClear()
self.inst:RemoveTag("attackest")
self.inst.components.locomotor:Clear()
local target = nil
self.inst.components.combat:GiveUp()
end

 

{Code from 2player brain (file in mod-folder called "summonclonebrain")}

 

function summonclonebrain:OnStart()

local root = PriorityNode({
WhileNode( function() return self.inst.components.combat.target and self.inst:HasTag("attackest") end, "AttackMomentarily",

ChaseAndAttack(self.inst, MAX_CHASE_TIME) ), },0)
self.bt = BT(self.inst, root)
end

 

 

You can download it from here  http://rghost.ru/51218588

 

 

Thanx for reading, if somebody know how to fix this, please help.

Edited by Desblat
Link to comment
https://forums.kleientertainment.com/forums/topic/30575-questionattack-problem/
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...