Hello,
First thanks for looking in my Thread
I need help with my first script.
I use [8.4] The Forgotten Server v0.3 beta 3
I try to make an avatar talkaction script.
It should be for Knights and Elite Knights.
Thats like an spell that make the Knight stronger ... that means :
- subtract 500 mana from player
- change vocation(that he/she will have more attackspeed ect.)
- add health limit
- add mana limit
- add skills
(That all should take 20 sec ... then back to the old Statistics)
What work :
- subtract 500 mana from player
- change vocation
What doesn't work :
- add health
- add mana
- add skills
- Time Limit of 20 sec /// Vocation id should go back to 4/8 after 20 sec ...
Some function i saw in other scripts like this :
So i dont't know where are the mistakes >.<*
Here is the script:
Thanks for any help
And sorry for my bad english (?)
First thanks for looking in my Thread
I need help with my first script.
I use [8.4] The Forgotten Server v0.3 beta 3
I try to make an avatar talkaction script.
It should be for Knights and Elite Knights.
Thats like an spell that make the Knight stronger ... that means :
- subtract 500 mana from player
- change vocation(that he/she will have more attackspeed ect.)
- add health limit
- add mana limit
- add skills
(That all should take 20 sec ... then back to the old Statistics)
What work :
- subtract 500 mana from player
- change vocation
What doesn't work :
- add health
- add mana
- add skills
- Time Limit of 20 sec /// Vocation id should go back to 4/8 after 20 sec ...
Some function i saw in other scripts like this :
Code:
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.
So i dont't know where are the mistakes >.<*
Here is the script:
Code:
--Configure ON--
local fvoc = 12 --this is voc after upgrade
local svoc = 4, 8 --this is vocation before upgrade
local spellmana = 500 -- this is how much mana you need to have to cast the spell
local spelltime = 20000 -- 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)
local health = 100 -- this is how much health you will get with avatar
local mana = 50 -- this is how much mana you will get with avatar
local skillid = 0, 1, 2, 3, 5 -- this is how much your skill have to rise
local n = 30
--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)
doCreatureAddHealth(cid, health)
doPlayerAddMana(cid, mana)
doPlayerAddSkillTry(cid, skillid, n)
end
end
function onSay(cid, words, param, frompos)
if (getPlayerVocation(cid) == svoc) 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,fvoc) -- this is the vocation of an avatar 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
end
if (getPlayerVocation(cid) == fvoc) then -- if the player has alrdy casted this spell, his vocation will be 12.
doPlayerSendCancel(cid,"Wait for this spell to wear off before casting it again.") -- if the vocation is 12, it will send this message
doSendMagicEffect(getPlayerPosition(cid), 2)
else
doSendMagicEffect(getPlayerPosition(cid),2)
doPlayerSendCancel(cid,"Only elite knights may use this spell.") -- incase sorcerers and druids and knights use this spell, they will get this message.
end
return words
end
Thanks for any help
And sorry for my bad english (?)