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

CreatureEvent Simple scripts for level 100, 200, and 300

Joined
Apr 17, 2008
Messages
1,922
Solutions
1
Reaction score
188
Location
Venezuela
Well hello this is a simple script that i made for a friend...

When you reaches the level 100 you obtain 10cc and a bronze trophy.
When you reaches the level 200 you obtain 20cc and a plate trophy.
When you reaches the level 300 you obtain 30cc and a gold trophy.

Here is..
(.data/scripts/advances/level.lua
Code:
--onAdvance system by 4220niller
--Script by Darkhaos
function onAdvance(cid, skill, oldlevel, newlevel)

local config = {
	playerName = getCreatureName(cid),
	addStorage1 = 13201,
	addStorage2 = 13202,
	addStorage3 = 13203,
	checkStorage1 = getPlayerStorageValue(cid,config.addStorage1),
	checkStorage2 = getPlayerStorageValue(cid,config.addStorage2),
	checkStorage3 = getPlayerStorageValue(cid,config.addStorage3),
	itemToAdd = 2160,
	bronzeGoblet = 5087,
	plateGoblet = 5086,
	goldGoblet = 5085
}


	if newlevel == 100 and config.checkStorage1 == -1 then
		doPlayerAddItem(cid,config.itemToAdd,10)
		local bronzeGoblet = doPlayerAddItem(cid,config.bronzeGoblet,1)
		doSetItemSpecialDescription(bronzeGoblet, "This trophy is given to the adventurer for 

reaches the level 100. Awarded to " .. config.playerName .. ".")
		setPlayerStorageValue(cid,config.addStorage1,1)
	end

	elseif newlevel == 200 and config.checkStorage2 == -1 then
		doPlayerAddItem(cid,config.itemToAdd,20)
		local plateGoblet = doPlayerAddItem(cid,config.plateGoblet,1)
		doSetItemSpecialDescription(plateGoblet, "This trophy is given to the adventurer for 

reaches the level 200. Awarded to " .. config.playerName .. ".")
		setPlayerStorageValue(cid,config.addStorage2,1)
	end

	elseif newlevel == 300 and config.checkStorage3 == -1 then
		doPlayerAddItem(cid,config.itemToAdd,30)
		local goldGoblet = doPlayerAddItem(cid,config.goldGoblet,1)
		doSetItemSpecialDescription(goldGoblet, "This trophy is given to the adventurer for 

reaches the level 300. Awarded to " .. config.playerName .. ".")
		setPlayerStorageValue(cid,config.addStorage3,1)
	end
		else
	return FALSE
end

Not tested =D
 
Last edited:
Put the config outside of the function, also, TFS has already built-in onAdvance, you dont need to use Nillers one. :)
 
ehhh doesnt work plx, fix it ;)
my msg:
[14/12/2008 21:48:59] Warning: [Event::loadScript] Can not load script. data/creaturescripts/scripts/level.lua
[14/12/2008 21:48:59] data/creaturescripts/scripts/level.lua:57: unfinished string near '"This trophy is given to the adventurer for '
[14/12/2008 21:48:59] Warning: [Event::loadScript] Event onLogin not found. data/creaturescripts/scripts/login2.lua
[14/12/2008 21:48:59] Reloaded creature events.
 
So it wont work for tfs 0.2? :( I Though there is onAdvance function ;/

anyway I just tried it and dont know what I shall write in creaturescripts.xml

Code:
<event type="onAdvance" name="onAdvance"  script="adv.lua"/>

is showing erors


Code:
[15/12/2008 01:08:29] [Error - CreatureEvent::configureEvent] No valid type for creature event.onAdvance
[15/12/2008 01:08:29] [Warning - BaseEvents::loadFromXml] Can not configure event

what event type shall be?
 
Last edited:
So it wont work for tfs 0.2? :( I Though there is onAdvance function ;/

anyway I just tried it and dont know what I shall write in creaturescripts.xml

Code:
<event type="onAdvance" name="onAdvance"  script="adv.lua"/>

is showing erors


Code:
[15/12/2008 01:08:29] [Error - CreatureEvent::configureEvent] No valid type for creature event.onAdvance
[15/12/2008 01:08:29] [Warning - BaseEvents::loadFromXml] Can not configure event

what event type shall be?

bump, comeon :p nobody know? :|
 
@above; type="onAdvance" does not exist.
 
Back
Top