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

CreatureEvent Furious +Attackspeed

Mooosie

- Lua Scripter -
Joined
Aug 2, 2008
Messages
702
Reaction score
27
Location
Sweden
Hello!
This creaturescript increase your attack speed for X seconds when you are in combat.


Create a .lua file in data/creaturescript/scripts/ named furious.lua and paste this in:
Lua:
function onCombat(cid, target)
local config = {
chance = 5, -- Chance
duration = 2, -- How long the effect will last (in seconds)
storage = 247, -- storage (choose a unused storage)
increasespeed = 5 -- How much your attack speed will be increased (in seconds)
}

if isKnight(cid) then -- Witch vocation can get this attribute.
-- isPaladin(cid) or isSorcerer(cid) or isDruid(cid) then 
-- for all vocations
function stopExtraAttack()
         doPlayerSetExtraAttackSpeed(cid,0)
         doSendMagicEffect(getCreaturePosition(cid), 30)
         setPlayerStorageValue(cid, config.storage, 0)
		 doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your attack speed is back to normal.")
   return true
end

	if math.random(0,100) <= config.chance then
		if(getPlayerStorageValue(cid,config.storage) <= 0) then
           doPlayerSetExtraAttackSpeed(cid, config.increasespeed * 1000)
           doSendAnimatedText(getCreaturePosition(cid), "+AtkSpeed", 20)
		   doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You attack speed is increased with ".. config.increasespeed .." seconds.")
           setPlayerStorageValue(cid, config.storage, 1)
           addEvent(stopExtraAttack, config.duration * 1000)
           doSendMagicEffect(getCreaturePosition(cid), 29)
		end
    end
end
-- end
return true
end

Put this in your data/creaturescripts/creaturescript.xml:
XML:
	<event type="combat" name="Furious" event="script" value="furious.lua"/>
After:
XML:
<?xml version="1.0" encoding="UTF-8"?>
<creaturescripts>

For noobs:
XML:
<?xml version="1.0" encoding="UTF-8"?>
<creaturescripts>
      <event type="combat" name="Furious" event="script" value="furious.lua"/>

Put this in login.lua in data/creaturescripts/scripts/login.lua:
Lua:
	registerCreatureEvent(cid, "Furious")
Before:
Lua:
	return true
end

THEN YOUR DONE! Enjoy :)

CREDITS:

iuniX in OTServ Brasil, darkhaos for doing the Lua function doPlayerSetExtraAttackSpeed(cid, speed) 'n me for editing the script a little bit.​
 
Last edited:
Back
Top