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

Lua adding warning message when manashield runs out.

lbakiller

New Member
Joined
Aug 27, 2009
Messages
90
Reaction score
1
Location
The Netherlands
how do i add a msg in a spell?
like 10 sec before your manashield wheres off, you get a message, "10 seconds manashield left"

my manashield spell.
Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)

local condition = createConditionObject(CONDITION_MANASHIELD)
setConditionParam(condition, CONDITION_PARAM_TICKS, 200000)
setCombatCondition(combat, condition)

function onCastSpell(cid, var)
	return doCombat(cid, combat, var)
end
[/LUa]
 
maybe you can try by adding event soemthing like this.

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)

local condition = createConditionObject(CONDITION_MANASHIELD)
setConditionParam(condition, CONDITION_PARAM_TICKS, 200000)
setCombatCondition(combat, condition)

function onCastSpell(cid, var)
return doCombat(cid, combat, var) and addEvent(doCreatureSay, 190 * 1000, '"Take care your magic shield is above to expire. - 10 Seconds Remaining", TALKTYPE_ORANGE_1)
end
 
Here you go, you will avoid the error when you logout and its much cleaner :)

Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)

local condition = createConditionObject(CONDITION_MANASHIELD)
setConditionParam(condition, CONDITION_PARAM_TICKS, 200000)
setCombatCondition(combat, condition)

function alert(cid)
if isPlayer(cid) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Mana Shield is ready to use!")
   end
end

function onCastSpell(cid, var)
addEvent(alert, 200000, cid)
         return doCombat(cid, combat, var)
end
 
Last edited:
Back
Top