Vladimir Glebov
http://www.zorgania.com
Hello im need open Movement through player by player and
how to off get skull when use Avalance runes example.
how to off get skull when use Avalance runes example.
function Creature:onAreaCombat(tile, isAggressive)
local target = self:getTarget()
if target and target:isMonster() then
local c = tile:getTopCreature()
if c and c:isPlayer() then
return RETURNVALUE_NOTPOSSIBLE
end
end
return true
end
easy!
Code:onstepin if getTopCreature next position is player then teleportTo from position else teleportTo to position true end return true end
For the area combat spells you can do something like this.
Like this if a player targets a monster and there is an other player in the area combat, it won't attack the other player so the player won't get a skull while hunting monsters, I assume this is what you ment.Code:function Creature:onAreaCombat(tile, isAggressive) local target = self:getTarget() if target and target:isMonster() then local c = tile:getTopCreature() if c and c:isPlayer() then return RETURNVALUE_NOTPOSSIBLE end end return true end
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ICEAREA)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ICE)
combat:setArea(createCombatArea(AREA_CIRCLE3X3))
function Creature:onAreaCombat(tile, isAggressive)
local target = self:getTarget()
if target and target:isMonster() then
local c = tile:getCreatures()
if c and c:isPlayer() then
return RETURNVALUE_NOTPOSSIBLE
end
end
return true
end
function onGetFormulaValues(player, level, maglevel)
local min = (level / 5) + (maglevel * 1.2) + 7
local max = (level / 5) + (maglevel * 2.85) + 16
return -min, -max
end
combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
function onCastSpell(creature, var, isHotkey)
return combat:execute(creature, var)
end
Change the function here.
https://github.com/otland/forgottenserver/blob/master/data/events/scripts/creature.lua#L5-#L7
And enable it in events.xml by changing 0 to 1.
https://github.com/otland/forgottenserver/blob/master/data/events/events.xml#L5
Change the function here.
https://github.com/otland/forgottenserver/blob/master/data/events/scripts/creature.lua#L5-#L7
And enable it in events.xml by changing 0 to 1.
https://github.com/otland/forgottenserver/blob/master/data/events/events.xml#L5
The code I posted makes it unable to hit a player in the combat area when you target a monster, if you don't target a monster, you can still damage players with area combats.
<?xml version="1.0" encoding="UTF-8"?>
<events>
<!-- Creature methods -->
<event class="Creature" method="onChangeOutfit" enabled="0" />
<event class="Creature" method="onAreaCombat" enabled="0" />
<event class="Creature" method="onTargetCombat" enabled="0" />
<!-- Party methods -->
<event class="Party" method="onJoin" enabled="0" />
<event class="Party" method="onLeave" enabled="0" />
<event class="Party" method="onDisband" enabled="0" />
<!-- Player methods -->
<event class="Player" method="onBrowseField" enabled="0" />
<event class="Player" method="onLook" enabled="1" />
<event class="Player" method="onLookInBattleList" enabled="1" />
<event class="Player" method="onLookInTrade" enabled="1" />
<event class="Player" method="onLookInShop" enabled="0" />
<event class="Player" method="onMoveItem" enabled="0" />
<event class="Player" method="onMoveCreature" enabled="1" />
<event class="Player" method="onTurn" enabled="0" />
<event class="Player" method="onTradeRequest" enabled="0" />
<event class="Player" method="onTradeAccept" enabled="0" />
<event class="Player" method="onGainExperience" enabled="1" />
<event class="Player" method="onLoseExperience" enabled="0" />
<event class="Player" method="onGainSkillTries" enabled="1" />
</events>
function Creature:onChangeOutfit(outfit)
return true
end
function Creature:onAreaCombat(tile, isAggressive)
return true
end
function Creature:onTargetCombat(target)
return true
end
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ICEAREA)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ICE)
combat:setArea(createCombatArea(AREA_CIRCLE3X3))
function Creature:onAreaCombat(tile, isAggressive)
local target = self:getTarget()
if target and target:isMonster() then
local c = tile:getCreatures()
if c and c:isPlayer() then
return RETURNVALUE_NOTPOSSIBLE
end
end
return true
end
function onGetFormulaValues(player, level, maglevel)
local min = (level / 5) + (maglevel * 1.2) + 7
local max = (level / 5) + (maglevel * 2.85) + 16
return -min, -max
end
combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
function onCastSpell(creature, var, isHotkey)
return combat:execute(creature, var)
end
<event class="Creature" method="onAreaCombat" enabled="1" />
function Creature:onAreaCombat(tile, isAggressive)
return true
end
function Creature:onAreaCombat(tile, isAggressive)
local target = self:getTarget()
if target and target:isMonster() then
local c = tile:getTopCreature()
if c and c:isPlayer() then
return RETURNVALUE_NOTPOSSIBLE
end
end
return true
end
You have to enable events if you use them.
Code:<event class="Creature" method="onAreaCombat" enabled="1" />
Change
ToCode:function Creature:onAreaCombat(tile, isAggressive) return true end
And remove it from the rune script.Code:function Creature:onAreaCombat(tile, isAggressive) local target = self:getTarget() if target and target:isMonster() then local c = tile:getTopCreature() if c and c:isPlayer() then return RETURNVALUE_NOTPOSSIBLE end end return true end
What do you mean with "but im can off its full"?
local target = self:getTarget()
if target and target:isMonster() then
end
You can remove the target check.
But then you won't be able to use it on players at all.Code:local target = self:getTarget() if target and target:isMonster() then end