Yan18
Member
- Joined
- Jun 14, 2014
- Messages
- 104
- Solutions
- 3
- Reaction score
- 17
Hello folks!
As the title said, I would like to know how to force monsters focus on the summons players always the players have summons? I tried:
in Data/Events/Scripts/creature.lua:
The code above even works, but constantly the monster change the target between the player and summon.
I tried too in monster.xml (monster file, not the file that contains the monsters file registered) set target chance to 0:
But the monsters always focus the player firstly and after that never change the target more while him lose the focus. I belive the monster focus the player first even I have summon before the monster can target, is because the source.
And lastly I tried to set in monster.xml set chance to 100 and interval to 1 in target tag bevause the first case, the monster focus firstly the player, and happen the same problem of the first case, the monster change the target constantly:
To solve the problem, is in sourvce (C++) or in Lua?
As the title said, I would like to know how to force monsters focus on the summons players always the players have summons? I tried:
in Data/Events/Scripts/creature.lua:
Lua:
function Creature:onTargetCombat(target)
if not self then
return RETURNVALUE_NOERROR
end
if target:isPlayer() and self:isMonster() then
if #target:getSummons() >= 1 then
self:setTarget(target:getSummons()[1])
return true
else
return false
end
end
return RETURNVALUE_NOERROR
end
The code above even works, but constantly the monster change the target between the player and summon.
I tried too in monster.xml (monster file, not the file that contains the monsters file registered) set target chance to 0:
XML:
<targetchange interval="1000" chance="0" />
But the monsters always focus the player firstly and after that never change the target more while him lose the focus. I belive the monster focus the player first even I have summon before the monster can target, is because the source.
And lastly I tried to set in monster.xml set chance to 100 and interval to 1 in target tag bevause the first case, the monster focus firstly the player, and happen the same problem of the first case, the monster change the target constantly:
XML:
<targetchange interval="1" chance="100" />
To solve the problem, is in sourvce (C++) or in Lua?