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

[Mod] Ignore damage spell/ 100% protection

Summ

(\/)(;,,;)(\/) Y not?
Staff member
Global Moderator
Joined
Oct 15, 2008
Messages
4,152
Solutions
12
Reaction score
1,107
Location
Germany :O
Hello Guys.

•¤• Request•¤•
http://otland.net/f132/spell-absorbpercentall-59012/

•¤• Description•¤•
All damage, which is taken in the period of time set, will be absorbed.

•¤•Effect:•¤•
Divine_Caldera.gif

Everytime the player normally would receive damage, this effect is shown. Also when the spell is cast.

•¤• Information•¤•

The exhaustion should be higher than the duration or the players have infinite protection.
If you find bug, post here. But I tested it and it worked fine.
If you know any features I can add tell me.

•¤•Script:•¤•
Code:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Protector" version="1.1" author="Summ" contact="" enabled="yes">

	<config name="pro_config"><![CDATA[
		config = {
			lvl = 0,
			mlvl = 0,
			mana = 0,
			duration = 10,
			storage = 60400,
			exhausted = 4,
			storage_exhau = 60401,
			blockheal = 0,
			showtext = 1
			}
	]]></config>

		<event type="login" name="ProLog" event="script"><![CDATA[
		function onLogin(cid)
			registerCreatureEvent(cid,"protector")
			registerCreatureEvent(cid,"protectorr")
			return true
		end
		]]></event>
	
		<event type="combat" name="protector" event="script"><![CDATA[
			domodlib('pro_config')
			function onCombat(cid,target)
				if isPlayer(target) == TRUE then
					if os.time() <= getPlayerStorageValue(target, config.storage) then
						if config.showtext == 1 then
							doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"You cannot hurt "..getPlayerName(target)..", because he is protected.")
							doPlayerSendTextMessage(target,MESSAGE_INFO_DESCR,""..getPlayerName(cid).." tried to attack you, but you are protected.")
						end
						doSendMagicEffect(getPlayerPosition(target),49)
						return false
					end
				end
			return TRUE
			end
		]]></event>

		<event type="statschange" name="protectorr" event="script"><![CDATA[
			domodlib('pro_config')
			function onStatsChange(cid, attacker, type, combat, value)
				if not(combat == 128 and config.blockheal == 0) then
					if os.time() <= getPlayerStorageValue(cid, config.storage) then
						if config.showtext == 1 then
							doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"You could not be healed because you are protected.")
						end
						doSendMagicEffect(getPlayerPosition(cid),49)
						return false
					end
				end
				return true
			end
		]]></event>

	<talkaction words="protector" event="script"><![CDATA[
		domodlib('pro_config')
		function onSay(cid, words, param, channel)
		if getPlayerLevel(cid) < config.lvl then
			doPlayerSendCancel(cid,"Your level is too low.")
			doSendMagicEffect(getPlayerPosition(cid),2)
			return true
		end
		if getPlayerMagLevel(cid) < config.mlvl then
			doPlayerSendCancel(cid,"Your magic level is too low.")
			doSendMagicEffect(getPlayerPosition(cid),2)
			return true
		end
		if getCreatureMana(cid) < config.mana then
			doPlayerSendCancel(cid,"You do not have enough mana.")
			doSendMagicEffect(getPlayerPosition(cid),2)
			return true
		end
		if os.time() <= getPlayerStorageValue(cid,config.storage_exhau) and not(getPlayerStorageValue(cid,config.storage_exhau) < 5) then
			doPlayerSendCancel(cid,"You can use this spell only once in "..config.exhausted.." seconds.")
			doSendMagicEffect(getPlayerPosition(cid),2)
			return true
		else
			setPlayerStorageValue(cid,config.storage,(os.time()+config.duration))
			setPlayerStorageValue(cid,config.storage_exhau,(os.time()+config.exhausted))
			doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"You are protected for "..config.duration.." seconds now.")
			doSendMagicEffect(getPlayerPosition(cid),49)
			doPlayerAddSpentMana(cid,config.mana)
		end
		return false
		end
	]]></talkaction>
	

</mod>

•¤•REP+ please!•¤•

•¤•Update:•¤•
•¤•showtext in config (1 = text is shown to the attacker and the attacked)
•¤•blockheal in config (1 = player can't even be healed, 0 = player can be healed)
 
Last edited:
good one :peace: but you should have done it as a spell(in the mod) rather than talkaction
 
Ye but with that talkaction there is not a big difference to a spell, since it doesn't add pz and such.
 
ofc thats possible, ill try to do it later
and the talkaction script gets shorter as spell, big diff
 
Very good! But i don't understand well one thing, How i can put to abosorb only one element?

Gratz!
 
lol this even isnt a globalevent

by the way, if a player is attacked, he loses hp?
 
i'll make a script inspired from this, somewhat, but will be ubercool
 
The player won't loose 1 hp while the spell is running neither from ultimate explosions, nor from hits, nor from things like fire fields.
 
Yea and he can't heal himself, lol.

Add:
Lua:
	if combat == COMBAT_HEALING then
		return true
	end
 
nvm
 
Last edited:
@Shawak
Ja, danke.
Hab ich mir gestern abend auch überlegt und eben gefixt.

@Cybermaster
I can help you too, just ask me. You can send me PM.
And ofc this one isn't very advanced because I just made it like it was requested.
 
On my server (Frozenhell) I made something like this except a "reflect" spell. So when a player is buffed it reflects damage back to the caster.

Nicely done, however. =D
 
Ye I also used a spell like you explained.
But with an item which reflects 5% of each attack to the player on my old server.
 
hmm,.. all the spell does for me is send out some text and a animations...
doesnt absorb anything, dont find those lines in your script either..
 
By adding a:
doAreaCombatHealth(ATTACKER, type, getThingPos(TARGET), 0, -(value*80/100), -(value*80/100), SOME_EFFECT_HERE)

So you make the player don't get any damage but add an extra dmg which equals 80%
 
I have one error on TFS log (when i try to login this error apear and i disconnect from server):
Code:
[13/06/2010 21:23:50] [Error - CreatureScript Interface] 
[13/06/2010 21:23:50] buffer:onLogin
[13/06/2010 21:23:50] Description: 
[13/06/2010 21:23:50] [string "loadBuffer"]:8: bad argument #1 to 'ipairs' (table expected, got nil)
[13/06/2010 21:23:50] stack traceback:
[13/06/2010 21:23:50] 	[C]: in function 'ipairs'
[13/06/2010 21:23:50] 	[string "loadBuffer"]:8: in function <[string "loadBuffer"]:3>
Can someone fix it??

P.S. I'm using TFS 0.3.6
 
Has nothing to do with my spell/mod.
 
i think it should take soul points to use the spell maybe add it to the config
 
Back
Top