• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

[Weapon] Weapon with 10% chance of a double hit

Limos

Senator
Premium User
Joined
Jun 7, 2010
Messages
10,013
Solutions
8
Reaction score
3,056
Location
Netherlands
I made this script as a request, I liked the idea myself, so incase other people want it too.

Weapons.xml
XML:
<melee id="xxxx" level="20" unproperly="1" event="script" value="weapon.lua"/>

Weapon.lua
Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 1)
setCombatParam(combat, COMBAT_PARAM_BLOCKSHIELD, 1)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatFormula(combat, COMBAT_FORMULA_SKILL, 0, 0, 1.0, 0)
   
function onUseWeapon(cid, var)
   local chance = math.random(1,10)
   if chance == 1 then
     doCombat(cid, combat, var)
     addEvent(doCombat, 400, cid, combat, var)
     doSendAnimatedText(getPlayerPosition(cid),"Doublehit", TEXTCOLOR_RED)
   else
     doCombat(cid, combat, var)
   end
   return true
end
 
Last edited:
I only tested it on tfs 0.3.6pl1, but I think it should work on 9.x if you remove the animated text (I never used a 9.x server myself, but I heard they removed this function in the 9.x servers).
Lua:
doSendAnimatedText(getPlayerPosition(cid),"Doublehit", TEXTCOLOR_RED)
And else you can post the errors here and I can try to find alternative codes.
 
Last edited:
Back
Top