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

Vengeance

Spo teh pro

New Member
Joined
Jan 3, 2008
Messages
319
Reaction score
1
Hello. I have this script (credits to nanondalt)
The script should usually make you (in this case) 30% residence against all type of attacks and those 30% should return to the attacker

example; A guy hits 100 with SD usually to me, I'll get hit 70 and he 30

but the script just makes the damager receive those 30% damage, I don't have any residence and I get the whole 100%
Help please

+repp!
Here is the scipt
Code:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Vengeance" version="1.0" author="Nandonalt" contact="[email protected]" enabled="yes">
<config name="vengeconf"><![CDATA[
        config = {  
                              storage = 4328,
                              time = 15,
                              percent_min = 20,
                              percent_max = 30,
                              manaused = 800                              
                              
        }
    ]]></config>
    <event type="statschange" name="VengeanceV" event="script"><![CDATA[
                            
function onStatsChange(cid, attacker, type, combat, value)
    domodlib('vengeconf')
if type == STATSCHANGE_HEALTHLOSS and value >= 1 then
local percentage = math.random(config.percent_min, config.percent_max)   
local formula = math.floor((percentage * value) / 100)   
 
 if getPlayerStorageValue(cid,config.storage) == 1 and isCreature(attacker) then
  doSendAnimatedText(getCreaturePosition(attacker),"-"..formula,COLOR_RED)
  doCreatureSay(cid,"Taste Vengeance!",19)
  doSendMagicEffect(getCreaturePosition(cid),17)
  doSendMagicEffect(getCreaturePosition(attacker),29)
  doCreatureAddHealth(attacker,-formula)
    end
  end
  return 1
  end
                        
    ]]></event>
    
<event type="login" name="VengeanceLogin" event="script"><![CDATA[                                                            
                                function onLogin(cid)
                                
                registerCreatureEvent(cid,"VengeanceV")
                local storage = 4328
if getPlayerStorageValue(cid,storage) == 1 then
 doPlayerSendCancel(cid,"Vengeance effect ended.")
  setPlayerStorageValue(cid,storage,-1) 
  doSendMagicEffect(getCreaturePosition(cid),17)
  else
  end
  return 1
  end
    ]]></event>    
<instant name="Vengeance" words="vengeance" lvl="85" mana="800" exhaustion="10000" needlearn="0" event="script" ><![CDATA[
domodlib('vengeconf')
local secs = config.time * 1000
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, 17)


function no_vengeance(param)
domodlib('vengeconf')
pid = getPlayerByNameWildcard(param.name)
    if(not pid or (isPlayerGhost(pid) and getPlayerGhostAccess(pid) > getPlayerGhostAccess(cid))) then
           else
  doPlayerSendCancel(pid,"Vengeance effect ended.")
  setPlayerStorageValue(pid,config.storage,-1) 
        doSendMagicEffect(getCreaturePosition(pid),17)
     end
     return 1
     end
     
function onCastSpell(cid, var)
domodlib('vengeconf')
if getPlayerStorageValue(cid,config.storage) == -1 then
    doCreatureSay(cid,"Vengeance!",19)
  setPlayerStorageValue(cid,config.storage,1) 
  addEvent(no_vengeance,secs,{cid = cid, name = getPlayerName(cid)})
doCombat(cid, combat, var)
  else
  doPlayerSendCancel(cid,"This spell is already active.")
doPlayerAddMana(cid,config.manaused)
  end
return 1
end
    ]]>
</instant></mod>
 
XML:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Vengeance" version="1.0" author="Nandonalt" contact="[email protected]" enabled="yes">
	<config name="vengeconf">
		<![CDATA[
			vengeConfig = {
				storage = 4388,
				time = 15,
				percentMin = 20,
				percentMax = 30,
				manaUsed = 800
			}
		]]>
	</config>
 
	<event type="statschange" name="VengeanceV" event="script">
		<![CDATA[
			function onStatsChange(cid, attacker, type, combat, value)
				domodlib('vengeconf')
 
				if type == STATSCHANGE_HEALTHLOSS and value >= 1 then
					local formula = math.floor((math.random(vengeConfig.percentMin, vengeConfig.percentMax) * value) / 100)
 
					if getCreatureStorage(cid,vengeConfig.storage) == 1 and isCreature(attacker) then
						doSendAnimatedText(getThingPos(attacker), formula, COLOR_RED)
						doSendMagicEffect(getThingPos(attacker), 29)
						doCreatureAddHealth(attacker, - formula)
 
						doCreatureSay(cid, 'Taste Vengeance!', 19)						
						doSendMagicEffect(getThingPos(cid), 17)
						doCreatureAddHealth(cid, - value + formula)
						doSendAnimatedText(getThingPos(cid), math.abs(- value + formula), COLOR_RED)
						return false
					end
				end
				return true
			end
		]]>
	</event>
 
	<event type="login" name="VengeanceLogin" event="script">
		<![CDATA[
			domodlib('vengeconf')
 
			function onLogin(cid)
				if getCreatureStorage(cid, vengeConfig.storage) == 1 then
					doPlayerSendCancel(cid, 'Vengeance effect ended.')
					doCreatureSetStorage(cid, vengeConfig.storage, -1)
					doSendMagicEffect(getThingPos(cid), 17)
				end
 
				registerCreatureEvent(cid, "VengeanceV")
				return true
			end
		]]>
	</event>
 
	<instant name="Vengeance" words="vengeance" lvl="85" mana="800" exhaustion="10000" needlearn="0" event="script">
		<![CDATA[
			domodlib('vengeconf')
 
			function stopVengeance(pid)
				if pid or isPlayerGhost(pid) ~= true then
					doPlayerSendCancel(pid, 'Vengeance effect ended.')
					doCreatureSetStorage(pid, vengeConfig.storage, -1)
					doSendMagicEffect(getCreaturePosition(pid), 17)
				end
			end
 
			function onCastSpell(cid, var)
				if getCreatureStorage(cid, vengeConfig.storage) == -1 then
					doCreatureSay(cid, 'Vengeance!', 19)
					doCreatureSetStorage(cid, vengeConfig.storage, 1)
					doSendMagicEffect(getThingPos(cid), 17)
 
					addEvent(stopVengeance, vengeConfig.time * 1000, cid)
				else
					doPlayerAddMana(cid, - vengeConfig.manaUsed)
					doPlayerSendCancel(cid, 'This spell is already active.')
					return false
				end
				return true
			end
		]]>
		
		<vocation id="4"/>
		<vocation id="8"/>
	</instant>
 
</mod>
 
Last edited:
Thank you! :) It is working now
I also wanted that only knights can use it but I fixed it myself
(so much .lua knowlegde) yay (=

You are welcome when my server is up =P

I rep++ u ;)
Thanks again :)
 
I found some bug.
Always when I log in it says "Vengeance effect ended" and I get the starter equipment (torch, jacket, club and bag)
huh?o_O

help please? :O
 
Thanks :)
It is working. I would like to give you more reputation but I can't, I need to spread to someone else first
Anyways, very kind of you
 
Back
Top