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

*EDIT* New idea of getting vocation.

Synergy

New Member
Joined
Nov 24, 2011
Messages
334
Reaction score
0
Hello!


I edited this from NPC vocation giver to a new idea I had.


Is it possible to create a script which gives you alternatives at level 8,

A message pops up saying:
"Congratulations! You are now level 8 and ready to choose your first vocation!"Choose between:
1. Wizard
2. Priest
3. Archer
4. Warrior
5. etc..




Then somehow the player says wizard or !wizard or anything like that.

And you get the vocation?
 
Last edited:
Oh god, no lifer.
Second time you post the same thing, what a boring douche.

/

BTW, moderators, isn't this request section?
From what I see this is a section where members flame you for requesting?
 
Oh god, no lifer.
Second time you post the same thing, what a boring douche.

/

BTW, moderators, isn't this request section?
From what I see this is a section where members flame you for requesting?

Well, gee I dunno maybe you should try sticking to the single thread you created instead of making several, hurrrr.
 
Well as you see this is another Idea, and I just became premium user and just found out that I can edit the titles etc.

Please stop being so negative, it's still a request, I'm learning to script right now but I need samples to work with along the way.
 
Register talkaction. Words "!wizard"

and then smth like:
LUA:
function onSay(cid, words, param)
	if getPlayerVocation(cid) ~= PRIEST_VOCATIONID then
		doPlayerSetVocation(cid, PRIEST_VOCATIONID)
		return true
	end
	return false
end
 
Register talkaction. Words "!wizard"

and then smth like:
LUA:
function onSay(cid, words, param)
	if getPlayerVocation(cid) ~= PRIEST_VOCATIONID then
		doPlayerSetVocation(cid, PRIEST_VOCATIONID)
		return true
	end
	return false
end

Cool! So it's possible, I'll try it out right away

But.. When you reach 8, I want it to pop up "Congratulations, you are now ready to choose your first vocation!"

That's possible through global events right?
 
onAdvance(cid, level, skill)
if level == 8 and skill == SKILL_LEVEL then -- dunno if correct
 
Jay, asking for every single script you want wont teach anything...
You have at least to try to make something, then if it is impossible for you ask here...

Anyway, I'm not going to help you making the script, but if that is what you want...
Here it goes:
data/creaturescripts/scripts .. create a file named lvl8.lua and add this:
LUA:
function onAdvance(cid, skill, oldlevel, newlevel)
          
                if(skill == SKILL__LEVEL and newlevel >= 8 and getPlayerVocation(cid) == 0) then
                                doPlayerSendTextMessage(cid, 22, "Congratulations! You are now level 8 and ready to choose your first vocation! Choose between: \n 1 - Wizard. \n 2 - Priest. \n 3 - Archer. \n 4 - Warrior. \n Use the command !VocationName to choose your vocation. For example: !Wizard")
                else
                                doPlayerSendTextMessage(cid, 22, "You haven\'t reached level 8 yet or you have already choose your vocation.")
                                end
                return TRUE
end
now go to creaturescripts.xml and add this:
LUA:
<event type="advance" name="lvl8" event="script" value="lvl.lua"/>
now go to login.lua and add this:
LUA:
registerCreatureEvent(cid, "lvl8")

----
go to data/talkactions/scripts create a wizard.lua file an archer.lua file and so on, and place this inside each one:
WIZARD
LUA:
local pos = {x = x, y = y, z = z}
local id = a
function onSay(cid, words, param)
	if getPlayerVocation(cid) == 0 then
        if getPlayerLevel(cid) >= 8 then
		doPlayerSetVocation(cid, 1)
                doTeleportThing(cid, pos)
                doPlayerSetTown(cid, id)
       else
                doPlayerSendCancel(cid, "You have already choose your vocation.") 
	end
      else
                doPlayerSendCancel(cid, "You haven\'t reached lvl 8 yet.") 
	end
	return TRUE
end
PRIEST
LUA:
local pos = {x = x, y = y, z = z}
local id = a
function onSay(cid, words, param)
	if getPlayerVocation(cid) == 0 then
        if getPlayerLevel(cid) >= 8 then
		doPlayerSetVocation(cid, 2)
                doTeleportThing(cid, pos)
                doPlayerSetTown(cid, id)
       else
                doPlayerSendCancel(cid, "You have already choose your vocation.") 
	end
      else
                doPlayerSendCancel(cid, "You haven\'t reached lvl 8 yet.") 
	end
	return TRUE
end
ARCHER
LUA:
local pos = {x = x, y = y, z = z}
local id = a
function onSay(cid, words, param)
	if getPlayerVocation(cid) == 0 then
        if getPlayerLevel(cid) >= 8 then
		doPlayerSetVocation(cid, 3)
                doTeleportThing(cid, pos)
                doPlayerSetTown(cid, id)
       else
                doPlayerSendCancel(cid, "You have already choose your vocation.") 
	end
      else
                doPlayerSendCancel(cid, "You haven\'t reached lvl 8 yet.") 
	end
	return TRUE
end
WARRIOR
LUA:
local pos = {x = x, y = y, z = z}
local id = a
function onSay(cid, words, param)
	if getPlayerVocation(cid) == 0 then
        if getPlayerLevel(cid) >= 8 then
		doPlayerSetVocation(cid, 4)
                doTeleportThing(cid, pos)
                doPlayerSetTown(cid, id)
       else
                doPlayerSendCancel(cid, "You have already choose your vocation.") 
	end
      else
                doPlayerSendCancel(cid, "You haven\'t reached lvl 8 yet.") 
	end
	return TRUE
end

now, on:
LUA:
local pos = {x = x, y = y, z = z}
put the temple coordantes like
LUA:
local pos = {x = 700, y = 545, z = 7}

and on:
LUA:
local id = a
change the "a" to the id of the city the player should be teleported...

now go to talkactions.xml and add this:
LUA:
<talkaction words="!wizard; !Wizard" script="wizard.lua" />
<talkaction words="!archer; !Archer" script="archer.lua" />
<talkaction words="!priest; !Priest" script="priest.lua" />
<talkaction words="!warrior; !Warrior" script="warrior.lua" />


There you go...
But honestly speaking, you shouldn't host an OT yet, you should learn a bit more first.. those scripts took me 5 minutes to make, they are really easy to do...
If you have no clue about scripting (and it seem that you don't), you are gonna have a bad time hosting an OT...
Just my 2 cents...
 
Wow.. thanks so much!


Yes I won't host my ot before I'm fully ready for it.
I just want to make stuff on it and explore for the moment.

I'm learning scripting right now + mapping so I promise improving alot in the future.
 
Goto data/creaturescripts.xml and add this line:
LUA:
<event type="advance" name="LeveLVoc" event="script" value="lvlvoc.lua"/>

Then goto data/creaturescripts/scripts and create new lua and name it: lvlvoc.lua

and add this script into the lua:
LUA:
--Remember change all storages require change on the command storages too!
--Adding new vocs, you need to add new lines otswe_storage = 1005, if isInArray({9, 10} and otswe.otswe_storage

local otswe = {
    level = 8, -- Which level they are able to use this script!
    storage = 1000, -- This storage is when you reach the level and using the command!
    wizard_storage = 1001, -- This storage is for Wizard voc command!
    priest_storage = 1002, -- This storage is for Priest voc command!
    archer_storage = 1003, -- This storage is for Archer voc command!
    warrior_storage = 1004 -- This storage is for Warrior voc command!    
}
function onAdvance(cid, skill, oldlevel, newlevel)
if getPlayerStorageValue(cid, otswe.storage, 0) and skill == SKILL__LEVEL and newlevel >= otswe.level then
		if isInArray({1, 5}, getPlayerVocation(cid)) then
			setPlayerStorageValue(cid, otswe.wizard_storage, 1)
		end
		if isInArray({2, 6}, getPlayerVocation(cid)) then
			setPlayerStorageValue(cid, otswe.priest_storage, 1)
		end
		if isInArray({3, 7}, getPlayerVocation(cid)) then
			setPlayerStorageValue(cid, otswe.archer_storage, 1)
		end
		if isInArray({4, 8}, getPlayerVocation(cid)) then
			setPlayerStorageValue(cid, otswe.warrior_storage, 1)
		end
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations! You are now level 8 and ready to choose your first vocation! Use command: !voc")
		setPlayerStorageValue(cid, storage, 1)
	end
 return true
end

And now goto login.lua and add this line:
LUA:
registerCreatureEvent(cid, "LeveLVoc")

Now goto data/talkactions.xml and add this line:
LUA:
<talkaction words="!wizard;!priest;!archer;!warrior" script="voc.lua" />

Then goto data/talkactions/scripts and make new lua name it: voc.lua
LUA:
local otswe = {
      storage = 1000, -- This storage is when you reach the level and using the command!
      wizard_storage = 1001, -- This storage is for Wizard voc command!
      priest_storage = 1002, -- This storage is for Priest voc command!
      archer_storage = 1003, -- This storage is for Archer voc command!
      warrior_storage = 1004, -- This storage is for Warrior voc command!
      wizard_vocid = 9,
      priest_vocid = 10,
      archer_vocid = 11,
      warrior_vocid = 12       
}
function onSay(cid, words, param, channel)
if not isPlayer(cid) then return true end
if getPlayerStorageValue(cid,otswe.storage) == 1 then
   if getPlayerStorageValue(cid,otswe.wizard_storage) == 1 then
      doPlayerSetVocation(cid, otswe.wizard_vocid)
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Congratulations! You are now a Wizard.")
   elseif getPlayerStorageValue(cid,otswe.priest_storage) == 1 then
      doPlayerSetVocation(cid, otswe.priest_vocid)
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Congratulations! You are now a Priest.") 
   elseif getPlayerStorageValue(cid,otswe.archer_storage) == 1 then
      doPlayerSetVocation(cid, otswe.archer_vocid)
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Congratulations! You are now a Archer.") 
   elseif getPlayerStorageValue(cid,otswe.warrior_storage) == 1 then
      doPlayerSetVocation(cid, otswe.warrior_vocid)
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Congratulations! You are now a Warrior.") 
      else
      doPlayerSendCancel(cid, "You're not ready yet.")
      end
    return true
  end
end

I havent tested so please msg me here if there smth wrong!

Enjoy!
 
Back
Top