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

Xikini's Free Scripting Service. [0.3.7 & (0.3.6/0.4)]

Status
Not open for further replies.

Xikini

I whore myself out for likes
Senator
Joined
Nov 17, 2010
Messages
6,832
Solutions
586
Reaction score
5,414
Doing quick (30 min or less) scripts for [0.3.7 & (0.3.6/0.4)]
I am not here to fix your broken scripts, although I will give advice if requested.
I am here for script requests of scripts not already available on the forum.
If you require support for your scripting issues please make a thread in the support section.

For clarity's sake,
I will script actionscripts, creaturescripts, globalevents, talkactions, movements, npcs for you.
I will not script spells, weapons, raids or monster scripts.
Additionally, source editing, websites and database queries are a no go as well.

Code:
How to make shorter links to posts.
https://otland.net/threads/234306/page-14#post-2330703
 
Last edited:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_ASSASSIN)
--setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_NONE)
setAttackFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 2, 2, 2.4, 4.1)

local condition = createConditionObject(CONDITION_PARALYZE)
setConditionParam(condition, CONDITION_PARAM_TICKS, 500)
setConditionFormula(condition, -0.95, 0, -0.95, 0)
setCombatCondition(combat, condition)

local e = {}

local function delayedTeleport(cid, position)
if isPlayer(cid) then
end
e[cid] = nil
end

function onCastSpell(cid, var)
if exhaustion.check(cid, 23001) == false and e[cid] == nil then
exhaustion.set(cid, 23001, 5)
local p = getThingPos(cid)
addEvent(delayedTeleport, 500, cid, p)
e[cid] = true
doSendMagicEffect(p, CONST_ME_POFF)
doTeleportThing(cid, getThingPos(variantToNumber(var)))
return doCombat(cid, combat, var)
else
doPlayerSendCancel(cid, "You are exhausted.")
end
end





Can you make this for players of rebirth 50 , storage id is 85987 and make it based on player level..
 
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_ASSASSIN)
--setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_NONE)
setAttackFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 2, 2, 2.4, 4.1)

local condition = createConditionObject(CONDITION_PARALYZE)
setConditionParam(condition, CONDITION_PARAM_TICKS, 500)
setConditionFormula(condition, -0.95, 0, -0.95, 0)
setCombatCondition(combat, condition)

local e = {}

local function delayedTeleport(cid, position)
if isPlayer(cid) then
end
e[cid] = nil
end

function onCastSpell(cid, var)
if exhaustion.check(cid, 23001) == false and e[cid] == nil then
exhaustion.set(cid, 23001, 5)
local p = getThingPos(cid)
addEvent(delayedTeleport, 500, cid, p)
e[cid] = true
doSendMagicEffect(p, CONST_ME_POFF)
doTeleportThing(cid, getThingPos(variantToNumber(var)))
return doCombat(cid, combat, var)
else
doPlayerSendCancel(cid, "You are exhausted.")
end
end





Can you make this for players of rebirth 50 , storage id is 85987 and make it based on player level..
Thanks for your interest in my thread!
I would like to ask you to read my first post.
Thanks.
 
Hello could you script me a statue that gives vocation id 1 (sorcerer),2 (druid),3 (paladin),4 (knight) vocation id 9(warlock)? item id 8232 (Warlock Changer) costs 1 crystal coin to use it and can not change to other vocations and action id 4012
P.S I looked at most of the scripts but it would not work or it would bug and crash server :s
 
Hello could you script me a statue that gives vocation id 1 (sorcerer),2 (druid),3 (paladin),4 (knight) vocation id 9(warlock)? item id 8232 (Warlock Changer) costs 1 crystal coin to use it and can not change to other vocations and action id 4012
P.S I looked at most of the scripts but it would not work or it would bug and crash server :s
Code:
-- <action actionid="45001" event="script" value="vocation_change_warlock.lua"/>

function onUse(cid, item, fromPosition, itemEx, toPosition)
     
     if getPlayerVocation(cid) == 9 then
         doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
         doCreatureSay(cid, "You are already a Warlock!", TALKTYPE_ORANGE_1, cid)
         return true
     end
     
     if getPlayerVocation(cid) > 0 and getPlayerVocation(cid) < 5 and getPlayerMoney(cid) >= 10000 then
         doPlayerRemoveMoney(cid, 10000)
         local experience = {}
         local thing = (getPlayerExperience(cid))
         table.insert(experience, thing)
         doPlayerAddExperience(cid, -experience[1])
         doPlayerSetVocation(cid, 9)
         doPlayerAddExperience(cid, experience[1])
         doCreatureSay(cid, "Vocation changed! You are now a ".. getPlayerVocationName(cid) .."!", TALKTYPE_ORANGE_1, cid)
         doSendMagicEffect(getThingPos(cid), 27)
     else
         doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
         doCreatureSay(cid, "Promoted vocations cannot change vocation.", TALKTYPE_ORANGE_1, cid)
     end
     
     return true
end
 
Last edited:
Do you have scripts to get all 5 items in a quest?

Thank you for the script :D
 
Last edited by a moderator:
Btw
function onUse(cid, item, fromPosition, itemEx, toPosition)

if getPlayerVocation(cid) ~= 1,2,3,4 and getPlayerMoney(cid) >= 10000 then
doPlayerRemoveMoney(cid, 10000)
local experience = {}
local thing = (getPlayerExperience(cid))
table.insert(experience, thing)
doPlayerAddExperience(cid, -experience[1])
doPlayerSetVocation(cid, 9)
doPlayerAddExperience(cid, experience[1])
doCreatureSay(cid, "Vocation changed! You are now a ".. getPlayerVocationName(cid) .."!", TALKTYPE_ORANGE_1, cid)
doSendMagicEffect(getThingPos(cid), 27)
end

return true
end

I tried to put if player vocation is 1,2,3,4 but it had errors
 
Btw
function onUse(cid, item, fromPosition, itemEx, toPosition)

if getPlayerVocation(cid) ~= 1,2,3,4 and getPlayerMoney(cid) >= 10000 then
doPlayerRemoveMoney(cid, 10000)
local experience = {}
local thing = (getPlayerExperience(cid))
table.insert(experience, thing)
doPlayerAddExperience(cid, -experience[1])
doPlayerSetVocation(cid, 9)
doPlayerAddExperience(cid, experience[1])
doCreatureSay(cid, "Vocation changed! You are now a ".. getPlayerVocationName(cid) .."!", TALKTYPE_ORANGE_1, cid)
doSendMagicEffect(getThingPos(cid), 27)
end

return true
end

I tried to put if player vocation is 1,2,3,4 but it had errors
Check above, I edited script already.
 
What do you mean?
Like use a chest and get item id 2487,2488,2491,2195,2159 in the chest with using only 1 lua instead of 4 different lua's

Thank you!! Your the best scripter ever!! and fastest I like your services :D

For that vocation lua everytime a player relogs they turn back to their regular vocation they dont keep it how do i fix that?
Or do i have to go to mysql and add a query to keep the change?
 
Last edited by a moderator:
Like use a chest and get item id 2487,2488,2491,2195,2159 in the chest with using only 1 lua instead of 4 different lua's
Code:
-- <action actionid="45001" event="script" value="receive_multiple_items_chest.lua"/>

local storage = 45001

local items = {
   [1] = {item_id = 2487, item_count = 1},
   [2] = {item_id = 2488, item_count = 1},
   [3] = {item_id = 2491, item_count = 1},
   [4] = {item_id = 2195, item_count = 1},
   [5] = {item_id = 2159, item_count = 1}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
     
   if getPlayerStorageValue(cid, storage) == 1 then
     doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
     doPlayerSendCancel(cid, "It is empty.")
     return true
   end
   
   if getAllItemWeight(weight) > getPlayerFreeCap(cid) then
     doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
     doPlayerSendCancel(cid, "You require ".. string.format("%.2f", getAllItemWeight(weight)) .." capacity to obtain this reward.")
     return true
   end

   item = doCreateItemEx(1987, 1)
   if (doPlayerAddItemEx(cid, item, false) ~= RETURNVALUE_NOERROR) then
     doPlayerSendCancel(cid, "You require free inventory space to obtain this reward.")
   else
     for i = 1, #items do
       doAddContainerItem(item, items[i].item_id, items[i].item_count)
     end
     doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found a ".. getItemNameById(1987) .." weighing ".. string.format("%.2f", getAllItemWeight(weight)) .." oz.")
     setPlayerStorageValue(cid, storage, 1)
   end
     
   return true
end

function getAllItemWeight(weight)
   local item = {}
   local count = {}
   local weight = 0
   for i = 1, #items do
     table.insert(items, items[i].item_id)
     table.insert(count, items[i].item_count)
   end
   for i = 1, #item do
     weight = (weight + (getItemWeightById(item[i], count[i])))
   end
   return weight
end
For that vocation lua everytime a player relogs they turn back to their regular vocation they dont keep it how do i fix that?
Or do i have to go to mysql and add a query to keep the change?
in vocations.xml for your vocation 9 : aka warlock
change
Code:
fromvoc="1">
to
Code:
fromvoc="9">
 
I want a trade npc for avesta/othire engine that only trade if player has x storage. Thanks
I don't work with that engine, but this is all you'd need to do.
Code:
local storage = 45001
   if msgcontains(msg, "trade") and getPlayerStorageValue(cid, storage) < 1 then
     selfSay("You are not qualified to trade with me.", cid)
   elseif  msgcontains(msg, "trade") and getPlayerStorageValue(cid, storage) >= 1 then
     -- normal trade stuff
   end
 
I don't work with that engine, but this is all you'd need to do.
Code:
local storage = 45001
   if msgcontains(msg, "trade") and getPlayerStorageValue(cid, storage) < 1 then
     selfSay("You are not qualified to trade with me.", cid)
   elseif  msgcontains(msg, "trade") and getPlayerStorageValue(cid, storage) >= 1 then
     -- normal trade stuff
   end
It doesn't work because the shop module is like this:
Code:
        local shopModule = ShopModule:new()
        npcHandler:addModule(shopModule)

        shopModule:addSellableItem({'might ring'},                     ID_mightring, 250, 20)

In 7.72 there is no trade window
 
Hey your chest script yesterday didnt work :(

The Error
Code:
[02/04/2016 16:46:07] [Error - Action Interface]
[02/04/2016 16:46:07] data/actions/scripts/youbro/goldset.lua:eek:nUse
[02/04/2016 16:46:07] Description:
[02/04/2016 16:46:07] data/actions/scripts/youbro/magicset.lua:41: attempt to index field '?' (a number value)
[02/04/2016 16:46:07] stack traceback:
[02/04/2016 16:46:07]     data/actions/scripts/youbro/magicset.lua:41: in function 'getAllItemWeight'
[02/04/2016 16:46:07]     data/actions/scripts/youbro/goldset.lua:18: in function <data/actions/scripts/youbro/goldset.lua:10>

The Action
Code:
<action uniqueid="4014" event="script" value="youbro/goldset.lua"/>



The Lua goldset.lua
Code:
local storage = 4014

local items = {
   [1] = {item_id = 2471, item_count = 1},
   [2] = {item_id = 2646, item_count = 1},
   [3] = {item_id = 2470, item_count = 1},
   [4] = {item_id = 2466, item_count = 1}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
  
   if getPlayerStorageValue(cid, storage) == 1 then
     doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
     doPlayerSendCancel(cid, "It is empty.")
     return true
   end

   if getAllItemWeight(weight) > getPlayerFreeCap(cid) then
     doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
     doPlayerSendCancel(cid, "You require ".. string.format("%.2f", getAllItemWeight(weight)) .." capacity to obtain this reward.")
     return true
   end

   item = doCreateItemEx(1987, 1)
   if (doPlayerAddItemEx(cid, item, false) ~= RETURNVALUE_NOERROR) then
     doPlayerSendCancel(cid, "You require free inventory space to obtain this reward.")
   else
     for i = 1, #items do
       doAddContainerItem(item, items.item_id, items.item_count)
     end
     doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found a ".. getItemNameById(1987) .." weighing ".. string.format("%.2f", getAllItemWeight(weight)) .." oz.")
     setPlayerStorageValue(cid, storage, 1)
   end
    
   return true
end

function getAllItemWeight(weight)
   local item = {}
   local count = {}
   local weight = 0
   for i = 1, #items do
     table.insert(items, items.item_id)
     table.insert(count, items.item_count)
   end
   for i = 1, #item do
     weight = (weight + (getItemWeightById(item, count)))
   end
   return weight
end
 
Last edited:
Hey your chest script yesterday didnt work :(

The Error
[02/04/2016 16:46:07] [Error - Action Interface]
[02/04/2016 16:46:07] data/actions/scripts/youbro/goldset.lua:eek:nUse
[02/04/2016 16:46:07] Description:
[02/04/2016 16:46:07] data/actions/scripts/youbro/magicset.lua:41: attempt to index field '?' (a number value)
[02/04/2016 16:46:07] stack traceback:
[02/04/2016 16:46:07] data/actions/scripts/youbro/magicset.lua:41: in function 'getAllItemWeight'
[02/04/2016 16:46:07] data/actions/scripts/youbro/goldset.lua:18: in function <data/actions/scripts/youbro/goldset.lua:10>

The Action
<action uniqueid="4014" event="script" value="youbro/goldset.lua"/>



The Lua goldset.lua
local storage = 4014

local items = {
[1] = {item_id = 2471, item_count = 1},
[2] = {item_id = 2646, item_count = 1},
[3] = {item_id = 2470, item_count = 1},
[4] = {item_id = 2466, item_count = 1}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)

if getPlayerStorageValue(cid, storage) == 1 then
doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
doPlayerSendCancel(cid, "It is empty.")
return true
end

if getAllItemWeight(weight) > getPlayerFreeCap(cid) then
doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
doPlayerSendCancel(cid, "You require ".. string.format("%.2f", getAllItemWeight(weight)) .." capacity to obtain this reward.")
return true
end

item = doCreateItemEx(1987, 1)
if (doPlayerAddItemEx(cid, item, false) ~= RETURNVALUE_NOERROR) then
doPlayerSendCancel(cid, "You require free inventory space to obtain this reward.")
else
for i = 1, #items do
doAddContainerItem(item, items.item_id, items.item_count)
end
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found a ".. getItemNameById(1987) .." weighing ".. string.format("%.2f", getAllItemWeight(weight)) .." oz.")
setPlayerStorageValue(cid, storage, 1)
end

return true
end

function getAllItemWeight(weight)
local item = {}
local count = {}
local weight = 0
for i = 1, #items do
table.insert(items, items.item_id)
table.insert(count, items.item_count)
end
for i = 1, #item do
weight = (weight + (getItemWeightById(item, count)))
end
return weight
end
Use code tags pls.
Code:
Like dis
 
Code:
local storage = 4014

local items = {
[1] = {item_id = 2471, item_count = 1},
[2] = {item_id = 2646, item_count = 1},
[3] = {item_id = 2470, item_count = 1},
[4] = {item_id = 2466, item_count = 1}
}

local magicEffect = 25 --Magic effect for script--
local BAG_ID = 1111 --Set to bag they get for items--

function onUse(cid, item, fromPosition, itemEx, toPosition)

if getPlayerStorageValue(cid, storage) == 1 then
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
return doPlayerSendCancel(cid, "It is empty.")
end

local weight = 0

for i = 1, #items do
    weight = weight + getItemWeightById(items[i].item_id)
end

local playerCap = getPlayerFreeCap(cid)
    if playerCap >= weight then
    setPlayerStorageValue(cid, storage, 1)
    doSendMagicEffect(getPlayerPosition(cid), magicEffect)
    local BAG = doPlayerAddItem(cid, BAG_ID, 1)
        for i = 1, #items do
            doAddContainerItem(BAG, items[i].itemid, items[i].item_count)
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_GREEN, "You have found a "..getItemNameById(items[i].itemid)..".")
        end
    else
    return doPlayerSendCancel(cid, "You require "..weight.." capacity to obtain this reward.")
    end
return true
end

::EDIT

Just changed the code had 1 typo in it.
 
Code:
local storage = 4014

local items = {
[1] = {item_id = 2471, item_count = 1},
[2] = {item_id = 2646, item_count = 1},
[3] = {item_id = 2470, item_count = 1},
[4] = {item_id = 2466, item_count = 1}
}

local magicEffect = 25 --Magic effect for script--
local BAG_ID = 1111 --Set to bag they get for items--

function onUse(cid, item, fromPosition, itemEx, toPosition)

if getPlayerStorageValue(cid, storage) == 1 then
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
return doPlayerSendCancel(cid, "It is empty.")
end

local weight = 0

for i = 1, #items do
    weight = weight + getItemWeightById(items[i].item_id)
end

local playerCap = getPlayerFreeCap(cid)
    if playerCap >= weight then
    setPlayerStorageValue(cid, storage, 1)
    doSendMagicEffect(getPlayerPosition(cid), magicEffect)
    local BAG = doPlayerAddItem(cid, BAG_ID, 1)
        for i = 1, #items do
            doAddContainerItem(BAG, items[i].itemid, items[i].item_count)
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_GREEN, "You have found a "..getItemNameById(items[i].itemid)..".")
        end
    else
    return doPlayerSendCancel(cid, "You require "..weight.." capacity to obtain this reward.")
    end
return true
end

::EDIT

Just changed the code had 1 typo in it.
I changed the id to the bag id but it only gives me an empty bag :(
 
Try this:

Code:
local storage = 4014

local items = {
[1] = {item_id = 2471, item_count = 1},
[2] = {item_id = 2646, item_count = 1},
[3] = {item_id = 2470, item_count = 1},
[4] = {item_id = 2466, item_count = 1}
}

local magicEffect = 25 --Magic effect for script--
local BAG_ID = 1111 --Set to bag they get for items--

function onUse(cid, item, fromPosition, itemEx, toPosition)

if getPlayerStorageValue(cid, storage) == 1 then
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
return doPlayerSendCancel(cid, "It is empty.")
end

local weight = 0

for i = 1, #items do
    weight = weight + getItemWeightById(items[i].item_id)
end

local playerCap = getPlayerFreeCap(cid)
    if playerCap >= weight then
   local BAG = doPlayerAddItem(cid, BAG_ID, 1)
    setPlayerStorageValue(cid, storage, 1)
    doSendMagicEffect(getPlayerPosition(cid), magicEffect)
        for i = 1, #items do
            doAddContainerItem(BAG, items[i].item_id, items[i].item_count)
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_GREEN, "You have found a "..getItemNameById(items[i].item_id)..".")
        end
    else
    return doPlayerSendCancel(cid, "You require "..weight.." capacity to obtain this reward.")
    end
return true
end

::EDIT
Found one more typo should fix the problem make sure you get the newest script by reloading this page.
 
Last edited:
Status
Not open for further replies.
Back
Top