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

TalkAction raising a vocations attack speed temporarily

taght

New Member
Joined
Jul 2, 2007
Messages
57
Reaction score
2
You can probably use "spells" and it will work better but i wasnt thinking when i made this for my server.


from data\talkactions\scripts\pallyUpgrade.lua

in pallyUpgrade.lua
Code:
function m(cid)                              			-- addEvent makes this function begin within the set ammount of time.
	if getPlayerVocation(cid) == 10 then			-- this will make the spell wear off.
		doPlayerSetVocation(cid,7)                      -- 7 should be set to the vocation of the player before casting the spell
		doSendMagicEffect(getPlayerPosition(cid),13)
	end
end




function onSay(cid, words, param, frompos)


	if (getPlayerVocation(cid) == 7) then		      -- if the player is a royal paladin (in vocations I have RP set as #7)
		playermana = getPlayerMana(cid)               -- checks the players mana
		manaReq = 1000              		      -- this is how much mana you need to have to cast the spell

		  -- this makes sure u arent exhausted
			if (playermana >= manaReq) then       	     -- if they have more then 1000 mana (defined above as "manaReq")
				doPlayerAddMana(cid,-1000)           -- this will remove 1000 mana from the player
				doPlayerSetVocation(cid,10)          -- this is the vocation of a royal paladin aswell, but this one has a faster attack speed in vocations.xml
				doSendMagicEffect(getPlayerPosition(cid),13)
				addEvent(m,22000,cid)       	     -- this will activate the function at the top of the script ( function m(cid) ) but it wont start for 22 seconds (40000 would be 40 seconds)
		

			else
			doPlayerSendCancel(cid,"You do not have enough mana.")  -- it gives this msg if the player doesnt have more then the manaReq   (1000 as above)
			doSendMagicEffect(getPlayerPosition(cid), 2)
			end






	elseif (getPlayerVocation(cid) == 10) then   						    -- if the player has alrdy casted this spell, his vocation will be 10.  
		doPlayerSendCancel(cid,"Wait for this spell to wear off before casting it again.")  -- if the vocation is 10, it will send this message
		doSendMagicEffect(getPlayerPosition(cid), 2)
	else
		doSendMagicEffect(getPlayerPosition(cid),2)
		doPlayerSendCancel(cid,"Only paladins may use this spell.")		            -- incase sorcerers and druids and knights use this spell, they will get this message.
	end

	return words
end

in data\vocations.xml

above "</vocations>"
add
Code:
<vocation id="10" name="Royal Paladin" description="a royal paladin" gaincap="20" gainhp="10" gainmana="15" gainhpticks="3" gainhpamount="30" gainmanaticks="3" gainmanaamount="30" gainsoulticks="15" gainsoulamount="1" maxsoul="200" manamultiplier="1.4" attackspeed="750" prevoc="3" basespeed="220">
	<diepercent experience="7" magic="7" skill="7" equipment="20" container="100"/>
	<formula damage="1.3" defense="1.1" armor="1.1"/>
	<skill id="0" multiplier="1.2"/>
	<skill id="1" multiplier="1.2"/>
	<skill id="2" multiplier="1.2"/>
	<skill id="3" multiplier="1.2"/>
	<skill id="4" multiplier="1.1"/>
	<skill id="5" multiplier="1.1"/>
	<skill id="6" multiplier="1.1"/>
</vocation>
that is the vocation the character will become upon casting the spell.
if you make it have faster attack speed and the same name, it will seem as if only the attack speed changed.


in data\talkactions\talkactions.xml
above "</talkactions>"

Code:
<talkaction words="spellname" script="pallyUpgrade.lua" />
<talkaction words="Spellname" script="pallyUpgrade.lua" />
<talkaction words="SpellName" script="pallyUpgrade.lua" />
<talkaction words="SPELLNAME" script="pallyUpgrade.lua" />

spellname can be made whatever you'd like




the spell works for royal paladins only - i tried to make it easy enough so a beginer can edit it.
 
Last edited by a moderator:
COuld u explain it a bit more for the newbies under us? Like where can u change the speed how long will it last how mutch mana magic lvl needed etc etc
 
Do you need a script for when the player logs out so he doesn't keep that attack speed. If so just check if the player is that voc when they log and change it back
 
Do you need a script for when the player logs out so he doesn't keep that attack speed. If so just check if the player is that voc when they log and change it back

to my knowlegde it works like mine "FOntain Of Regain" if you log out it will stop counting down, when i log in it will finish the count untail it's set 0 again"
 
http://******.net/showthread.php?t=78451
Umby's script. Just look at some of the last posts. For TFS someone has done a login function.
Code:
function onLogin(cid)
if getPlayerVocation(cid) == 10 then
doSetPlayerVocation(cid, 7)
end
end
It looked something like this.
Credits to other guy that I can't get the name because site is down.
 
Nevermind got this working. Great script!
 
Last edited:
It is a good script, but if player log-out, your vocation is 10 4ever.

Make a debug script on creaturescripts > logout.lua

Sorry for my english, i'm brazilian.
 
It is a good script, but if player log-out, your vocation is 10 4ever.

Make a debug script on creaturescripts > logout.lua

Sorry for my english, i'm brazilian.

If your using TFS SQL this works 100%, but if you use some sort of XML server like evolution that bug will occure i believe.
 
I'll made it with locals :)
Code:
--Configure ON--
local fvoc = 7				 --this is vocation before upgrade
local svoc = 10				 --this is voc after upgrade
local spellmana = 1000		 -- this is how much mana you need to have to cast the spell
local spelltime = 10000		 -- this will activate the function at the top of the script ( function m(cid) ) but it wont start for 22 seconds (40000 would be 40 seconds)
--Configure OFF--

function m(cid) -- addEvent makes this function begin within the set ammount of time.
	if getPlayerVocation(cid) == svoc then -- this will make the spell wear off.
		doPlayerSetVocation(cid,fvoc)
		doSendMagicEffect(getPlayerPosition(cid),11)
	end
end


function onSay(cid, words, param, frompos)
	if (getPlayerVocation(cid) == fvoc) then
		playermana = getPlayerMana(cid) -- checks the players mana

		  -- this makes sure u arent exhausted
			if (playermana >= spellmana) then -- if they have more then -spellmana- mana
				doPlayerAddMana(cid,-spellmana)
				doPlayerSetVocation(cid,svoc) -- this is the vocation of a royal paladin aswell, but this one has a faster attack speed in vocations.xml
				doSendMagicEffect(getPlayerPosition(cid),12)
				addEvent(m,spelltime,cid)
		

			else
			doPlayerSendCancel(cid,"You do not have enough mana.")  -- it gives this msg if the player doesnt have more then the manaReq
			doSendMagicEffect(getPlayerPosition(cid), 2)
			end






	elseif (getPlayerVocation(cid) == svoc) then -- if the player has alrdy casted this spell, his vocation will be 10.  
		doPlayerSendCancel(cid,"Wait for this spell to wear off before casting it again.") -- if the vocation is 10, it will send this message
		doSendMagicEffect(getPlayerPosition(cid), 2)
	else
		doSendMagicEffect(getPlayerPosition(cid),2)
		doPlayerSendCancel(cid,"Only paladins may use this spell.") -- incase sorcerers and druids and knights use this spell, they will get this message.
	end

	return words
end
have fun
@down: i know, but i forgot edit ;p
 
Last edited:
Why so many spaces, and unnecessary variables?! Also some wrong tabbing :p
PHP:
local fvoc = 7 --this is vocation before upgrade
local svoc = 9 --this is voc after upgrade
local manaReq = 1000 -- this is how much mana you need to have to cast the spell
local spelltime = 10000 -- this will activate the function at the top of the script ( function m(cid) ) but it wont start for 22 seconds (40000 would be 40 seconds)

function m(cid) -- addEvent makes this function begin within the set ammount of time.
	if getPlayerVocation(cid) == svoc then-- this will make the spell wear off.
		doPlayerSetVocation(cid,fvoc)
		doSendMagicEffect(getPlayerPosition(cid),13)
	end
end

function onSay(cid, words, param, frompos)
	if (getPlayerVocation(cid) == fvoc) then
		 -- this makes sure u arent exhausted
		if (playermana >= manaReq) then -- if they have more then -manaReq- mana
			doPlayerAddMana(cid,-getPlayerMana(cid))
			doPlayerSetVocation(cid,svoc) -- this is the vocation of a royal paladin aswell, but this one has a faster attack speed in vocations.xml
			doSendMagicEffect(getPlayerPosition(cid),13)
			addEvent(m,spelltime,cid)
		else
			doPlayerSendCancel(cid,"You do not have enough mana.") -- it gives this msg if the player doesnt have more then the manaReq
			doSendMagicEffect(getPlayerPosition(cid), 2)
		end
	elseif (getPlayerVocation(cid) == svoc) then 						 -- if the player has alrdy casted this spell, his vocation will be 10. 
		doPlayerSendCancel(cid,"Wait for this spell to wear off before casting it again.") -- if the vocation is 10, it will send this message
		doSendMagicEffect(getPlayerPosition(cid), 2)
	else
		doSendMagicEffect(getPlayerPosition(cid),2)
		doPlayerSendCancel(cid,"Only paladins may use this spell.")-- incase sorcerers and druids and knights use this spell, they will get this message.
	end
	return words
end
 
Back
Top