• 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 doRemoveCondition doesn't work.

Bogart

...has super panda powers
Senator
Joined
Jun 21, 2009
Messages
8,007
Solutions
27
Reaction score
564
Location
Panda Land!
Hello, well as title say, i have a change map mod, its all working, but it doesn't remove the PZ and i get an error.
Mod:
Lua:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Map Change" version="2.0" author="Syntax" contact="[email protected]" enabled="yes">
   <description>
        This should teleport all players to a new random town in intervals.
   </description>
	<config name="mapchange_config"><![CDATA[
		config = {
                access = 3, -- minimum access to bypass teleportation.
		temples = {1,2,3} --townids to teleport to.
		}
 ]]></config>
   <event type="login" name="Map Login" event="script"><![CDATA[
	function onLogin(cid)
		doPlayerSetTown(cid, getGlobalStorageValue(3454))
		doTeleportThing(cid, getPlayerMasterPos(cid))
	return true
	end
]]></event>
	<globalevent name="Map Change" interval="10" event="script"><![CDATA[
	domodlib('mapchange_config')
		function onThink(interval, lastExecution, thinkInterval)
			repeat
				RDM = math.random(1,#config.temples)
			until RDM ~= getGlobalStorageValue(3454) and isInArray(config.temples, RDM)
			for _, pid in ipairs(getPlayersOnline()) do
				if getPlayerAccess(pid) < config.access then
					doPlayerSetTown(pid, config.temples[RDM])
					doTeleportThing(pid, getTownTemplePosition(config.temples[RDM]), false)
					doSendMagicEffect(getCreaturePosition(pid), 37)
					doRemoveCondition(cid, CONDITION_INFIGHT)
					doCreatureAddHealth(pid, getCreatureMaxHealth(pid))
					doCreatureAddMana(pid, (getCreatureMaxMana(pid) - getCreatureMana(pid)))
					setGlobalStorageValue(3454, config.temples[RDM])
				end
			end
		return true
		end
]]></globalevent>
</mod>

Error:
0KyJjIvsk9.png

Hope someone can help me.
also ill give rep.
 
Code:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Map Change" version="2.0" author="Syntax" contact="[email protected]" enabled="yes">
   <description>
        This should teleport all players to a new random town in intervals.
   </description>
	<config name="mapchange_config"><![CDATA[
		config = {
                access = 3, -- minimum access to bypass teleportation.
		temples = {1,2,3} --townids to teleport to.
		}
 ]]></config>
   <event type="login" name="Map Login" event="script"><![CDATA[
	function onLogin(cid)
		doPlayerSetTown(cid, getGlobalStorageValue(3454))
		doTeleportThing(cid, getPlayerMasterPos(cid))
	return true
	end
]]></event>
	<globalevent name="Map Change" interval="10" event="script"><![CDATA[
	domodlib('mapchange_config')
		function onThink(interval, lastExecution, thinkInterval)
			repeat
				RDM = math.random(1,#config.temples)
			until RDM ~= getGlobalStorageValue(3454) and isInArray(config.temples, RDM)
			for _, pid in ipairs(getPlayersOnline()) do
				if getPlayerAccess(pid) < config.access then
					doPlayerSetTown(pid, config.temples[RDM])
					doTeleportThing(pid, getTownTemplePosition(config.temples[RDM]), false)
					doSendMagicEffect(getCreaturePosition(pid), 37)
					doRemoveCondition(cid, CONDITION_INFIGHT)
					doCreatureAddHealth(pid, getCreatureMaxHealth(pid))
					doCreatureAddMana(pid, (getCreatureMaxMana(pid) - getCreatureMana(pid)))
					setGlobalStorageValue(3454, config.temples[RDM])
				end
			end
		return true
		end
]]></globalevent>
</mod>
 
Code:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Map Change" version="2.0" author="Syntax" contact="[email protected]" enabled="yes">
   <description>
        This should teleport all players to a new random town in intervals.
   </description>
	<config name="mapchange_config"><=!=[=C=D=A=T=A=[
		config = {
                access = 3, -- minimum access to bypass teleportation.
		temples = {1,2,3} --townids to teleport to.
		}
 ]=]=></config>
   <event type="login" name="Map Login" event="script"><=!=[=C=D=A=T=A=[
	function onLogin(cid)
		doPlayerSetTown(cid, getGlobalStorageValue(3454))
		doTeleportThing(cid, getPlayerMasterPos(cid))
	return true
	end
]=]=></event>
	<globalevent name="Map Change" interval="10" event="script"><=!=[=C=D=A=T=A=[
	domodlib('mapchange_config')
		function onThink(interval, lastExecution, thinkInterval)
			repeat
				RDM = math.random(1,#config.temples)
			until RDM ~= getGlobalStorageValue(3454) and isInArray(config.temples, RDM)
			for _, pid in ipairs(getPlayersOnline()) do
				if getPlayerAccess(pid) < config.access then
					doPlayerSetTown(pid, config.temples[RDM])
					doTeleportThing(pid, getTownTemplePosition(config.temples[RDM]), false)
					doSendMagicEffect(getCreaturePosition(pid), 37)
					doRemoveCondition(cid, CONDITION_INFIGHT)
					doCreatureAddHealth(pid, getCreatureMaxHealth(pid))
					doCreatureAddMana(pid, (getCreatureMaxMana(pid) - getCreatureMana(pid)))
					setGlobalStorageValue(3454, config.temples[RDM])
				end
			end
		return true
		end
]=]=></globalevent>
</mod>

same lol, did u even change something?
 
That script uses doRemoveCondition, but the error shows doRemoveConditions?! :w00t:

Anyways, change cid to pid
Code:
					doRemoveCondition([B][COLOR="red"]p[/COLOR][/B]id, CONDITION_INFIGHT)
 
That script uses doRemoveCondition, but the error shows doRemoveConditions?! :w00t:

Anyways, change cid to pid
Code:
					doRemoveCondition([B][COLOR="red"]p[/COLOR][/B]id, CONDITION_INFIGHT)

well thanks, ill never trust in LUA_FUNCTIONS again :p
 
Back
Top