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

storage in spell outfit when ur hp 0

Nerevr back

Member
Joined
Nov 7, 2014
Messages
269
Reaction score
7
i want script
when u use spell add storge to target player
/addstorge target
need this spell for druid

im use tfs 0.4 rev
 
Last edited:
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)

local area = createCombatArea(AREA_CIRCLE3X3)
setCombatArea(combat, area)

function onGetFormulaValues(cid, level, maglevel)
     min = (maglevel*4) + (level/5) + 76
     max = (maglevel*5) + (level/5) + 108
     return -min, -max
end

setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onTargetCreature(cid, target)
     if isPlayer(target) then
         doCreatureSetStorage(cid, 34583, 1)
     end
     return true
end

setCombatCallback(combat, CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature")

function onCastSpell(cid, var)
     return doCombat(cid, combat, var)
end
 
The storagevalue will stay 1 unless you change it in an other script. If you want it to be 0 when someone relogs, you can add this in login.lua.
Code:
doCreatureSetStorage(cid, 34583, 0)
 
or he can add
Code:
local function Back(cid)
    if(isPlayer(cid)) then
    doSendMagicEffect(getThingPos(cid), CONST_ME_YELLOWENERGY)
    doCreatureSetStorage(cid, 34583, 0)
    end
    return true
end

doCreatureSetStorage(target, 34583, 1)
addEvent(Back,5000,cid)

5000 =5 sec

right limos?
 
For storage to be used with time best is to use os.time() as value + the added time in seconds, then compare the storagevalue to os.time() to see if it's over.
In TFS 0.3/0.4 there is a Lua made function that does this, it's added to data/lib/034-exhaustion.lua.
It works like this.
Code:
if exhaustion.check(cid, 34583) then -- if the time isn't over
     return doPlayerSendCancel(cid, "There is still "..exhaustion.get(cid, 34583).." seconds left.") -- how much time is left
end

exhaustion.set(cid, 34583, 30) -- this sets the time to 30 seconds
 
If you want it as a talkaction, you can just use the talkaction storage.lua as example and remove the parts you don't need.
Code:
function onSay(cid, words, param)
     local tid = getPlayerByNameWildcard(param)
     if not tid then
         return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. param .. " not found.")
     end
     doCreatureSetStorage(tid, 34583, 1)
     return true
end
 
A talkaction is similar to a spell, just different xml options and function parameters.
Code:
if getPlayerVocation(cid) ~= 10 then
     return doPlayerSendCancel(cid, "Only voc 10 can use this.")
end

For exhaustion you can use an exhaustion condition like potions have.
 
u can add some thing like when player x say protection y disteffect send from player x to player y

-------edite-----
when use this talkaction storge add to player x too :S i want it to add to player y only :S

and this storge change to 0 after player relog or in 30 min set to 0?

-----edite----
i need this talk action work like this when player x say protection player y
player y get stotge 34583 till relog when he relog get storge 0
and storge don't add to player x and make disteffect from player x to player y like ENERGYBALL
i hope you @Limos acn help me in this
 
Last edited:
Code:
function onSay(cid, words, param)
     if param == "" then
         return doPlayerSendCancel(cid, "Add a name.")
     end
     local tid = getPlayerByNameWildcard(param)
     if not tid then
         return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. param .. " not found.")
     elseif tid == cid then
         return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can not use this on yourself.")
     end
     doSendDistanceShoot(getThingPosition(cid), getThingPosition(tid), CONST_ANI_ENERGYBALL)
     doCreatureSetStorage(tid, 34583, 1)
     return true
end

Add this in login.lua.
Code:
doCreatureSetStorage(cid, 34583, 0)
 
Last edited:
first
Code:
doCreatureSetStorage(tid, 34583, 0)
tid or cid
second i did some edite in this talkaction and work fine but need some edite when
Code:
function onSay(cid, words, param)
if (not exhaustion.check(cid, 87924)) then
     if param == "" then
         return doPlayerSendCancel(cid, "Add a name.")
     end
     if getPlayerVocation(cid) ~= 10 then
     return doPlayerSendCancel(cid, "this spell only for epic elder druid.")
end
     local tid = getPlayerByNameWildcard(param)
     if not tid then
         return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. param .. " not found.")
     elseif tid == cid then
         return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can not use this on yourself.")
     end
     doSendDistanceShoot(getThingPosition(cid), getThingPosition(tid), CONST_ANI_ENERGYBALL)
     doCreatureSetStorage(tid, 70308, 1)
doPlayerSendTextMessage(tid, MESSAGE_STATUS_CONSOLE_BLUE, ""..getCreatureName(cid).." send you text.")
            doCreatureSay(cid, words, TALKTYPE_ORANGE_1)
            exhaustion.set(cid, 87924, 3600)
     return true
else
        doPlayerSendCancel(cid, "You will be able to use this spell again in  "..exhaustion.get(cid, 17023).." seconds.")
        return false
    end
    end
---------------------------edite i need------------
need add range for this talkactio range 5
need to eidte this player y losse storge if he relog or after 30 min
 
Add this in login.lua.
Code:
doCreatureSetStorage(cid, 34583, 0)
For storage to be used with time best is to use os.time() as value + the added time in seconds, then compare the storagevalue to os.time() to see if it's over.
In TFS 0.3/0.4 there is a Lua made function that does this, it's added to data/lib/034-exhaustion.lua.
It works like this.
Code:
if exhaustion.check(cid, 34583) then -- if the time isn't over
     return doPlayerSendCancel(cid, "There is still "..exhaustion.get(cid, 34583).." seconds left.") -- how much time is left
end

exhaustion.set(cid, 34583, 30) -- this sets the time to 30 seconds
 
You can use getDistanceBetween.
Code:
if getDistanceBetween(getThingPosition(cid), getThingPosition(tid)) < 5 then
 
so its will be like this ?
Code:
 if getDistanceBetween(getThingPosition(cid), getThingPosition(tid)) < 10 then
return doPlayerSendCancel(cid, "Msg.")
end
 
I assume you don't players to be able to do this action on players that are to far away? Then use >, so if it's more than 10 they will get that cancel message.
 
Back
Top