TalkAction Second Promotion

Status
Not open for further replies.

JDB

OtLand Veteran
Joined
Jun 1, 2009
Messages
4,145
Best answers
2
Reaction score
109
I updated this script, I don't remember where I got it from.
I had updated it and tested to make sure it works properly.


Tested and works 100%

Config.lua:
Lua:
premiumForPromotion = "no"
Script:
Lua:
function onSay(cid, words, param, channel)
local cfg = { level = 100, vocs = { 5, 6, 7, 8 }, storage = 45231, cost = 100000, msgtype = MESSAGE_STATUS_CONSOLE_BLUE }
    if getPlayerStorageValue(cid, cfg.storage) == -1 then
        if getPlayerLevel(cid) >= cfg.level then
            if isInArray(cfg.vocs, getPlayerVocation(cid)) == true then
                if (getPlayerMoney(cid) >= cfg.cost) then
		    doPlayerRemoveMoney(cid, cfg.cost)
                    setPlayerPromotionLevel(cid, getPlayerPromotionLevel(cid) + 1)
                    doPlayerSendTextMessage(cid, cfg.msgtype, "You have been promoted to ".. getVocationInfo(getPlayerVocation(cid)).name ..".")
                    doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_GREEN)
                    setPlayerStorageValue(cid, cfg.storage, 1)
                else
                    doPlayerSendTextMessage(cid, cfg.msgtype, "You need ".. cfg.cost .." gold coins to purchase the second promotion.")
                end
            else
                doPlayerSendTextMessage(cid, cfg.msgtype, "Only players with first promotion may get the second promotion.")
            end
        else
            doPlayerSendTextMessage(cid, cfg.msgtype, "Only characters of level ".. cfg.level .." or above, may purchase the second promotion.")
        end
    else
        doPlayerSendTextMessage(cid, cfg.msgtype, "You have already purchased the second promotion.")
    end
    return true
end
 
Last edited:

Saj

Remember my name
Joined
Feb 26, 2008
Messages
2,127
Best answers
0
Reaction score
5
Works for me, good job!
 
OP
JDB

JDB

OtLand Veteran
Joined
Jun 1, 2009
Messages
4,145
Best answers
2
Reaction score
109
Thanks for all the comments, glad to release it :cool:
 
OP
JDB

JDB

OtLand Veteran
Joined
Jun 1, 2009
Messages
4,145
Best answers
2
Reaction score
109
PHP:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

function onCreatureAppear(cid)      npcHandler:onCreatureAppear(cid)      end
function onCreatureDisappear(cid)    npcHandler:onCreatureDisappear(cid)      end
function onCreatureSay(cid, type, msg)    npcHandler:onCreatureSay(cid, type, msg)    end
function onThink()        npcHandler:onThink()          end

local node1 = keywordHandler:addKeyword({'promot'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can promote you for 10000 gold coins. Do you want me to promote you?'})
  node1:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 10000, level = 20, promotion = 1, text = 'Congratulations! You are now promoted.'})
  node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true})

local node2 = keywordHandler:addKeyword({'epic'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can epicize you for 100000 gold coins. Do you want me to epicize you?'})
  node2:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 100000, level = 100, promotion = 2, text = 'Congratulations! You are now epicized.'})
  node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true})

npcHandler:addModule(FocusModule:new())
I don't really make NPCs...
 
OP
JDB

JDB

OtLand Veteran
Joined
Jun 1, 2009
Messages
4,145
Best answers
2
Reaction score
109
Thanks for comments :thumbup:
 
OP
JDB

JDB

OtLand Veteran
Joined
Jun 1, 2009
Messages
4,145
Best answers
2
Reaction score
109
Bump: :thumbup:
 

QuaS

Cykotitan Pwned =/
Joined
Sep 11, 2008
Messages
833
Best answers
0
Reaction score
26
Location
Poland/ Wroclaw
No. Again i am this one who is finding Bug. In TFS 0,3+ No longer works addvocation+4. If u log out then you will be again that u were before u type this promotion. To make it works you should use function to Add Player Promotion At level 2. ( 1 lvl = ms,ed, rp and ek.)
 

life4me

Don't dream it, be it.
Joined
Jun 27, 2009
Messages
928
Best answers
0
Reaction score
15
Location
Otland
:D :D :D Whats the point XD! Just go to npcs and say:
Player:Hi
Npcs:Hello player,blablablabla
Player:Buy promotion
Npcs:You are now promoted *****
 
OP
JDB

JDB

OtLand Veteran
Joined
Jun 1, 2009
Messages
4,145
Best answers
2
Reaction score
109
Fixed and Working.
Tested it myself.


Thanks Quas. :thumbup: Rep++
 
OP
JDB

JDB

OtLand Veteran
Joined
Jun 1, 2009
Messages
4,145
Best answers
2
Reaction score
109
Bump :thumbup:
 

LeOoX

New Member
Joined
Jul 20, 2008
Messages
329
Best answers
0
Reaction score
0
this is not working for me i added this into talkactions/scripts
than added line in talkactions.xml
<talkaction words="!slayer" event="script" value="slayervoc.lua"/>

nothing happens.. :( been trying for hours to get it to work I got evolution 8.5
 

LeOoX

New Member
Joined
Jul 20, 2008
Messages
329
Best answers
0
Reaction score
0
edit i took the npc promotion in the thread it works when saying epic but that will only change your promotion id to 2 and then somehow your voc gets changed automaticly to 0 not to 9 or 10 or 11 or 12 the slayer vocs.
When I tried give manually voc 10 (slayer sorcerer) to a guy in my server it said something about cannot find voc 46594859376 many numbers.
And server got real laggy and i had to restart.
please help
 
OP
JDB

JDB

OtLand Veteran
Joined
Jun 1, 2009
Messages
4,145
Best answers
2
Reaction score
109
It works on 0.3.4
 
Status
Not open for further replies.
Top