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

[REQUEST] Freeze Rune!

Ranyo13

ManCausingMayhem
Joined
Aug 22, 2009
Messages
981
Reaction score
38
Hello otlanders,
I got a huge problem with my freeze rune.. Well i fixed it so you cant use it on people in pz but you can use it from pz like someone is outta pz you use it on him while your in pz.. Plus the cooldown is not working.. I want some scripter or someone to help me with this! Heres the script!
Code:
local freezetime = 10 
local cooldown = 60 -- time to use again
local storage = 19002
 
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ICE)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)
 
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_SUBID, 1)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, -1)
setCombatCondition(combat, exhaust)
 
local exhaustt = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaustt, CONDITION_PARAM_SUBID, 2)
setConditionParam(exhaustt, CONDITION_PARAM_TICKS, -1)
setCombatCondition(combat, exhaustt)
 
function countDown(number, pos, effect, msgonend, effectonend)
  local n = number
       for i = 1, number do
           addEvent(doSendAnimatedText,i* 1000, pos, n > 1 and n.."" or msgonend .."", n < 6 and TEXTCOLOR_RED or TEXTCOLOR_GREEN)
		   addEvent(doSendMagicEffect,i* 1000, pos, n > 1 and effect or effectonend )
              n = n -1
	   end
      n = number
return true
end
 
function removed(cid)
	doCreatureSetNoMove(cid, 0)
	doRemoveCondition(cid,CONDITION_EXHAUST,1)
	doRemoveCondition(cid,CONDITION_EXHAUST,2)
end
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if exhaustion.get(cid,storage) then
		return doPlayerSendCancel(cid,"You can't use this yet.")
	end
 
	if not isPlayer(itemEx.uid) or cid == itemEx.uid then
		return doPlayerSendCancel(cid,"You can only use this on players.")
	end

                if getTilePzInfo(toPosition) == true then
	               return doPlayerSendCancel(cid, "Sorry, not possible.")
                 end
 
	doSendAnimatedText(getThingPos(itemEx.uid),"Frozen!", TEXTCOLOR_BLUE)
	exhaustion.set(cid,storage,cooldown)
	doCombat(cid, combat, numberToVariant(itemEx.uid))
	doCreatureSetNoMove(itemEx.uid, 1)
	countDown(freezetime , toPosition, 0, "melted", 5)
	addEvent(removed,freezetime*1000,itemEx.uid)
	return true
end
Rep++ if you completely help me with this!
Thanks in advance,
Ranyo13
 
Last edited:
I have edited this quite a bit, hoping it works...I am unable to test.

Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ICE)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)
 
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_SUBID, 1)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, -1)
setCombatCondition(combat, exhaust)
 
local exhaustt = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaustt, CONDITION_PARAM_SUBID, 2)
setConditionParam(exhaustt, CONDITION_PARAM_TICKS, -1)
setCombatCondition(combat, exhaustt)

local t = {
	useEffect = true,
	config = {
		exhaust = 60,
		freeze = 10,
		storage = 19002
	}
}

local function removeFreeze(cid)
	doCreatureSetNoMove(cid, false)
	doRemoveCondition(cid, CONDITION_EXHAUST, 1)
	doRemoveCondition(cid, CONDITION_EXHAUST, 2)
end

local function countDown(number, pos, effect, msgonend, effectonend)
	local n = number
	for i = 1, number do
		addEvent(doSendAnimatedText, i * 1000, pos, n > 1 and n .. "" or msgonend .. "", n < 6 and TEXTCOLOR_RED or TEXTCOLOR_GREEN)
		addEvent(doSendMagicEffect, i * 1000, pos, n > 1 and effect or effectonend)
		n = n - 1
	end
	
	n = number
	return true
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if not isPlayer(itemEx.uid) or cid == itemEx.uid then
		return not doPlayerSendCancel(cid, "You can only use this on players.")
	end
	
	local pos = variantToPosition(var)
	if getTileInfo(getThingPos(cid)).protection then
		return not doPlayerSendDefaultCancel(cid, RETURNVALUE_ACTIONNOTPERMITTEDINPROTECTIONZONE)
	else
		local s = getTileInfo(pos)
		if s.protection then
			return not doPlayerSendDefaultCancel(cid, RETURNVALUE_ACTIONNOTPERMITTEDINPROTECTIONZONE)
		elseif s.nopvp then
			return not doPlayerSendCancel(cid, "You can\'t use this here.")
		end
	end
	
	if getPlayerStorageValue(cid, t.config.storage) > os.time() then
		return not doPlayerSendCancel(cid, "You must wait " .. getPlayerStorageValue(cid, t.config.storage) - os.time() .. ' second' .. ((getPlayerStorageValue(cid, t.config.storage) - os.time()) == 1 and "" or "s") .. ".")
	end
	
	if t.useEffect then
		doSendAnimatedText(toPosition, "Frozen!", TEXTCOLOR_BLUE)
		doSendMagicEffect(toPosition, CONST_ME_MAGIC_BLUE)
		return true
	end
	
	doCreatureSetNoMove(itemEx.uid, true)
	doCombat(cid, combat, numberToVariant(itemEx.uid))
	countDown(t.config.freeze, toPosition, 0, "Melted!", 5)
	addEvent(removeFreeze, t.config.freeze * 1000, itemEx.uid)
	setPlayerStorageValue(cid, t.config.storage, os.time() + t.config.exhaust)
	return true
end
 
When i try using it on a player:
Code:
[07/07/2011 13:48:38] [Error - Action Interface] 
[07/07/2011 13:48:38] data/actions/scripts/other/freeze rune.lua:onUse
[07/07/2011 13:48:38] Description: 
[07/07/2011 13:48:38] attempt to index a nil value
[07/07/2011 13:48:38] stack traceback:
[07/07/2011 13:48:38] 	[C]: in function 'variantToPosition'
[07/07/2011 13:48:38] 	data/actions/scripts/other/freeze rune.lua:47: in function <data/actions/scripts/other/freeze rune.lua:42>
 
Here is the one i use :


PHP:
local freezetime = 3    
 
local cooldown = 10 -- time to use again
 
local storage = 19002
 
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ICE)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)
 
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_SUBID, 1)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, -1)
setCombatCondition(combat, exhaust)
 
local exhaustt = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaustt, CONDITION_PARAM_SUBID, 2)
setConditionParam(exhaustt, CONDITION_PARAM_TICKS, -1)
setCombatCondition(combat, exhaustt)
 
function countDown(number, pos, effect, msgonend, effectonend)
  local n = number
       for i = 1, number do
           addEvent(doSendAnimatedText,i* 1000, pos, n > 1 and n.."" or msgonend .."", n < 6 and TEXTCOLOR_RED or TEXTCOLOR_GREEN)
		   addEvent(doSendMagicEffect,i* 1000, pos, n > 1 and effect or effectonend )
              n = n -1
	   end
      n = number
return true
end
 
function removed(cid)
	doCreatureSetNoMove(cid, 0)
	doRemoveCondition(cid,CONDITION_EXHAUST,1)
	doRemoveCondition(cid,CONDITION_EXHAUST,2)
end
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if exhaustion.get(cid,storage) then
		return doPlayerSendCancel(cid,"You can't use this yet.")
	end
 
        if getTilePzInfo(toPosition) == true then
	               return doPlayerSendCancel(cid, "You cant use in pz.")
        end

	if not isPlayer(itemEx.uid) or cid == itemEx.uid then
		return doPlayerSendCancel(cid,"You can only use this on another players.")
	end
 
	doSendAnimatedText(getThingPos(itemEx.uid),"Freezed!", TEXTCOLOR_BLUE)
	exhaustion.set(cid,storage,cooldown)
	doCombat(cid, combat, numberToVariant(itemEx.uid))
	doCreatureSetNoMove(itemEx.uid, 1)
	countDown(freezetime , toPosition, 0, "melted", 5)
	addEvent(removed,freezetime*1000,itemEx.uid)
	return true
end
 
Well, that's not what i wanted.. First of all when i use it and start spamming it there's no cool down and when i try using it on a player in pz i can do it plus when i try using it on the ground i get a cancel message "You can use this in pz". Dude you realy need to fix your own script lol.
 
Not rly with me lmao, dude, fix ur script and post on my thread and stop postin s**t. Im not so dumb to test a rune on my (Admin) Character.

EDIT: I retested it and it worked.. Thanks!
 
Last edited:
Back
Top