• 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!

throwing knife additional attack

megazx

Graphic designer
Joined
Mar 4, 2013
Messages
443
Solutions
2
Reaction score
32
Location
Egypt
i need the throwing knife script that when you have more than one knife u have additional attack


like one knife attack 100 when i have 2 knives its attack will be 100+1

50 knife will be attack 100+50

please respond fast
 
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 1)
setCombatParam(combat, COMBAT_PARAM_BLOCKSHIELD, 1)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_THROWINGKNIFE)

function onGetFormulaValues(cid, level, skill, attack, factor)
     local extra = getPlayerItemCount(cid, 2410) > 100 and 100 or getPlayerItemCount(cid, 2410)
     return 0, -(0.08 * (attack + extra) * skill + (level/5))
end

setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

function onUseWeapon(cid, var)
     return doCombat(cid, combat, var)
end
 
nothing happened its still the same no attack was added and there is no errors using 0.4 tfs


PHP:
    <distance id="2410" event="script" value="throwing_knife.lua"/>


weapons/scripts/throwing_knife
PHP:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 1)
setCombatParam(combat, COMBAT_PARAM_BLOCKSHIELD, 1)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_THROWINGKNIFE)

function onGetFormulaValues(cid, level, skill, attack, factor)
     local extra = getPlayerItemCount(cid, 2410) > 100 and 100 or getPlayerItemCount(cid, 2410)
     return 0, -(0.08 * (attack + extra) * skill + (level/5))
end

setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

function onUseWeapon(cid, var)
     return doCombat(cid, combat, var)
end
 
There is extra attack in the weapon script, but you don't see it when you click look on the throwing knifes.
I did 100 extra attack as max, without limit the extra damage could make it to overpowered.
But you can make the 100 higher if you want that it's possible to have for example 200 extra attack with 200 throwing knifes.
 
i really appreciate what u did but could u please make it seen when look on it and another thing could u make after 50 knife , attack added for every 4 knives

will add +1 not like the first 50 knife every knife add +1
thanks for your effort ..
 
Creaturescript:
Code:
function onLook(cid, thing, position, lookDistance)
     if thing.itemid == 2410 then
         local info, extra = getItemInfo(thing.itemid), thing.type
         if extra > 1 then
             text, text2 = extra .. " " .. info.plural, "They weigh"
         else
             text, text2 = info.article .. " " .. info.name, "It weighs"
         end
         if extra > 50 then
             extra = math.floor(((extra - 50)/4) + 50)
         end
         doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You see "..text.." (Atk:"..(info.attack+(extra-1)).."). "..text2.." "..getItemWeight(thing.uid).." oz.")
         return false
     end
     return true
end

Weapon:
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 1)
setCombatParam(combat, COMBAT_PARAM_BLOCKSHIELD, 1)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_THROWINGKNIFE)

function onGetFormulaValues(cid, level, skill, attack, factor)
     local extra = getPlayerSlotItem(cid, CONST_SLOT_RIGHT).itemid == 2410 and getPlayerSlotItem(cid, CONST_SLOT_RIGHT).type or getPlayerSlotItem(cid, CONST_SLOT_LEFT).type
     if extra > 50 then
         extra = math.floor(((extra - 50)/4) + 50)
     end
     return 0, -(0.08 * (attack + (extra-1)) * skill + (level/5))
end

setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

function onUseWeapon(cid, var)
     return doCombat(cid, combat, var)
end
 
Last edited:
the knife working but the look on it its still the same
02:17 You see 5 throwing knives (Atk:130).
They weigh 25.00 oz.

no errors in console

PHP:
    <event type="look" name="knife" event="script" value="knife.lua"/>

creaturescripts/scripts/knife.lua

PHP:
function onLook(cid, thing, position, lookDistance)
     if thing.itemid == 2410 then
         local info, extra = getItemInfo(thing.itemid), thing.type
         if extra > 1 then
             text, text2 = extra .. " " .. info.plural, "They weigh"
         else
             text, text2 = info.article .. " " .. info.name, "It weighs"
         end
         if extra > 50 then
             extra = math.floor(((extra - 50)/4) + 50)
         end
         doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You see "..text.." (Atk:"..(info.attack+(extra-1)).."). "..text2.." "..getItemWeight(thing.uid).." oz.")
         return false
     end
     return true
end
 
:rolleyes: oh forgot that now its working thanks to you last thing please on look it say

12:56 You see 3 throwing knives (Atk:132). They weigh 15 oz.

could u make it like this 12:56 You see 3 throwing knives (Atk:130+2). They weigh 15 oz.

the normal attack and the extra :)

thanks in advance ...
 
Back
Top