• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Some creatureevents that I waht to share with You.

LucasFerraz

Systems Analyst
Joined
Jun 10, 2010
Messages
2,858
Reaction score
96
Location
Brazil
After a long time searching this scripts, I've found them. I want to share with you.
I don't remember who made it. IT'S NOT BY ME!

{CreatureEvents}

End of VIP (vip_time) working 100%
In creaturescripts.xml put:
XML:
	<event type="login" name="VipFim" event="script" value="VipFim.lua"/>
In data/creaturescripts/scripts create a VipFim.lua and put:
Lua:
function onLogin(cid)
	if vip.hasVip(cid) == true then
		setPlayerStorageValue(cid, 20500, 1)
	elseif vip.hasVip(cid) == false and getPlayerStorageValue(cid, 20500) == 1 then
		doTeleportThing(cid, getPlayerMasterPos(cid))	
                        doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Your VIP has expired. The gods has therefore transported you to safety in Carlin.")	
		setPlayerStorageValue(cid, 20500, -1)
		setPlayerPromotionLevel(cid,1)
	end
	return true
end

Add in login.lua
Lua:
        registerCreatureEvent(cid, "VipFim")


Extra experience for VIP players (vip_time) working 100%
In creaturescripts.xml put:
XML:
        <event type="login" name="ExpVip" script="vipexp.lua"/>
In data/creaturescripts/scripts create a vipexp.lua and put:
Lua:
function onLogin(cid)

local rate = 1.1 -- 50%
local config = {
welvip = "You have "..((rate - 1)*100).."% of extra experience!",
not_vip = "Vip Accounts have "..((rate - 1)*100).."% of extra experience!",
s = 13540, -- storage vip
}

if vip.getVip(cid) >= 1 then
doPlayerSetExperienceRate(cid, rate)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, config.welvip)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, config.not_vip)
end
return TRUE
end

Add in login.lua
Lua:
                registerCreatureEvent(cid, "ExpVip")


Level 49- can be killed but will lose nothing (Will lose only if have skull)
Script made by Cykotitan
In creaturescripts.xml put:
XML:
        <event type="preparedeath" name="prevent" event="script" value="prevent.lua"/>
In data/creaturescripts/scripts create a prevent.lua and put:
Lua:
function getNameDescription(creature)
	local v = getCreatureName(creature)
	return isMonster(creature) and getMonsterInfo(v).description or v
end
 
function onPrepareDeath(cid, deathList)
	if getPlayerLevel(cid) < 50 and getCreatureSkullType(cid) < SKULL_WHITE then
		local corpse, ss = doCreateItem(getPlayerSex(cid) == 0 and 6081 or 6080, 1, getThingPos(cid)), ''
		ss = "You recognize " .. getCreatureName(cid) ..  ". " .. (getPlayerSex(cid) % 2 ~= 0 and "He" or "She") .. " was killed by "
		if isCreature(deathList[1]) then
			ss = ss .. getNameDescription(deathList[1])
			local master = getCreatureMaster(deathList[1])
			if master and master ~= deathList[1] then
				ss = ss .. " summoned by " .. getNameDescription(master)
			end
		else
			ss = ss .. deathList[1]
		end
 
		if #deathList > 1 then
			if type(deathList[1]) ~= type(deathList[2]) then
				if isCreature(deathList[2]) then
					ss = ss .. " and by " .. getNameDescription(deathList[2])
					local master = getCreatureMaster(deathList[2])
					if master and master ~= deathList[2] then
						ss = ss .. " summoned by " .. getNameDescription(master)
					end
				else
					ss = ss .. " and by " .. deathList[2]
				end
			elseif isCreature(deathList[2]) then
				if getNameDescription(deathList[1]) ~= getNameDescription(deathList[2]) then
					ss = ss .. " and by " .. getNameDescription(deathList[2])
					local master = getCreatureMaster(deathList[2])
					if master and master ~= deathList[2] then
						ss = ss .. " summoned by " .. getNameDescription(master)
					end
				end
			elseif deathList[1]:lower() ~= deathList[2]:lower() then
				ss = ss .. " and by " .. deathList[2]
			end
		end
		doItemSetAttribute(corpse, 'description', ss)
		doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
		doCreatureAddHealth(cid, getCreatureMaxHealth(cid), 65535, 256, true)
		doCreatureAddMana(cid, getCreatureMaxMana(cid))
		doRemoveConditions(cid, false)
		return false
	end
	return true
end

Add in login.lua
Lua:
                       registerCreatureEvent(cid, "prevent")


A way to prevent loss with OT Down
Description: Character will save at level advance.
In creaturescripts.xml put:
XML:
		<event type="advance" name="AdvanceSave" event="script" value="advancesave.lua"/>
In data/creaturescripts/scripts create a advancesave.lua and put:
Lua:
function onAdvance(cid, skill, oldLevel, newLevel)
local config = {savePlayersOnAdvance = true}
if(config.savePlayersOnAdvance) then
doPlayerSave(cid, TRUE)
end
return TRUE
end

Add in login.lua
Lua:
                       	registerCreatureEvent(cid, "AdvanceSave")
 
Last edited:
Back
Top