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

[Action] Switch, Multiple Functions, Rep++

Rthom19

New Member
Joined
Mar 2, 2009
Messages
50
Reaction score
0
Location
Australia
Hey,
I need a script to do the following when you pull a lever,
- Set Looktype
- Set TownID
- Set Vocation
- Teleport To A Certain Place

Im not sure if you can put this many functions in one script?
Thats what i heard anyway..

If you cant put that many in this script can someone make an onStepIn script so when you step on a certain tile it does 2 of them things?

Thanks,
 
ok add this in the action.xml

Lua Code:
<action actionid="5000" event="script" value="advanced lever.lua"/>


the nuber beside action id you will add it to the lever
now add this in action-->scripts-->advanced lever.lua

Code:
local townid = 1       -- the id of the town(check it in your map editor 
local town = Enigma      -- Name of town

local vocation = 1       -- druid(2) ,sorcerer(1),knight(4),paladin(3)

local tppos = {x=xxxx,y=xxxx,z=x}   -- pos where player will be tped to
function onUse(cid, item, fromPosition, itemEx, toPosition)
         if isPlayer(cid) == TRUE then
            doCreatureChangeOutfit(cid, {lookType = math.random(2, 134), lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookTypeEx = 0, lookAddons = 0})
            doPlayerSetTown(cid, townid)
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Yor are now a citizen in "..town.." Town.")
	    doPlayerSetVocation(cid,vocation)
	    doTeleportThing(cid,tppos)
	 end
return TRUE
end

i didnt test
 
Last edited:
Lua:
local townid = 1       -- the id of the town(check it in your map editor 
local town = "Enigma"    -- Name of town

local vocation = 1       -- druid(2) ,sorcerer(1),knight(4),paladin(3)

local tppos = {x=xxxx,y=xxxx,z=x}   -- pos where player will be tped to
function onUse(cid, item, fromPosition, itemEx, toPosition)
         if isPlayer(cid) == TRUE then
            doCreatureChangeOutfit(cid, {lookType = math.random(2, 134), lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookTypeEx = 0, lookAddons = 0})
            doPlayerSetTown(cid, townid)
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Yor are now a citizen in "..town.." Town.")
	    doPlayerSetVocation(cid,vocation)
	    doTeleportThing(cid,tppos)
	 end
return TRUE
end
 
Btw, is this line even working?
doCreatureChangeOutfit(cid, {lookType = math.random(2, 134), lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookTypeEx = 0, lookAddons = 0})

Shouldn't it be:
doCreatureChangeOutfit(cid,math.random(2, 134), 0, 0, 0, 0, 0, 0})
?

Maybe I'm wrong
 
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local outfits = {
        [0] = {lookType = 138, lookHead = 114 , lookBody = 18, lookLegs = 94, lookFeet = 0, lookTypeEx = 0, lookAddons = 0},
	[1] = {lookType = 128, lookHead = 114 , lookBody = 18, lookLegs = 94, lookFeet = 0, lookTypeEx = 0, lookAddons = 0}
}
local goTo = {x=100, y=100, z=7}
local playerSex = getPlayerSex(cid)
local townId = 1
local vVoc = getPlayerVocation(cid)

	if(getPlayerVocation(cid) < 5) then
		doTeleportThing(cid, goTo)
		doSetCreatureOutfit(cid, outfits[playerSex], -1)
		doPlayerSetVocation(cid, vVoc + 4)
		doPlayerSetTown(cid, townId)
		end
	return TRUE
end
Not tested. Also it gives the player vocation +4, example if he is sorcerer then = Master sorcerer, and if his vocation is higher than 4, then this wont work.
Set action or uniqueId in actions.xml
 
Back
Top