MoveEvent If you wear a ring you hit more with SD

kimat

New Member
Joined
Jul 21, 2007
Messages
23
Best answers
0
Reaction score
2
CREATED BY Helveg
Modified by Kimat (me)

Explication: When you wear item id 2357 then you hit more with sd and ring disappear.

Movements.xml
Code:
<movevent event="Equip" itemid="2357"  slot="ring" function="onEquip" script="SDRing.lua" />
<movevent event="DeEquip" itemid="2357"  slot="ring" function="onDeEquip" script="SDRing.lua" />
SDRing.lua
Code:
function onEquip(cid)
  setPlayerStorageValue(cid, 4554,1) -- ACTIVATE
  end
 
function onDeEquip(cid)
  setPlayerStorageValue(cid, 4554,-1) -- DEACTIVATE
end
SPELL SD

Code:
-- config --
local percent = 50
local ring_id = 2357
-- config --

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SUDDENDEATH)
 
function Formula(cid)
  local min = (getPlayerLevel(cid) * 2 + getPlayerMagLevel(cid) *3) * 1.3 - 30
  local max = (getPlayerLevel(cid) * 2 + getPlayerMagLevel(cid) *3) * 1.6
  return min, max
end
 
function IncreaseRing(cid,min,max)
  if getPlayerStorageValue(cid,4554) == 1 then
    doPlayerRemoveItem(cid, ring_id, 1)
    return (min / 100) * percent + min,(max / 100) * percent + max
  end
  return min, max
end


function onCast(cid, target)
  local min,max = Formula(cid)
  min,max = IncreaseRing(cid, min, max)

  doTargetCombatHealth(0, target, COMBAT_PHYSICALDAMAGE, -min, -max, CONST_ME_MORTAREA)
end
 
setCombatCallback(combat, CALLBACK_PARAM_TARGETCREATURE, "onCast")
 
function onCastSpell(cid, var)
	return doCombat(cid, combat, var)
end
 

JayBeee

Retired Global Mod
Joined
Jun 2, 2007
Messages
5,225
Best answers
0
Reaction score
13
Location
Sweden
There's no
Lua:
 here, use normal [code] tags
 

Colandus

Advanced OT User
Joined
Jun 6, 2007
Messages
2,424
Best answers
18
Reaction score
165
Location
Sweden
You can make this script without onEquip, simply getPlayerSlotItem(cid, SLOT_ID).itemid ;)

Nice anyways ;)
 

Znote

<?php echo $title; ?>
Staff member
Global Moderator
Premium User
Joined
Feb 14, 2008
Messages
6,667
Best answers
202
Reaction score
1,375
Location
Norway, Oslo
Would be good with other runes like hmm, gfbs, makes lots of items that each item increase it a tiny bit, makes a sorcerer be able to specialice in diffrent runes, sounds funny

Im tired of everybody using UE or SD all the time, thats why I like serious servers with expensive runes :p
 

Ronaldino

Esso Eh
Joined
Dec 25, 2007
Messages
745
Best answers
0
Reaction score
0
Well I like it ! ;) Can you add also that if sorcerer or druid wear ring then hit more with sd, but if its paladin or something it hit normal?

Ah... there is a bug (?), no matter if you hit player or monster it get same damage... should be -50% damage when attacking player.
 
Last edited:

EvulMastah

๏̯͡๏﴿
Premium User
Joined
Aug 19, 2007
Messages
4,833
Best answers
0
Reaction score
184
it disappear when i use one.
Because of this:
Code:
function IncreaseRing(cid,min,max)
  if getPlayerStorageValue(cid,4554) == 1 then
    [B]doPlayerRemoveItem(cid, ring_id, 1)[/B]
    return (min / 100) * percent + min,(max / 100) * percent + max
  end
  return min, max
end
Just remove it or comment (--)
 

ScorpiOOn93

etherno.net
Joined
Jun 19, 2008
Messages
662
Best answers
0
Reaction score
0
Location
CookieLand :DDD
Players on my server told me that this script has got a bug.
If someone hit another player from this rune he can go to the PZ...rotfl

TFS 0.2.10
 

Colandus

Advanced OT User
Joined
Jun 6, 2007
Messages
2,424
Best answers
18
Reaction score
165
Location
Sweden
doTargetCombatHealth(cid, target, COMBAT_PHYSICALDAMAGE, -min, -max, CONST_ME_MORTAREA)


/\ FIX ;)
 

Jerry

I've Been Permanently Ban
Joined
Aug 17, 2008
Messages
1,697
Best answers
0
Reaction score
1
Location
Panama
This is a nice ring. I like the idea, How can i get it to work with HMM?
 

Mefiu

New Member
Joined
Mar 2, 2008
Messages
221
Best answers
0
Reaction score
0
Or how to make charges or duration so it doesnt dissapear after one shot ?
 

Zikerus

Nutria Developer
Joined
Mar 13, 2008
Messages
193
Best answers
0
Reaction score
0
Location
Poole, UK
uhm... easier way:
Code:
-- config --
local percent = 50
local ring_id = 2357
-- config --

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SUDDENDEATH)
 
function Formula(cid)
  local min = (getPlayerLevel(cid) * 2 + getPlayerMagLevel(cid) *3) * 1.3 - 30
  local max = (getPlayerLevel(cid) * 2 + getPlayerMagLevel(cid) *3) * 1.6
  return min, max
end
 
function IncreaseRing(cid,min,max)
  if (getPlayerSlotItem(cid, SLOT_RING) == ring_id) then
    doPlayerRemoveItem(cid, ring_id, 1)
    return (min / 100) * percent + min,(max / 100) * percent + max
  end
  return min, max
end


function onCast(cid, target)
  local min,max = Formula(cid)
  min,max = IncreaseRing(cid, min, max)

  doTargetCombatHealth(0, target, COMBAT_PHYSICALDAMAGE, -min, -max, CONST_ME_MORTAREA)
end
 
setCombatCallback(combat, CALLBACK_PARAM_TARGETCREATURE, "onCast")
 
function onCastSpell(cid, var)
	return doCombat(cid, combat, var)
end
I am not 100% sure if it works, but you can try (you don't have to use movements here) but basically it's easier because you don't have to check and set storages ;)
 

Colandus

Advanced OT User
Joined
Jun 6, 2007
Messages
2,424
Best answers
18
Reaction score
165
Location
Sweden
getPlayerSlotItem returns a table of 'thing'
 

Mefiu

New Member
Joined
Mar 2, 2008
Messages
221
Best answers
0
Reaction score
0
Can some1 make this script with charges ??
For example, the ring will dissappear after 5 shots with sd.
 

Colandus

Advanced OT User
Joined
Jun 6, 2007
Messages
2,424
Best answers
18
Reaction score
165
Location
Sweden
Actually, class item is based on class thing ;) but lua function getPlayerSlotItem returns id of item.
It returns thing -.-

Fix
Code:
-- config --
local percent = 50
local ring_id = 2357
-- config --

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SUDDENDEATH)
 
function Formula(cid)
  local min = (getPlayerLevel(cid) * 2 + getPlayerMagLevel(cid) *3) * 1.3 - 30
  local max = (getPlayerLevel(cid) * 2 + getPlayerMagLevel(cid) *3) * 1.6
  return min, max
end
 
function IncreaseRing(cid,min,max)
  local ring = getPlayerSlotItem(cid, SLOT_RING)
  if (ring.itemid == ring_id) then
    doRemoveItem(ring.uid)
    return (min / 100) * percent + min,(max / 100) * percent + max
  end
  return min, max
end


function onCast(cid, target)
  local min,max = Formula(cid)
  min,max = IncreaseRing(cid, min, max)

  doTargetCombatHealth(0, target, COMBAT_PHYSICALDAMAGE, -min, -max, CONST_ME_MORTAREA)
end
 
setCombatCallback(combat, CALLBACK_PARAM_TARGETCREATURE, "onCast")
 
function onCastSpell(cid, var)
	return doCombat(cid, combat, var)
end
 

taha94

New Member
Joined
Jun 12, 2009
Messages
168
Best answers
0
Reaction score
0
Location
Sweden
Were do i paste this spell sd??

Code:
-- config --
local percent = 50
local ring_id = 2357
-- config --

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SUDDENDEATH)
 
function Formula(cid)
  local min = (getPlayerLevel(cid) * 2 + getPlayerMagLevel(cid) *3) * 1.3 - 30
  local max = (getPlayerLevel(cid) * 2 + getPlayerMagLevel(cid) *3) * 1.6
  return min, max
end
 
function IncreaseRing(cid,min,max)
  local ring = getPlayerSlotItem(cid, SLOT_RING)
  if (ring.itemid == ring_id) then
    doRemoveItem(ring.uid)
    return (min / 100) * percent + min,(max / 100) * percent + max
  end
  return min, max
end


function onCast(cid, target)
  local min,max = Formula(cid)
  min,max = IncreaseRing(cid, min, max)

  doTargetCombatHealth(0, target, COMBAT_PHYSICALDAMAGE, -min, -max, CONST_ME_MORTAREA)
end
 
setCombatCallback(combat, CALLBACK_PARAM_TARGETCREATURE, "onCast")
 
function onCastSpell(cid, var)
	return doCombat(cid, combat, var)
end
 

RB Tonaa

New Member
Joined
Oct 1, 2009
Messages
20
Best answers
0
Reaction score
0
reload the script as you say fixed set Movements & scripts where the script will spell SD;/

not work
 
Top