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

Freeze GEM

Luciano

Member
Joined
Feb 18, 2010
Messages
998
Reaction score
24
I need a script.
The Freeze GEM.
How it works?
A player X use the freeze GEM on player Y.
player Y cant move, heal, use spell, or say anything for 3 secs (configurable) and each 1 sec apear the efect 41.
after 3 secs he can heal, spell everything again ;P thanks
rep+++
 
Code:
--[[Edit]]--
local time = 4 --in seconds (time of freeze)
 
local storage = 1230
 
local cooldown = 60 --in seconds
 
--[[End]]--
 
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 doRemove(cid)
      doCreatureSetNoMove(cid, 0)
      doRemoveCondition(cid,CONDITION_EXHAUST,1)
       doRemoveCondition(cid,CONDITION_EXHAUST,2)
end
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
local n = time
  if not exhaustion.get(cid, storage) then
         doSendAnimatedText(getThingPos(itemEx.uid),"Freezed!", TEXTCOLOR_BLUE)
         doCombat(cid, combat, numberToVariant(itemEx.uid))
         doCreatureSetNoMove(itemEx.uid, 1)
         addEvent(doRemove,time * 1000,itemEx.uid)
         exhaustion.set(cid, storage, cooldown)
		    for i = 1,time + 1 do
		         addEvent(doSendAnimatedText,i * 1000,getThingPos(itemEx.uid), ( i < time+1 and "Melt : "..n.."" or "Melted!") , i< time+1 and TEXTCOLOR_GREEN or TEXTCOLOR_RED)
                 addEvent(doSendMagicEffect,i * 1000,getThingPos(itemEx.uid),5)
			     n = n-1 
		    end
  else
    doPlayerSendCancel(cid,"Cool down : "..exhaustion.get(cid, storage).." seconds.")
 end
return true
end
Bump.. ifisPlayer(thing.uid) or something like that shud be added somewhere
 
Assuming the code worked before, here's the "fix" that you wanted.

Lua:
local time = 4
local storage = 1230
local cooldown = 60

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 doRemove(cid)
	doCreatureSetNoMove(cid, 0)
	doRemoveCondition(cid,CONDITION_EXHAUST,1)
	doRemoveCondition(cid,CONDITION_EXHAUST,2)
end
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local n = time
	if isPlayer(itemEx.uid) then
		if not exhaustion.get(cid, storage) then
			doSendAnimatedText(getThingPos(itemEx.uid),"Freezed!", TEXTCOLOR_BLUE)
			doCombat(cid, combat, numberToVariant(itemEx.uid))
			doCreatureSetNoMove(itemEx.uid, 1)
			addEvent(doRemove, time * 1000, itemEx.uid)
			exhaustion.set(cid, storage, cooldown)
			for i = 1, time + 1 do
				addEvent(doSendAnimatedText,i * 1000,getThingPos(itemEx.uid), ( i < time+1 and "Melt : "..n.."" or "Melted!") , i< time+1 and TEXTCOLOR_GREEN or TEXTCOLOR_RED)
				addEvent(doSendMagicEffect,i * 1000,getThingPos(itemEx.uid),5)
				n = n - 1
			end
		else
			doPlayerSendCancel(cid, "You must wait " .. exhaustion.get(cid, storage) .. " seconds.")
		end
	else
		doPlayerSendCancel(cid, "Sorry, not possible.")
	end
	return true
end
 
Same errors:

Code:
[07/07/2011 03:39:22] [Error - Action Interface] 
[07/07/2011 03:39:22] data/actions/scripts/other/freeze rune.lua:onUse
[07/07/2011 03:39:22] Description: 
[07/07/2011 03:39:22] (luaDoCreatureSetNoMove) Creature not found

[07/07/2011 03:39:32] [Error - Action Interface] 
[07/07/2011 03:39:32] In a timer event called from: 
[07/07/2011 03:39:32] data/actions/scripts/other/freeze rune.lua:onUse
[07/07/2011 03:39:32] Description: 
[07/07/2011 03:39:32] (luaDoCreatureSetNoMove) Creature not found

[07/07/2011 03:39:32] [Error - Action Interface] 
[07/07/2011 03:39:32] In a timer event called from: 
[07/07/2011 03:39:32] data/actions/scripts/other/freeze rune.lua:onUse
[07/07/2011 03:39:32] Description: 
[07/07/2011 03:39:32] (luaDoRemoveCondition) Creature not found

[07/07/2011 03:39:32] [Error - Action Interface] 
[07/07/2011 03:39:32] In a timer event called from: 
[07/07/2011 03:39:32] data/actions/scripts/other/freeze rune.lua:onUse
[07/07/2011 03:39:32] Description: 
[07/07/2011 03:39:32] (luaDoRemoveCondition) Creature not found
 
Code:
[07/07/2011 03:44:33] [Error - LuaScriptInterface::loadFile] data/actions/scripts/other/freeze rune.lua:19: ')' expected near '.'
[07/07/2011 03:44:33] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/other/freeze rune.lua)
[07/07/2011 03:44:33] data/actions/scripts/other/freeze rune.lua:19: ')' expected near '.'

EDIT: I changed all "cid" in the script to "itemEx.uid".. and i get the error
Code:
local time = 10
local storage = 1230
local cooldown = 60
 
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 doRemove(itemEx.uid)
	doCreatureSetNoMove(itemEx.uid, 0)
	doRemoveCondition(itemEx.uid,CONDITION_EXHAUST,1)
	doRemoveCondition(itemEx.uid,CONDITION_EXHAUST,2)
end
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local n = time
	if isPlayer(itemEx.uid) then
		if not exhaustion.get(itemEx.uid, storage) then
			doSendAnimatedText(getThingPos(itemEx.uid),"Frozen!", TEXTCOLOR_BLUE)
			doCombat(itemEx.uid, combat, numberToVariant(itemEx.uid))
			doCreatureSetNoMove(itemEx.uid, 1)
			addEvent(doRemove, time * 1000, itemEx.uid)
			exhaustion.set(itemEx.uid, storage, cooldown)
			for i = 1, time + 1 do
				addEvent(doSendAnimatedText,i * 1000,getThingPos(itemEx.uid), ( i < time+1 and "Melt:"..n.."" or "Melted!") , i< time+1 and TEXTCOLOR_GREEN or TEXTCOLOR_RED)
				addEvent(doSendMagicEffect,i * 1000,getThingPos(itemEx.uid),5)
				n = n - 1
			end
		else
			doPlayerSendCancel(itemEx.uid, "You must wait " .. exhaustion.get(itemEx.uid, storage) .. " seconds.")
		end
	else
		doPlayerSendCancel(itemEx.uid, "Sorry, not possible.")
	end
	return true
end
 
When i tried using it as rune or spell.. I got this
Code:
[07/07/2011 02:21:50] [Warning - Event::loadScript] Event onCastSpell not found (data/spells/scripts/attack/freeze rune.lua)
Wud be much easier to use it as a rune to edit "Needtarget" in spells.xml :(
 
It's a problem with your "remove freeze function".

local function doRemove(itemEx.uid)
doCreatureSetNoMove(itemEx.uid, 0)
doRemoveCondition(itemEx.uid,CONDITION_EXHAUST,1)
doRemoveCondition(itemEx.uid,CONDITION_EXHAUST,2)
end
 
well u cant help fixing it?

EDIT: it doesnt give any error while using it on a player.. Works realy fine but when i use it on the floor it starts giving me the error..
 
Try this:

Lua:
local time = 10
local storage = 1230
local cooldown = 60
 
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 function doRemove(itemEx.uid)
	doCreatureSetNoMove(itemEx.uid, 0)
	doRemoveCondition(itemEx.uid,CONDITION_EXHAUST,1)
	doRemoveCondition(itemEx.uid,CONDITION_EXHAUST,2)
end
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local n = time
	if isPlayer(itemEx.uid) then
		if not exhaustion.get(itemEx.uid, storage) then
			doSendAnimatedText(getThingPos(itemEx.uid),"Frozen!", TEXTCOLOR_BLUE)
			doCombat(itemEx.uid, combat, numberToVariant(itemEx.uid))
			doCreatureSetNoMove(itemEx.uid, 1)
			addEvent(doRemove, time * 1000, itemEx.uid)
			exhaustion.set(itemEx.uid, storage, cooldown)
			for i = 1, time + 1 do
				addEvent(doSendAnimatedText,i * 1000, getThingPos(itemEx.uid), ( i < time + 1 and "Melt:"..n.."" or "Melted!") , i < time + 1 and TEXTCOLOR_GREEN or TEXTCOLOR_RED)
				addEvent(doSendMagicEffect,i * 1000, getThingPos(itemEx.uid),5)
				n = n - 1
			end
		else
			doPlayerSendCancel(cid, "You must wait " .. exhaustion.get(itemEx.uid, storage) .. " seconds.")
		end
	else
		doPlayerSendCancel(cid, "Sorry, not possible.")
	end
	return true
end
 
Well, i dont think we shud have done this step.. To change all "Cids" to "itemEx.uid"

Heres what i get
Code:
[07/07/2011 04:16:43] [Error - Action Interface] 
[07/07/2011 04:16:43] In a timer event called from: 
[07/07/2011 04:16:43] data/actions/scripts/other/freeze rune.lua:onUse
[07/07/2011 04:16:43] Description: 
[07/07/2011 04:16:43] data/actions/scripts/other/freeze rune.lua:20: attempt to index global 'itemEx' (a nil value)
[07/07/2011 04:16:43] stack traceback:
[07/07/2011 04:16:43] 	data/actions/scripts/other/freeze rune.lua:20: in function <data/actions/scripts/other/freeze rune.lua:19>
[07/07/2011 04:18:22] [Error - LuaScriptInterface::loadFile] data/actions/scripts/other/freeze rune.lua:19: ')' expected near '.'
[07/07/2011 04:18:22] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/other/freeze rune.lua)
[07/07/2011 04:18:22] data/actions/scripts/other/freeze rune.lua:19: ')' expected near '.'
 
Add this inside the script:

Lua:
if getTilePzInfo(toPosition) == true then
	return doPlayerSendCancel(cid, "Sorry, not possible.")
end
 
Well i added it so it looks like that
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
But cool down time isnt working even without adding pz part..
EDIT: Plus i can freeze someone while im in pz and hes out.. Wow this rune is kinda f**ked
 
Last edited:
Code:
local freezetime = 4    
 
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 not isPlayer(itemEx.uid) or cid == itemEx.uid then
		return doPlayerSendCancel(cid,"You can only use this on another players.")
	end

       if getTilePzInfo(toPosition) == true then
	       return doPlayerSendCancel(cid, "You cannot use this in a PZ!.")
       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
 
Back
Top