Lua Mana/Life Rune - Spells

FearWar

Member
Joined
Sep 17, 2017
Messages
71
Reaction score
3
Location
Brasil
I am making a foundation for the ultimate cure to make a life / rune mana!

Lua:
attackType = ATTACK_NONE
animationEffect = NM_ANI_NONE
 
hitEffect = NM_ME_NONE
damageEffect = NM_ME_MAGIC_POISEN
animationColor = GREEN
offensive = false
drawblood = false
 
BlessedUltimateObject = MagicDamageObject(attackType, animationEffect, hitEffect, damageEffect, animationColor, offensive, drawblood, 0, 0)
 
function onCast(cid, creaturePos, level, maglv, var)
    centerpos = {x=creaturePos.x, y=creaturePos.y, z=creaturePos.z}
 
return doTargetMagic(cid, centerpos, BlessedUltimateObject:ordered())
end
XML:
<rune name="Blessed Ultimate"        id="2274"    charges="1"        maglv="0"    mana="0"    enabled="1"></rune>
Within this code above, I wanted to add when using the rune, it cures all the life and all the mana of the character.

Help-me?
 

Xikini

I whore myself out for likes
Premium User
Joined
Nov 17, 2010
Messages
4,101
Reaction score
2,175
Within this code above, I wanted to add when using the rune, it cures all the life and all the mana of the character.

Help-me?
Lua:
local health, mana = getCreatureMaxHealth(cid) - getCreatureHealth(cid), getCreatureMaxMana(cid) - getCreatureMana(cid)
doCreatureAddHealth(cid, health)
doCreatureAddMana(cid, mana)
 
OP
FearWar

FearWar

Member
Joined
Sep 17, 2017
Messages
71
Reaction score
3
Location
Brasil
Lua:
local health, mana = getCreatureMaxHealth(cid) - getCreatureHealth(cid), getCreatureMaxMana(cid) - getCreatureMana(cid)
doCreatureAddHealth(cid, health)
doCreatureAddMana(cid, mana)
It was like this, but it did not work.

Lua:
[CODE=lua]attackType = ATTACK_NONE

animationEffect = NM_ANI_NONE

 

hitEffect = NM_ME_NONE

damageEffect = NM_ME_MAGIC_POISEN

animationColor = GREEN

offensive = false

drawblood = false

 

BlessedUltimateObject = MagicDamageObject(attackType, animationEffect, hitEffect, damageEffect, animationColor, offensive, drawblood, 0, 0)

 

function onCast(cid, creaturePos, level, maglv, var)

    centerpos = {x=creaturePos.x, y=creaturePos.y, z=creaturePos.z}   



local health, mana = getCreatureMaxHealth(cid) - getCreatureHealth(cid), getCreatureMaxMana(cid) - getCreatureMana(cid)

doCreatureAddHealth(cid, health)

doCreatureAddMana(cid, mana)

 

return doTargetMagic(cid, centerpos, BlessedUltimateObject:ordered())

end
[/CODE]


Here is an example of how UH is on my server

Lua:
--doTargetMagic
 -- attackType: Type of attack.
 -- cid: creature id.
 -- Targetpos: Target position.
 -- animationEffect: Projectile animation.
 -- hitEffect: Effect to show when spell hits a creature.
 -- damageEffect: Effect to show when spell hits a player.
 -- animationColor: Color of the text that is shown above the player when hit.
 -- offensive: Indicates if the spell is a healing/attack spell.
 -- drawblood: Determines if the spell causes blood splash.
 -- minDmg: Minimal damage.
 -- maxDmg: Maximum damage.
 -- returns true if the spell was casted.
 
 attackType = ATTACK_NONE
 animationEffect = NM_ANI_NONE
 
 hitEffect = NM_ME_NONE
 damageEffect = NM_ME_MAGIC_POISEN
 animationColor = GREEN
 offensive = false
 drawblood = false
 
 UltimateHealingObject = MagicDamageObject(attackType, animationEffect, hitEffect, damageEffect, animationColor, offensive, drawblood, 0, 0)
 
 function onCast(cid, creaturePos, level, maglv, var)
 centerpos = {x=creaturePos.x, y=creaturePos.y, z=creaturePos.z}
 
 UltimateHealingObject.minDmg = (level * 4 + maglv * 3) * 1.7
 if UltimateHealingObject.minDmg < 250 then
     UltimateHealingObject.minDmg = 250
 end
 
 UltimateHealingObject.maxDmg = (level * 4 + maglv * 3) * 2.4
 if UltimateHealingObject.maxDmg < 250 then
     UltimateHealingObject.maxDmg = 250
 end
 
 return doTargetMagic(cid, centerpos, UltimateHealingObject:ordered())
 end
 

Xikini

I whore myself out for likes
Premium User
Joined
Nov 17, 2010
Messages
4,101
Reaction score
2,175
It was like this, but it did not work.

Lua:
[CODE=lua]attackType = ATTACK_NONE

animationEffect = NM_ANI_NONE



hitEffect = NM_ME_NONE

damageEffect = NM_ME_MAGIC_POISEN

animationColor = GREEN

offensive = false

drawblood = false



BlessedUltimateObject = MagicDamageObject(attackType, animationEffect, hitEffect, damageEffect, animationColor, offensive, drawblood, 0, 0)



function onCast(cid, creaturePos, level, maglv, var)

    centerpos = {x=creaturePos.x, y=creaturePos.y, z=creaturePos.z}  



local health, mana = getCreatureMaxHealth(cid) - getCreatureHealth(cid), getCreatureMaxMana(cid) - getCreatureMana(cid)

doCreatureAddHealth(cid, health)

doCreatureAddMana(cid, mana)



return doTargetMagic(cid, centerpos, BlessedUltimateObject:ordered())

end
[/CODE]


Here is an example of how UH is on my server

Lua:
--doTargetMagic
-- attackType: Type of attack.
-- cid: creature id.
-- Targetpos: Target position.
-- animationEffect: Projectile animation.
-- hitEffect: Effect to show when spell hits a creature.
-- damageEffect: Effect to show when spell hits a player.
-- animationColor: Color of the text that is shown above the player when hit.
-- offensive: Indicates if the spell is a healing/attack spell.
-- drawblood: Determines if the spell causes blood splash.
-- minDmg: Minimal damage.
-- maxDmg: Maximum damage.
-- returns true if the spell was casted.

attackType = ATTACK_NONE
animationEffect = NM_ANI_NONE

hitEffect = NM_ME_NONE
damageEffect = NM_ME_MAGIC_POISEN
animationColor = GREEN
offensive = false
drawblood = false

UltimateHealingObject = MagicDamageObject(attackType, animationEffect, hitEffect, damageEffect, animationColor, offensive, drawblood, 0, 0)

function onCast(cid, creaturePos, level, maglv, var)
centerpos = {x=creaturePos.x, y=creaturePos.y, z=creaturePos.z}

UltimateHealingObject.minDmg = (level * 4 + maglv * 3) * 1.7
if UltimateHealingObject.minDmg < 250 then
     UltimateHealingObject.minDmg = 250
end

UltimateHealingObject.maxDmg = (level * 4 + maglv * 3) * 2.4
if UltimateHealingObject.maxDmg < 250 then
     UltimateHealingObject.maxDmg = 250
end

return doTargetMagic(cid, centerpos, UltimateHealingObject:ordered())
end
Idk, you got me. lmao
This looks like YurOTs scripting or something.
I don't have any experience with that scripting style.
 
OP
FearWar

FearWar

Member
Joined
Sep 17, 2017
Messages
71
Reaction score
3
Location
Brasil
• if you have an action script it can also be that heal life / full mana
 
OP
FearWar

FearWar

Member
Joined
Sep 17, 2017
Messages
71
Reaction score
3
Location
Brasil
send manarune script from your dist. and i will try to do this rune
Ex_1

Lua:
 function onUse(cid, item, frompos, item2, topos)
mag = getPlayerMagLevel(cid)
if mag >= 5 then
 attackType = ATTACK_NONE
 animationEffect = NM_ANI_NONE
 
 hitEffect = NM_ME_NONE
 damageEffect = NM_ME_NONE
 animationColor = GREEN
 offensive = false
 drawblood = false
doSendMagicEffect(topos,1)
doPlayerSay(cid,"",16)
doPlayerAddMana(cid, 20000)
doPlayerAddHealth(cid, 20000)
if item.type > 1 then
doChangeTypeItem(item.uid,item.type-1)
else
doRemoveItem(item.uid,100)
end
else doSendMagicEffect(frompos,2)
doPlayerSendCancel(cid,"You don't have the required magic level to use that rune.")
end
return 1
end
Ex_2

Lua:
function onUse(cid, item, frompos, item2, topos)
mag = getPlayerMagLevel(cid)
if mag >= 4 then
doSendMagicEffect(topos,12)
doPlayerSendTextMessage(cid,22,"You Have Gain Some Mana!")
doPlayerAddMana(cid, 250)
if item.type > 1 then
doChangeTypeItem(item.uid,item.type-1)
end


else
doSendMagicEffect(frompos,2)
doPlayerSendCancel(cid,"Your magic is not strong enough to wield this power.")
end
return 1
end
Ex_3

Lua:
-- New MF rune by Joao Paulo 3.0 version --
 function onUse(cid, item, frompos, item2, topos)
 playerpos = {x=topos.x, y=topos.y, z=topos.z, stackpos=253}     
 player = getThingfromPos(playerpos)
 ml = getPlayerMagLevel(cid)
 lvl = getPlayerLevel(cid)
 formula = math.random(((lvl+ml)*2)-(lvl-ml))
 if item2.itemid == 1 and ml >= 2 then
 doSendMagicEffect(playerpos,1)
 doPlayerAddMana(player.uid,formula)
 doPlayerSay(player.uid,"Ahhhhhh",2)
 if item.type > 1 then
 doChangeTypeItem(item.uid,item.type-1)
 else
 doRemoveItem(item.uid,1)
 end
 end
 if item2.itemid == 1 and ml <= 1 then
 doSendMagicEffect(frompos,2)
 doPlayerSendCancel(cid,"You dont Have Magic Level to use this rune.")
 end
 if item2.itemid >= 2 then
 doPlayerSendCancel(cid,"You can only use this rune in you or in players.")
 doSendMAgicEffect(frompos,2)
 end
 return 1
 end
OBS: No need for me, I only wanted one that uses "x" rune, heal 100% life and 100% mana, no level, nor magic level.
 

Shadow_

Active Member
Joined
Jun 2, 2018
Messages
362
Reaction score
73
Location
Cairo, Egypt
If EX_1 is working this should work :
Lua:
 function onUse(cid, item, frompos, item2, topos)
 local health, mana = getCreatureMaxHealth(cid) - getCreatureHealth(cid), getCreatureMaxMana(cid) - getCreatureMana(cid)
 attackType = ATTACK_NONE
 animationEffect = NM_ANI_NONE
 hitEffect = NM_ME_NONE
 damageEffect = NM_ME_NONE
 animationColor = GREEN
 offensive = false
 drawblood = false
doSendMagicEffect(topos,1)
doPlayerSay(cid,"",16)
doPlayerAddMana(cid, mana)
doPlayerAddHealth(cid, health)
else doSendMagicEffect(frompos,2)
doPlayerSendCancel(cid,"You don't have the required magic level to use that rune.")
return 1
end
 
OP
FearWar

FearWar

Member
Joined
Sep 17, 2017
Messages
71
Reaction score
3
Location
Brasil
If EX_1 is working this should work :
Lua:
 function onUse(cid, item, frompos, item2, topos)
local health, mana = getCreatureMaxHealth(cid) - getCreatureHealth(cid), getCreatureMaxMana(cid) - getCreatureMana(cid)
attackType = ATTACK_NONE
animationEffect = NM_ANI_NONE
hitEffect = NM_ME_NONE
damageEffect = NM_ME_NONE
animationColor = GREEN
offensive = false
drawblood = false
doSendMagicEffect(topos,1)
doPlayerSay(cid,"",16)
doPlayerAddMana(cid, mana)
doPlayerAddHealth(cid, health)
else doSendMagicEffect(frompos,2)
doPlayerSendCancel(cid,"You don't have the required magic level to use that rune.")
return 1
end
36554
 

Shadow_

Active Member
Joined
Jun 2, 2018
Messages
362
Reaction score
73
Location
Cairo, Egypt
sorry forgot to delete this
Lua:
 function onUse(cid, item, frompos, item2, topos)
 local health, mana = getCreatureMaxHealth(cid) - getCreatureHealth(cid), getCreatureMaxMana(cid) - getCreatureMana(cid)
 attackType = ATTACK_NONE
 animationEffect = NM_ANI_NONE
 hitEffect = NM_ME_NONE
 damageEffect = NM_ME_NONE
 animationColor = GREEN
 offensive = false
 drawblood = false
doSendMagicEffect(topos,1)
doPlayerSay(cid,"",16)
doPlayerAddMana(cid, mana)
doPlayerAddHealth(cid, health)
return 1
end
 
OP
FearWar

FearWar

Member
Joined
Sep 17, 2017
Messages
71
Reaction score
3
Location
Brasil
sorry forgot to delete this
Lua:
 function onUse(cid, item, frompos, item2, topos)
local health, mana = getCreatureMaxHealth(cid) - getCreatureHealth(cid), getCreatureMaxMana(cid) - getCreatureMana(cid)
attackType = ATTACK_NONE
animationEffect = NM_ANI_NONE
hitEffect = NM_ME_NONE
damageEffect = NM_ME_NONE
animationColor = GREEN
offensive = false
drawblood = false
doSendMagicEffect(topos,1)
doPlayerSay(cid,"",16)
doPlayerAddMana(cid, mana)
doPlayerAddHealth(cid, health)
return 1
end
not work :(

how to add this part in the script?

Lua:
playerpos = {x=topos.x, y=topos.y, z=topos.z, stackpos=253}
player = getThingfromPos(playerpos)
maybe it might work
 

Shadow_

Active Member
Joined
Jun 2, 2018
Messages
362
Reaction score
73
Location
Cairo, Egypt
under the firstline , btw i recommend using TFS or atleast otx instead of this distr.. it is annoying to be different while you doesn't have your own scripter for it
 
OP
FearWar

FearWar

Member
Joined
Sep 17, 2017
Messages
71
Reaction score
3
Location
Brasil
under the firstline , btw i recommend using TFS or atleast otx instead of this distr.. it is annoying to be different while you doesn't have your own scripter for it
not work :/


Thank you for trying to help. My server is custom I am more than 2 consecutive years in it, I can not trocarte from source now: /
 
OP
FearWar

FearWar

Member
Joined
Sep 17, 2017
Messages
71
Reaction score
3
Location
Brasil
under the firstline , btw i recommend using TFS or atleast otx instead of this distr.. it is annoying to be different while you doesn't have your own scripter for it
Lua:
function onUse(cid, item, frompos, item2, topos)
mag = getPlayerMagLevel(cid)
    if mag >= 3 then
        doSendMagicEffect(topos,1)
        doPlayerSay(cid,"Ahhhh! Fresh mana fluid!",16)
        doPlayerAddMana(cid, 150)
    if item.type > 1 then
        doChangeTypeItem(item.uid,item.type-1)
    else
        doRemoveItem(item.uid,1)
    end
    else
        doSendMagicEffect(frompos,2)
        doPlayerSendCancel(cid,"You don't have the required magic level to use that rune.")
    end
    return 1
end
This one works, but I wanted it to heal life and mana full.
 

Shadow_

Active Member
Joined
Jun 2, 2018
Messages
362
Reaction score
73
Location
Cairo, Egypt
Lua:
function onUse(cid, item, frompos, item2, topos)
mag = getPlayerMagLevel(cid)
    if mag >= 3 then
        doSendMagicEffect(topos,1)
        doPlayerSay(cid,"Ahhhh! Fresh mana fluid!",16)
        doPlayerAddMana(cid, 150)
    if item.type > 1 then
        doChangeTypeItem(item.uid,item.type-1)
    else
        doRemoveItem(item.uid,1)
    end
    else
        doSendMagicEffect(frompos,2)
        doPlayerSendCancel(cid,"You don't have the required magic level to use that rune.")
    end
    return 1
end
This one works, but I wanted it to heal life and mana full.
this one heals mana only anyway add the values 9999999999 since we doesn't know any function about it to get play health and max health
 
OP
FearWar

FearWar

Member
Joined
Sep 17, 2017
Messages
71
Reaction score
3
Location
Brasil
action.xml

XML:
<action itemid="2274" script="other/blessedultimate.lua" />
actions/scripts

Lua:
function onUse(cid, item, frompos, item2, topos)
mag = getPlayerMagLevel(cid)
    if mag >= 0 then
        doSendMagicEffect(topos,14)
        doPlayerSay(cid,"Fear Bless!",16)
        doPlayerAddMana(cid, 99999999)
        doPlayerAddHealth(cid, 99999999)
    if item.type > 1 then
        doChangeTypeItem(item.uid,item.type-1)
    else
        doRemoveItem(item.uid,1)
    end
    else
        doSendMagicEffect(frompos,2)
        doPlayerSendCancel(cid,"You don't have the required magic level to use that rune.")
    end
    return 1
end
 
Top