• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Solved Special Bow/Arrow

Who is next

New Member
Joined
Mar 9, 2015
Messages
4
Reaction score
0
Hello I need to know how to make special arrow attack only with special bow? Something like Bow is attacking with arrow/brust arrow what if i need to make only arrow which can be used by bow only not another bow

And what is slot of bow on movements? i've made it two hands but i can carry it on any level
 
Last edited by a moderator:
You need to post your server version.

Add bows in weapons.xml for level.
To have a certain arrow only work with 1 bow you can create a Lua script for the arrow and check for slot item.
 
You need to post your server version.

Add bows in weapons.xml for level.
To have a certain arrow only work with 1 bow you can create a Lua script for the arrow and check for slot item.
Ah sorry my tfs is 0.3.6 Hmmm i can't understand how to many it :( i mean lua script :S
 
Check if the bow is in 1 of the hand slots, if it is, do the combat.
Code:
if getPlayerSlotItem(cid, CONST_SLOT_RIGHT).itemid == x or getPlayerSlotItem(cid, CONST_SLOT_LEFT).itemid == x then
Instead of x add the itemid.
 
Check if the bow is in 1 of the hand slots, if it is, do the combat.
Code:
if getPlayerSlotItem(cid, CONST_SLOT_RIGHT).itemid == x or getPlayerSlotItem(cid, CONST_SLOT_LEFT).itemid == x then
Instead of x add the itemid.
Is it on the lua of arrow? or where?
 
Yes, add it to the Lua script of the arrow, if it doesn't have a Lua script, you can use 1 of the other arrow scripts as example.
 
Check if the bow is in 1 of the hand slots, if it is, do the combat.
Code:
if getPlayerSlotItem(cid, CONST_SLOT_RIGHT).itemid == x or getPlayerSlotItem(cid, CONST_SLOT_LEFT).itemid == x then
Instead of x add the itemid.
May you explain it more please? cuz i tried to make it but i couldn't and i need this script too
Edited
I tried to make it on lua of arrow but got error
Code:
if getPlayerSlotItem(cid, CONST_SLOT_RIGHT).itemid == 8858 or getPlayerSlotItem(cid, CONST_SLOT_LEFT).itemid == 8858 then
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 1)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ETHEREALSPEAR)

function onGetFormulaValues(cid, level, skill, attack, factor)
     local min = 90 * skill
     local max = 100 * skill
     return -min, -max
end

setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

function onUseWeapon(cid, var)
     return doCombat(cid, combat, var)
end
Code:
[11/03/2015 22:21:30] [Error - LuaScriptInterface::loadFile] data/weapons/scripts/pally arrow.lua:17: 'end' expected (to close 'if' at line 1) near '<eof>'
[11/03/2015 22:21:30] [Warning - Event::loadScript] Cannot load script (data/weapons/scripts/pally arrow.lua)
[11/03/2015 22:21:30] data/weapons/scripts/pally arrow.lua:17: 'end' expected (to close 'if' at line 1) near '<eof>'
 
Add it inside the function (function onUseWeapon), everything outside the function is loaded on startup, so this is just for things that will always be the same and are called in the function.
Also if statements need to close with end. If the if statement is true, it should do the combat, so this if statement should be above doCombat.
 
Add it inside the function (function onUseWeapon), everything outside the function is loaded on startup, so this is just for things that will always be the same and are called in the function.
Also if statements need to close with end. If the if statement is true, it should do the combat, so this if statement should be above doCombat.
Hmm that's the script now and i don't have any bug but still can attack with this arrow with any bow
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 1)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ETHEREALSPEAR)

function onGetFormulaValues(cid, level, skill, attack, factor)
     local min = 90 * skill
     local max = 100 * skill
     return -min, -max
end

setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

function onUseWeapon(cid, var)
if getPlayerSlotItem(cid, CONST_SLOT_RIGHT).itemid == 8858 or getPlayerSlotItem(cid, CONST_SLOT_LEFT).itemid == 8858 then
end
     return doCombat(cid, combat, var)
end
 
doCombat should be under/inside the if statement, now if someone is using that bow there won't be any different since there is nothing added between if and end.
Code:
if getPlayerSlotItem(cid, CONST_SLOT_RIGHT).itemid == 8858 or getPlayerSlotItem(cid, CONST_SLOT_LEFT).itemid == 8858 then -- if the player has the bow in 1 of his hands
     -- everything added here will happen if the player has the bow in 1 of his hands
end
-- everything here will always happen
 
doCombat should be under/inside the if statement, now if someone is using that bow there won't be any different since there is nothing added between if and end.
Code:
if getPlayerSlotItem(cid, CONST_SLOT_RIGHT).itemid == 8858 or getPlayerSlotItem(cid, CONST_SLOT_LEFT).itemid == 8858 then -- if the player has the bow in 1 of his hands
     -- everything added here will happen if the player has the bow in 1 of his hands
end
-- everything here will always happen
I made it like this and its working good :P
Code:
function onUseWeapon(cid, var)
if getPlayerSlotItem(cid, CONST_SLOT_RIGHT).itemid == 8858 or getPlayerSlotItem(cid, CONST_SLOT_LEFT).itemid == 8858 then
doCombat(cid, combat, var)
end
end
Is it correct ? or there is something wrong?
 
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 1)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ETHEREALSPEAR)

function onGetFormulaValues(cid, level, skill, attack, factor)
local min = 90 * skill
local max = 100 * skill
return -min, -max
end

setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

function onUseWeapon(cid, var)
doCombat(cid, combat, var)
return true
end

Then in moveEvents edit your xml and change the values for itemid 8858...if you cant find it then put it in there manually. Make sure it is linked to the correct file. Takes out the if statement because its not needed.
 
Why do all this?
Code:
local min = 90 * skill
local max = 100 * skill
return -min, -max
It is simpler to just do this.
Code:
return -(90 * skill), -(100 * skill)
 
Already solved it
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 1)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_PIERCINGBOLT)

function onGetFormulaValues(cid, level, skill, attack, factor)
     local min = 3 * skill + attack + 400 + (level/4)
     local max = 6 * skill + attack + 600 + (level/3)
     return -min, -max
end

setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

function onUseWeapon(cid, var)
if getPlayerSlotItem(cid, CONST_SLOT_RIGHT).itemid == 8850 or getPlayerSlotItem(cid, CONST_SLOT_LEFT).itemid == 8850 then
doCombat(cid, combat, var)
end
end
Thanks.
 
Back
Top