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

Spell [0.3+] Waste all your mana AT ANY TIME (for mana training!).

Guitar Freak

_LüA_n☺b_
Joined
Dec 27, 2008
Messages
831
Reaction score
13
Location
Caracas, Venezuela
Well, I just saw a thread by a person requesting this spell, and I havent seen threads here with things like a spell that you use that wastes all your mana at any time, to mana train whenever the player feels like, and not only when the mana is a certain amount (or full) like most servers's manawaste spells.

So, as Im learning lua and Im still not too great at it, I decided Id give it a shot to see if I could make it or something similar.

I ended up on the "similar" :)

This means that what I made is a simulation of the spell, it isnt really a spell spell I think, but it works exactly like one and the "mana waste" part works perfectly.

In spells.xml add this:

Lua:
<instant name="Mana Waste" words="manawaste" lvl="1" mana="0" aggressive="0" selftarget="1" exhaustion="1000" needlearn="0" event="script" value="manawaste.lua"/>

Now into scripts make manawaste.lua and add this:

Lua:
--[[

	* Alternative "Mana Waste" Spell *
	
	Author:		Guitar Freak.
	Optimizations:	Evil Hero, Hermes.
	
]]--

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)

function onCastSpell(cid, var)
	local playerMana = getPlayerMana(cid)
	local inFight = hasCondition(cid, CONDITION_INFIGHT)
	
	if playerMana > 0 then
		doPlayerAddSpentMana(cid, playerMana)
		doCreatureAddMana(cid, -playerMana)
		doCombat(cid, combat, var)  
		if not inFight then
			doRemoveCondition(cid, CONDITION_INFIGHT)
		end
	else
		doPlayerSendCancel(cid, "You dont have any mana.")
		doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
	end
end

It might be a bit silly. but is one of the first scripts I make from scratch (the other ones are even sillier :p).

Compatibility: Tested + working on TFS 0.3+

Have fun.
 
Last edited:
use;
PHP:
manapercent="100"

???

Thats what I didnt know :thumbup:

But still, remember that by using:

PHP:
manapercent="100"

You can only use the spell when you have 100% mana, while in my "spell" you can use it at any time and it will always consume 100% of the player's current mana, so he doesnt need to have all his mana full to mana train, but just do it at any moment.

Id say its a bit more realistic this way but it still has the flaws I mentioned in the script which I dont think can be fixed.

Thanks anyways for the input. I still had fun making the lil script :p

Cheers.
 
Really cool spell:D

Ty :thumbup:

Updated first post for correcting some tags and fixing one of the flaws.

If anyone knows how to fix the other one (the 1st one), feel free to tell us, Ill +Rep if you do. Its a never-ending learning process after all ;)

Or if you find another flaw, etc.

Cheers.
 
Sorry for being off-topic, but is there a way to change;

doCreatureAddMana(cid, - playermana)

To something like

doCreatureAddMana(cid, - playermana + 1)

So that they have one mana left? And preferably going straight to 1, and not 0, then adding 1, because I'd like to do it for a script for health, and going right to 0 would kill them :p
 
Thanks,
although, manapercent"=100" would work.

Nice script.
 
Thanks,
although, manapercent"=100" would work.

Nice script.

Yep, but as I said on the first post of the thread, using manapercent="100" will only let you do the spell when you have 100% mana (full mana), with this "spell" you can do it at any time and it will always spend 100% of the current mana the player has, so the player can manatrain at any time instead of having to wait for mana to be full :thumbup:

Cheers!
 
Bumpek~

Edited 1st post to add the (FIXED) part on the 2nd flaw, because someone didnt see it at the end of it and sent me an email about it but it was already fixed lol.

Still cant fix 1st flaw, waiting for someone who can (or knows if its just not possible) ;)
 
Sorry for being off-topic, but is there a way to change;

doCreatureAddMana(cid, - playermana)

To something like

doCreatureAddMana(cid, - playermana + 1)

So that they have one mana left? And preferably going straight to 1, and not 0, then adding 1, because I'd like to do it for a script for health, and going right to 0 would kill them :p

try something like....

doCreatureAddMana(cid, -(getCreatureMana - 1))

or in your case,
doCreatureAddHealth(cid, -(getCreatureHealth - 1))

should work.
 
try something like....

doCreatureAddMana(cid, -(getCreatureMana - 1))

or in your case,
doCreatureAddHealth(cid, -(getCreatureHealth - 1))

should work.

Yep, works perfectly thanks :thumbup: +Repped ya

Here it is with your idea implemented:

Lua:
-- Ideas by Grehy and fix by Jerryb1988 from OTland.

local combat = createCombatObject()
-- Put what your spell does here, hits, etc. just like a normal spell. Right now it only does the HP thing.

function onCastSpell(cid, var)

	local playerhealth = getCreatureHealth(cid)			-- Checks player health.
	local position = getPlayerPosition(cid)				-- Checks player position.
	
	if playerhealth >= 2 then					-- Checks if player has at least 2 HP or more (set this amount to anything you wish). If he does:
		doSendMagicEffect(position, 0)				-- First sends the magic effect.
		doCreatureAddHealth(cid, -(playerhealth - 1))		-- Then it sets the player's HP down to 1, regardless the amount he had.
	else								-- Otherwise,
		doPlayerSendCancel(cid, "You need at least 2 HP to use this spell.")	-- If he has less than 2 HP it sends this cancel message and does nothing.
	return doCombat(cid, combat, var)		
	end
end

As it says on the script, this one only does the HP thing, doesnt make any attacks or anything, that depends on what you need, etc. Just like a normal spell.

Also remember to set it to:

PHP:
aggressive="1"

In spells.xml, or otherwise it will be usable in PZ.

Cheers.
 
I'm not sure if its just me but I would perfer to put
Lua:
if playerhealth > 1 then
makes no difference but as i see it in my head, it only has to check "is player health > 1" instead of checking "is player health > 2 OR is player health = 2". I'm not sure but I would *think* it would be increased execution speed with just > 1... maybe .1 milisecond?
 
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0) change that
 
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0) change that

You mean remove the setCombatParam? Or both? Or change what to what?

I tried removing the setCombatParam line, and both, but the 1st flaw is still there.. be a bit more explicit please :)

And thanks anyways :thumbup:
 
i recomend
spells.xml
PHP:
<instant name="Mana" words="waste" lvl="100" manapercent="100" aggressive="0" selftarget="1" exhaustion="1000" needlearn="0" event="script" value="mana.lua"/>

mana.lua
PHP:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_ASSASSIN)
setCombatFormula(combat, COMBAT_FORMULA_SKILL, 0, -0, 0.0, -0)

local area = createCombatArea(AREA_SQUARE1X1)
setCombatArea(combat, area)

function onCastSpell(cid, var)
	return doCombat(cid, combat, var)
end
 
Back
Top