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

Rook script!

enriel

Big L
Joined
Dec 14, 2007
Messages
1,254
Reaction score
2
Location
Montenegro
I need a script that if you reach main land from rook, that if you get below level 6 you get back to rookguard with normal mana etc, so players can't kill themselves until level 1 and get 200 more hp.
 
ServerDirectory/mods/Rook.xml
Lua:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Rook" version="1.0" author="Slaktaren" contact="my ass" enabled="yes">
	
	<event type="login" name="RookingLogin" event="script"><![CDATA[
			registerCreatureEvent(cid, "Rook")
		return TRUE
	]]></event>
	
	<event type="think" name="Rook" event="script"><![CDATA[
		
		local cfg = {
				exp = -getPlayerExperience(cid), -- Do not change
				rookPos = { posx = XXX, posy = YYY, posz = ZZZ }, -- Rook temple position
				rookID = 1, -- The town id of the rook
				TP_Effect, -- Effect when teleported
				rookVocID = 0, -- ID of No Vocation
				rookedLevel = 5, -- Level to get rooked
					}
		
			if getPlayerLevel(cid) <= cfg.rookedLevel then
				if getPlayerTown(cid) ~= cfg.rookID then
					doPlayerAddExperience(cid, cfg.exp)
					doPlayerSetVocation(cid, cfg.rookVocID)
					doTeleportThing(cid, cfg.rookPos, FALSE)
					doPlayerSetTown(cid, cfg.rookID)
					doSendMagicEffect(cfg.rookPos, cfg.TP_Effect)
				end
			end
		return TRUE
	]]></event>
</mod>

If a player goes under level 6(means 5 or lower):
Set player exp to 0, means he will get downgraded to level 1 and get 150 hp, 0 mana.
Will set the players vocation to 0(No Vocation)
Player will get teleported to rook temple(rookPos)
Player town will be set to 1(rookID, change it to the correct id of rook temple)
Will ignore players with rook temple id, so it won't teleport players that already been rooked :p

Tell me if it worked or not please!
 
Last edited:
It's because of
Lua:
 tags, copy again:
[CODE]<?xml version="1.0" encoding="UTF-8"?>
<mod name="Rook" author="Slaktaren" enabled="yes">
	<event type="login" name="RookingLogin" event="script"><![CDATA[
		registerCreatureEvent(cid, "Rook")
		return true
	]]></event>
	<event type="think" name="Rook" event="script"><![CDATA[
		local cfg = {
			exp = -getPlayerExperience(cid), -- Do not change
			rookPos = { posx = XXX, posy = YYY, posz = ZZZ }, -- Rook temple position
			rookID = 1, -- The town id of the rook
			TP_Effect, -- Effect when teleported
			rookVocID = 0, -- ID of No Vocation
			rookedLevel = 5 -- Level to get rooked
		}

		if getPlayerLevel(cid) <= cfg.rookedLevel then
			if getPlayerTown(cid) ~= cfg.rookID then
				doPlayerAddExperience(cid, cfg.exp)
				doPlayerSetVocation(cid, cfg.rookVocID)
				doTeleportThing(cid, cfg.rookPos, FALSE)
				doPlayerSetTown(cid, cfg.rookID)
				doSendMagicEffect(cfg.rookPos, cfg.TP_Effect)
			end
		end
		return true
	]]></event>
</mod>
 
Cyko, what did you change?
Nothing important,

25i1b2x.png
 
Oh, will that become a problem?
Well, thank you! Now I know that :)

Seems to be a nice edtior, is it better than Notepad++?
No, it wouldn't be a problem but you should use
Code:
 tags next time you're posting a xml file (like a mod), because newbies run into problems if you use [code=lua] tags.

Also it's not an editor but a comparing tool.
 
Back
Top