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

MODS : Special VIP RING 2Xhp 2Xsp 2Xspd and going on ...

sailorv5

Member
Joined
Oct 31, 2009
Messages
82
Reaction score
17
i did this for a friend.
when a player use the ring it's life mana and spd rise ( by parameter ) -- bad english XD


SEE THE VIDEO (spd bonus is disable on this video )
TIBIA LIFE RING with effect and and double SPD ( need to change parametre ) - YouTube




[font=helvetica, arial, sans-serif]BY side of DATA folder there is a MODS folder[/font]


[font=helvetica, arial, sans-serif]go inside and make a new .xml file named lifeRingSystem.xml[/font]


Code:
<!--?xml version="1.0" encoding="UTF-8"?-->  
<mod name="Life ring System" version="1.0" author="Willian Batista Cima" contact="none" enabled="yes">
-----------------------------------------------------------------------
<config name="lifeRingSystem"><!--[CDATA[




		
 lifeRingSystem = {
		storageBase = 9000101	,
		ringOn =  2127	,
		ringOff = 2127	,


		vocHp = {	5 , 5, 10, 15, 	5 , 5, 10, 15 }		,			--  vocation 1 to 8 	hp gain if lv up using the ring !
		vocSp = {	30, 30 ,15, 5,  30, 30 ,15, 5 }			,			--  vocation 1 to 8 	sp gain if lv up using the ring !
		
		RemoveCreatureConditions = false ,			--		
		
--		MLVGAIN  = 200	,		--	 not sopported yet  !
		
		HEALTHGAIN  = 1000	,		  	 -- hp gain 
		HEALTHLOSS  = 50	,		  	 -- hp loss  if hitted by effect


		MANAGAIN		=	1000	,			--  mana gain
		MANALOSS		=	50	,			--  mana loss  if hitted by effect
		
		SPEEDGAIN		=	1000 	,


		EFFECTChance	=	90 , 			-- mean 50% of chance to happens 	( 0 mean never do ) ( 100 alws do )
		EFFECTRange		=	2 , 				--	2X2  square range		0 means player position
		EFFECTPlayer	={
						  [1] = {	[STATSCHANGE_HEALTHGAIN]= CONST_ME_YELLOW_RINGS,	[STATSCHANGE_HEALTHLOSS] = CONST_ME_YELLOW_RINGS ,				--		
									[STATSCHANGE_MANAGAIN] = CONST_ME_HOLYAREA ,		[STATSCHANGE_MANALOSS] = CONST_ME_HOLYAREA	 , 
									ringinuse =  CONST_ME_FIREWORK_YELLOW, 
									disshot = CONST_ANI_SMALLHOLY ,
								} ,
						  [0] = {	[STATSCHANGE_HEALTHGAIN]= CONST_ME_FIREWORK_RED,	[STATSCHANGE_HEALTHLOSS] = CONST_ME_EXPLOSIONAREA,
									[STATSCHANGE_MANAGAIN] = CONST_ME_MAGIC_RED ,		[STATSCHANGE_MANALOSS] = CONST_ME_FIREAREA	 , 
									ringinuse =  CONST_ME_FIREWORK_RED,
									disshot = CONST_ANI_FIRE ,
								}
						}
		


}
--	lifeRingSystem.EFFECTPlayer.[2] = lifeRingSystem.EFFECTPlayer.[0]	--	GM gets GIRLS  effects
lifeRingSystem.storageLv = lifeRingSystem.storageBase+1
lifeRingSystem.storageHp = lifeRingSystem.storageBase+2
lifeRingSystem.storageSp = lifeRingSystem.storageBase+3
--	lifeRingSystem.storageSped = lifeRingSystem.storageBase+4			-- better remove all storage but base






]]--></config>


-----------------------------------------------------------------------
	<event type="login" name="lifeRingSystem_login" event="script"><!--[CDATA[
			function onLogin(cid)
				registerCreatureEvent(cid,"lifeRingSystem_gain_effect")
				registerCreatureEvent(cid,"lifeRingSystem_think")
				return true
			end
	]]--></event>
	
	
-----------------------------------------------------------------------
	<event type="think" name="lifeRingSystem_think" event="script"><!--[CDATA[
	domodlib('lifeRingSystem')
	local cfg = lifeRingSystem




		function onThink(cid, interval)
			if lifeRingSystem_last_interval == nil then lifeRingSystem_last_interval= os.clock() 	end


			if (os.clock() - lifeRingSystem_last_interval) --> 2 then		--		execute every 2 sec
				if isPlayer(cid) then
					if getPlayerStorageValue(cid, cfg.storageBase )	== 1 then


							local pos = getPlayerPosition(cid)
							local r =  cfg.EFFECTRange
							local toPositions = {	x = pos.x + math.random( -r , r  ), y = pos.y + math.random(-r,r), z = pos.z}				
							doSendMagicEffect( toPositions , cfg.EFFECTPlayer[getPlayerSex(cid)].ringinuse	 )


					end
					
					lifeRingSystem_last_interval= os.clock()
				end
				return true
			end
				
				return false
		end
	
	]]></event>
	


	
-----------------------------------------------------------------------




	<event type="statschange" name="lifeRingSystem_gain_effect" event="script"><!--[CDATA[
	domodlib('lifeRingSystem')
	local cfg = lifeRingSystem




	function onStatsChange(cid, attacker, type, combat, value)




			if getPlayerStorageValue(cid, cfg.storageBase )	== 1 then
				if  math.random(1,100)	< cfg.EFFECTChance and isInArray( {1,2,3,4} , type )    then


					local pos = getPlayerPosition(cid)
					local r =  cfg.EFFECTRange
					local toPositions = {	x = pos.x + math.random( -r , r  ), y = pos.y + math.random(-r,r), z = pos.z}				
					
					doSendDistanceShoot( {x = pos.x - math.random(-7,7), y = pos.y + math.random(-6,6), z = pos.z}, toPositions, cfg.EFFECTPlayer[getPlayerSex(cid)].disshot	 )
					doSendMagicEffect( toPositions , cfg.EFFECTPlayer[getPlayerSex(cid)][ type ] )


					local thing = getThingfromPos(toPositions)


					if isPlayer(thing) then
						if cfg.RemoveCreatureConditions then doRemoveConditions(thing)		end
						doCreatureAddHealth(thing, HEALTHLOSS )
						doCreatureAddMana(thing, getCreatureMaxMana(thing)-getCreatureMana(thing))
					end
					
					


				end
			end




		return true
	end
	]]--></event>




-----------------------------------------------------------------------


				
<movevent type="Equip" itemid="2127" slot="ring" event="script"><!--[CDATA[
domodlib('lifeRingSystem')
local cfg = lifeRingSystem




function onEquip(cid, item, slot) 




    if(item.itemid == cfg.ringOn) then
	
			if getPlayerStorageValue(cid, cfg.storageBase )	~= 1 then
				setPlayerStorageValue(cid, cfg.storageLv  , getPlayerLevel(cid) )
				setPlayerStorageValue(cid, cfg.storageHp  , getCreatureMaxHealth(cid) )
				setPlayerStorageValue(cid, cfg.storageSp  , getPlayerMaxMana(cid) )


--				setPlayerStorageValue(cid, cfg.storageSped  , getCreatureSpeed(cid) )
	
				setPlayerStorageValue(cid, cfg.storageBase  , 1 )
				
				
				setCreatureMaxHealth(cid, (getPlayerStorageValue(cid, cfg.storageHp )+cfg.HEALTHGAIN)  )
				setCreatureMaxMana(cid,   (getPlayerStorageValue(cid, cfg.storageSp )+cfg.MANAGAIN)    )
				doChangeSpeed(cid, ( getCreatureSpeed(cid)+cfg.SPEEDGAIN)	)		--	getPlayerStorageValue(cid, cfg.storageSped )
				
			end




			


	return true
    end


	return false
end




return true
]]--></movevent>




-----------------------------------------------------------------------


<movevent type="DeEquip" itemid="2127" slot="ring" event="script"><!--[CDATA[
domodlib('lifeRingSystem')
local cfg = lifeRingSystem


function onDeEquip(cid, item, slot)




    if(item.itemid == cfg.ringOff) then		
	


		if getPlayerStorageValue(cid, cfg.storageLv )	< getPlayerLevel(cid) and getPlayerAccess(cid) < 2 and getPlayerVocation(cid) --> 0 then
		
			setPlayerStorageValue(cid, cfg.storageHp  , ( (getPlayerLevel(cid)-getPlayerStorageValue(cid, cfg.storageLv )) *cfg.vocHp[getPlayerVocation(cid)])  +getCreatureMaxHealth(cid)    )
			
			setPlayerStorageValue(cid, cfg.storageSp  , ( (getPlayerLevel(cid)-getPlayerStorageValue(cid, cfg.storageLv )) *cfg.vocSp[getPlayerVocation(cid)])  +getPlayerMaxMana(cid)    )


		end
		
			
			setCreatureMaxHealth(cid, getPlayerStorageValue(cid, cfg.storageHp )    )
			setCreatureMaxMana(cid,   getPlayerStorageValue(cid, cfg.storageSp )    )
						doCreatureAddHealth(cid,	getCreatureHealth(cid)+1	)	--	getCreatureMaxHealth(cid)
						doCreatureAddMana(cid, 	getCreatureMana(cid)+1	)			--	getCreatureMaxMana(cid)
			--  speed base level  218 + ( 2*level)		http://www.tibiabr.com/calc_de_velocidade
			doChangeSpeed(cid, ( -getCreatureSpeed(cid)+ 	 218+(2*getPlayerLevel(cid) )	)	)
						
						
			setPlayerStorageValue(cid, cfg.storageBase  , -1  )




	return true
    end


	return false
end




return true
]]></movevent>




<talkaction words="!playerspd" event="script"><!--[CDATA[
domodlib('lifeRingSystem')
local cfg = lifeRingSystem
	
	function onSay(cid, words, param, channel)
			if(param ~= '') then
			doPlayerSendCancel(cid, 'no need a para. ')
			
			return true
		end
		
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, getPlayerName(cid) .. " have spd now " .. getCreatureSpeed(cid) 	)


		return true
	end
]]--></talkaction> 


	




</mod>


HOW to SETup


Code:
 lifeRingSystem = {
		storageBase = 9000101	,


		
		RemoveCreatureConditions = false ,			--		
		
		
		HEALTHGAIN  = 1000	,		  	 -- hp gain 


		MANAGAIN		=	1000	,			--  mana gain
		
		SPEEDGAIN		=	1000 	,


		EFFECTChance	=	90 , 			-- mean 50% of chance to happens 	( 0 mean never do ) ( 100 alws do )
		EFFECTRange		=	2 , 				--	2X2  square range		0 means player position


		


}
press CTRL +F and look for thoses world

HEALTHGAIN
MANAGAIN
SPEEDGAIN
EFFECTChance
EFFECTRange



neeed help only post here ! or pm
 
Last edited:
Heh I suggest you to check my thread about array serialization :p

you can all this data store in single table using ONE storage instead of four.
Code:
lifeRingSystem.storageLv = lifeRingSystem.storageBase+1
lifeRingSystem.storageHp = lifeRingSystem.storageBase+2
lifeRingSystem.storageSp = lifeRingSystem.storageBase+3
--	lifeRingSystem.storageSped = lifeRingSystem.storageBase+4
 
Lua:
setCreatureMaxHealth(cid, (getPlayerStorageValue(cid, cfg.storageHp )+cfg.HEALTHGAIN)  )

I'm not quite sure but if you are wearing any item wich give you more HP (Addons as well) you can get players with tons of HP.
 
dat tabulation =/
 
test

Heh I suggest you to check my thread about array serialization :p

you can all this data store in single table using ONE storage instead of four.
Code:
lifeRingSystem.storageLv = lifeRingSystem.storageBase+1
lifeRingSystem.storageHp = lifeRingSystem.storageBase+2
lifeRingSystem.storageSp = lifeRingSystem.storageBase+3
--	lifeRingSystem.storageSped = lifeRingSystem.storageBase+4
i ll check you post ty for your advice.

Lua:
setCreatureMaxHealth(cid, (getPlayerStorageValue(cid, cfg.storageHp )+cfg.HEALTHGAIN)  )

I'm not quite sure but if you are wearing any item wich give you more HP (Addons as well) you can get players with tons of HP.
That is True i got a problem doing this some time hp was buged and play hp rised to infinite.
that is why if player level change we do this !
Code:
		if getPlayerStorageValue(cid, cfg.storageLv )	< getPlayerLevel(cid) and getPlayerAccess(cid) < 2 and getPlayerVocation(cid) --> 0 then
		
			setPlayerStorageValue(cid, cfg.storageHp  , ( (getPlayerLevel(cid)-getPlayerStorageValue(cid, cfg.storageLv )) *cfg.vocHp[getPlayerVocation(cid)])  +getCreatureMaxHealth(cid)    )
			
			setPlayerStorageValue(cid, cfg.storageSp  , ( (getPlayerLevel(cid)-getPlayerStorageValue(cid, cfg.storageLv )) *cfg.vocSp[getPlayerVocation(cid)])  +getPlayerMaxMana(cid)    )


		end

dat tabulation =/
that is because i wrote LONG LINE.
if you copy to a file it should look better.
( at list my file is well )

@topic
i did a better code but i have some hp issue when fixed this new way i ll update.
 
Back
Top