• 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,825
Solutions
586
Reaction score
5,404
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:
0.3.7

hey again i tryed too script something too be fair i guess im on the right track

this is what it should do

i have the item "crowbar" and a fence.. when i use this crowbar on the fence it should tp too the other side and break the crowbar.

action.xml
Code:
<action itemid="2416" event="script" value="tools/cowbar.lua"/>

crowbar.xml
Code:
function onUse(cid, item, frompos, item2, topos)
     if item.uid == 1234 then
     doTeleportThing(cid, {x = 32083, y = 32207, z = 6})
     doRemoveItem(item.uid, 1)
     doPlayerSendTextMessage(cid,  MESSAGE_INFO_DESCR, "The crowbar broke but u somehow could slip into the room.")
     end
     return true
     end

i gave the fence in the mapeditor the unique id but it doesnt work and i get no errors.

hope u could tell me what i did wrong :)
 
0.3.7

hey again i tryed too script something too be fair i guess im on the right track

this is what it should do

i have the item "crowbar" and a fence.. when i use this crowbar on the fence it should tp too the other side and break the crowbar.

action.xml
Code:
<action itemid="2416" event="script" value="tools/cowbar.lua"/>

crowbar.xml
Code:
function onUse(cid, item, frompos, item2, topos)
     if item.uid == 1234 then
     doTeleportThing(cid, {x = 32083, y = 32207, z = 6})
     doRemoveItem(item.uid, 1)
     doPlayerSendTextMessage(cid,  MESSAGE_INFO_DESCR, "The crowbar broke but u somehow could slip into the room.")
     end
     return true
     end

i gave the fence in the mapeditor the unique id but it doesnt work and i get no errors.

hope u could tell me what i did wrong :)
Your main issue is in your first line
Code:
function onUse(cid, item, frompos, item2, topos) -- incorrect
function onUse(cid, item, fromPosition, itemEx, toPosition) -- correct
Anyways, here it is updated.
Code:
<action itemid="2416" event="script" value="tools/crowbar.lua"/>
Code:
local storage = 45001 -- ActionID to be placed on the fence.

function onUse(cid, item, fromPosition, itemEx, toPosition)
   if itemEx.aid == storage then
     doTeleportThing(cid, {x = 32083, y = 32207, z = 6})
     doRemoveItem(item.uid, 1)
     doPlayerSendTextMessage(cid,  MESSAGE_INFO_DESCR, "The crowbar broke but u somehow could slip into the room.")
   end
   return true
end
 
Your main issue is in your first line
Code:
function onUse(cid, item, frompos, item2, topos) -- incorrect
function onUse(cid, item, fromPosition, itemEx, toPosition) -- correct
Anyways, here it is updated.
Code:
<action itemid="2416" event="script" value="tools/crowbar.lua"/>
Code:
local storage = 45001 -- ActionID to be placed on the fence.

function onUse(cid, item, fromPosition, itemEx, toPosition)
   if itemEx.aid == storage then
     doTeleportThing(cid, {x = 32083, y = 32207, z = 6})
     doRemoveItem(item.uid, 1)
     doPlayerSendTextMessage(cid,  MESSAGE_INFO_DESCR, "The crowbar broke but u somehow could slip into the room.")
   end
   return true
end

ah thanks man i was close indeed :p
 
What is racename for? Is it boss need to kill to finish the task or what? :p
Mostly for aesthetics.
Code:
You have defeated " .. getCreatureStorage(cid, k.storage) .. " out of " .. k.kills .. " " .. k.raceName .. "!
You have defeated enough " .. k.raceName .. "! " .. k.npcName .. " is waiting to hear the results of your mission!"
Code:
You have defeated 4 out of 50 Wasps!
You have defeated enough Wasps! Turk the Smelly is waiting to hear the results of your mission!
 
Greeted.

I'm looking for a script so when I push the lever [AID: 9483] it will give me 5 pieces of ham for 25 gold points.
I've tried several ways, and I'm a professinal scripter (I study programming aswell) but somewhy this won't work.
Hopefully you can help me.
 
Greeted.

I'm looking for a script so when I push the lever [AID: 9483] it will give me 5 pieces of ham for 25 gold points.
I've tried several ways, and I'm a professinal scripter (I study programming aswell) but somewhy this won't work.
Hopefully you can help me.
Code:
<action actionid="45001" event="script" value="ham_lever.lua"/>
Code:
local function reset(p)
     doTransformItem(getTileItemById(p, 1946).uid, 1945)
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
 
     -- check if lever is currently used
     if item.itemid == 1946 then
         return doPlayerSendTextMessage(cid, 22, "Wait for switch to reset.")
     end
   
     -- check for money
     if doPlayerRemoveMoney(cid, 25) then
         -- add items
         doPlayerAddItem(cid, 2671, 5, true)
     else
         doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
         doPlayerSendCancel(cid, "Requires 25 gold to obtain ham.")
     end
   
     -- transform lever, and add reset
     doTransformItem(item.uid, item.itemid + 1)
     addEvent(reset, 10 * 1000, toPosition)
 
     return true
end
Create lever id == 1945
Add lever AID == 45001
 
Hi, if You can make this script i will be grateful :D
0.3.6
spell if attacker use this on target (only players) then attacker and target both teleport in one of ten random point on the map and after 5 seconds will return to its place.
 
I think the script isn't working good.
afdoa1.jpg
 
I think the script isn't working good.
afdoa1.jpg
You need to change the kill value in both the npc and creature script to match.
And (aesthetically) you should have an 's' on the end of the raceName so it reads properly.

(however.. I do see one thing I don't remember adding.. o.o)
Try to change this line in the npc
Code:
if getPlayerStorageValue(cid, config[x].storage + 1) == config[x].count then
to this
Code:
if getPlayerStorageValue(cid, config[x].storage) == config[x].count then
Do not do this! I was tired when look through this before. This is definitely intended, and required.
 
Last edited:
You need to change the kill value in both the npc and creature script to match.
And (aesthetically) you should have an 's' on the end of the raceName so it reads properly.
I've changed the value for 2 of them and made it 10 but i changed Wasps to Wasp.
 
I've changed the value for 2 of them and made it 10 but i changed Wasps to Wasp.
You checked before I could get my edit in. xD
Check up again.

Hi, if You can make this script i will be grateful :D
0.3.6
spell if attacker use this on target (only players) then attacker and target both teleport in one of ten random point on the map and after 5 seconds will return to its place.
Sorry, I don't do spells.
However, I am curious.
What is the point of moving them to the 10 random locations?
 
Last edited by a moderator:
@Xikini the script didn't work at all because now when i accept the task and msg him again
NPC: HI
PLAYER : Task
N: did you complete the mission?
P: Yes
N: REWARD
But i didn't kill any monster and i can take my reward Lol.
 
Npc
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
local xmsg = {}
local monster = ''
local storage = -1


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

function greet(cid)
    talkState[cid] = 0
    return true
end

function getNpcName()
    return getCreatureName(getNpcId())
end
-- this function returns a list of all the index values of tasks with a period at the end
function getListOfTasks(t, s)
    local x = {}
    for v, _ in pairs(t) do
        table.insert(x, s and v .. s or v )
    end
    s = table.concat(x)
    return s:sub(1, #s - 2)..'.'
end
-- the tasks table is constant its values never change
local tasks = {
    ["wasps"]  = {storage = 45003, count = 51, experience = 1000, reward = 2160, rewardCount = 1},
    ["trolls"]  = {storage = 45005, count = 51, experience = 1000, reward = 2160, rewardCount = 1},
    ["goblins"]  = {storage = 45007, count = 51, experience = 1000, reward = 2160, rewardCount = 1},
    ["slimes"]  = {storage = 45009, count = 51, experience = 1000, reward = 2160, rewardCount = 1},
    ["rotworms"]  = {storage = 45011, count = 51, experience = 1000, reward = 2160, rewardCount = 1},
    ["amazons"]  = {storage = 45013, count = 51, experience = 1000, reward = 2160, rewardCount = 1},
    ["valkyries"]  = {storage = 45015, count = 51, experience = 1000, reward = 2160, rewardCount = 1},
    ["larva"]  = {storage = 45017, count = 51, experience = 1000, reward = 2160, rewardCount = 1},
    ["orcs"]  = {storage = 45019, count = 51, experience = 1000, reward = 2160, rewardCount = 1},
    ["dwarves"]  = {storage = 45021, count = 51, experience = 1000, reward = 2160, rewardCount = 1},
    ["minotaurs"]  = {storage = 45023, count = 51, experience = 1000, reward = 2160, rewardCount = 1},
    ["ghouls"]  = {storage = 45025, count = 51, experience = 1000, reward = 2160, rewardCount = 1},
    ["scarabs"]  = {storage = 45027, count = 51, experience = 1000, reward = 2160, rewardCount = 1},
    ["ancient scarabs"]  = {storage = 45029, count = 51, experience = 1000, reward = 2160, rewardCount = 1},
    ["demons skeletons"] = {storage = 45031, count = 51, experience = 1000, reward = 2160, rewardCount = 1},
    ["cyclops"]  = {storage = 45033, count = 51, experience = 1000, reward = 2160, rewardCount = 1},
    ["vampires"]  = {storage = 45035, count = 51, experience = 1000, reward = 2160, rewardCount = 1},
    ["necromancers"]  = {storage = 45037, count = 51, experience = 1000, reward = 2160, rewardCount = 1},
    ["giant spiders"]  = {storage = 45039, count = 51, experience = 1000, reward = 2160, rewardCount = 1},
    ["dragons"]  = {storage = 45041, count = 51, experience = 1000, reward = 2160, rewardCount = 1},
    ["dragon lords"]  = {storage = 45043, count = 51, experience = 1000, reward = 2160, rewardCount = 1},
    ["demons"]  = {storage = 45045, count = 51, experience = 1000, reward = 2160, rewardCount = 1}
}

function creatureSayCallback(cid, type, msg)
    if(not npcHandler:isFocused(cid)) then
        return false
    end

    local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
    msg = msg:lower()
 

    if msgcontains(msg, "task") then
        selfSay("Tasks available: " ..getListOfTasks(tasks, ', '), cid)

    elseif tasks[msg] then
        storage = getPlayerStorageValue(cid, tasks[msg].storage)
        monster = msg
        if storage < 1 then
            selfSay("Would like you like to start the ".. monster .." task?", cid)
            talkState[talkUser] = 1
        elseif storage >= 1 and storage < tasks[monster].count then
            selfSay("You have not completed your task yet, you still need to kill " .. ((tasks[monster].count - 1) - storage ) .. ' of ' .. monster .. '.', cid)
            talkState[talkUser] = 0
        elseif storage == tasks[monster].count then
            selfSay("You've completed the task of killing " .. (tasks[monster].count - 1) .. ' of ' .. monster .. '.', cid)
            -- reset the task, so they can do it again
            setPlayerStorageValue(cid, tasks[monster].storage, 0)
            doPlayerAddExperience(cid, tasks[monster].experience)
            doPlayerAddItem(cid, tasks[monster].reward, tasks[monster].rewardCount, true)
            talkState[talkUser] = 0
        end

    elseif msgcontains(msg, "yes") and talkState[talkUser] == 1 then
        selfSay("Great! Once you have killed ".. ( tasks[monster].count - 1 ) .." of ".. monster .." come back and see me.", cid)
        setPlayerStorageValue(cid, tasks[monster].storage, 1)
        -- maybe needed?
        talkState[talkUser] = 0
    end
    talkState[talkUser] = 0
    return true
end

npcHandler:setCallback(CALLBACK_GREET, greet)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

onKill
Code:
-- this function returns the index of tasks for the corresponding creature
function getMonsterTask(t, s)
    for k, v in pairs(t) do
        if isInArray(k, s) then
            return k
        end
    end
    return false
end

local tasks = {
   [{"wasp"}] = {storage = 45003, count = 51, raceName = "Wasps", npcName = "Turk the Smelly"},
   [{"swamp troll", "frost troll", "troll"}] = {storage = 45005, count = 51, raceName = "Trolls", npcName = "Turk the Smelly"},
   [{"goblin"}] = {storage = 45007, count = 51, raceName = "Goblins", npcName = "Turk the Smelly"},
   [{"slime"}] = {storage = 45009, count = 51, raceName = "Slimes", npcName = "Turk the Smelly"},
   [{"rotworm", "carrion worm"}] = {storage = 45011, count = 51, raceName = "Rotworms", npcName = "Turk the Smelly"},
   [{"amazon"}] = {storage = 45013, count = 51, raceName = "Amazons", npcName = "Turk the Smelly"},
   [{"valkyrie"}] = {storage = 45015, count = 51, raceName = "Valktries", npcName = "Turk the Smelly"},
   [{"larva"}] = {storage = 45017, count = 51, raceName = "Larva", npcName = "Turk the Smelly"},
   [{"orc", "orc leader", "orc warrior", "orc warlord", "orc shaman", "orc berserker", "orc spearman"}] = {storage = 45019, count = 51, raceName = "Orcs", npcName = "Turk the Smelly"},
   [{"dwarf", "dwarf guard"}] = {storage = 45021, count = 51, raceName = "Dwarves", npcName = "Turk the Smelly"},
   [{"minotaur", "minotaur guard", "minotaur mage", "minotaur archer"}] = {storage = 45023, count = 51, raceName = "Minotaurs", npcName = "Turk the Smelly"},
   [{"ghoul"}] = {storage = 45025, count = 51, raceName = "Ghouls", npcName = "Turk the Smelly"},
   [{"scarab"}] = {storage = 45027, count = 51, raceName = "Scarabs", npcName = "Turk the Smelly"},
   [{"ancient scarab"}] = {storage = 45029, count = 51, raceName = "Ancient Scarabs", npcName = "Turk the Smelly"},
   [{"demon skeleton"}] = {storage = 45031, count = 51, raceName = "Demons Skeletons", npcName = "Turk the Smelly"},
   [{"cyclops"}] = {storage = 45033, count = 51, raceName = "Cyclops", npcName = "Turk the Smelly"},
   [{"vampire"}] = {storage = 45035, count = 51, raceName = "Vampires", npcName = "Turk the Smelly"},
   [{"necromancer", "priestess"}] = {storage = 45037, count = 51, raceName = "Necromancers", npcName = "Turk the Smelly"},
   [{"giant spider"}] = {storage = 45039, count = 51, raceName = "Giant Spiders", npcName = "Turk the Smelly"},
   [{"dragon"}] = {storage = 45041, count = 51, raceName = "Dragons", npcName = "Turk the Smelly"},
   [{"dragon lord"}] = {storage = 45043, count = 51, raceName = "Dragon Lords", npcName = "Turk the Smelly"},
   [{"warlock"}] = {storage = 45045, count = 51, raceName = "Demons", npcName = "Turk the Smelly"}
}

function onKill(cid, target, damage, flags)
    local master = getCreatureMaster(target)
    if master == target then
        -- store the index value of tasks in creature, its table index, e.g. {"dwarf", "dwarf guard"}
        local creature = getMonsterTask(tasks, getCreatureName(target))
        if tasks[creature] then
            -- reuse creature, write over it with the contents of its index
            creature = tasks[creature]
            local kills = getPlayerStorageValue(cid, creature.storage)
            if kills > 0 and kills < creature.count then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have defeated " .. kills .. " out of " .. ( creature.count - 1)  .. " " .. creature.raceName .. "!")
                doCreatureSetStorage(cid, creature.storage, kills + 1)
            elseif kills == creature.count then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have defeated enough " .. creature.raceName .. "!  " .. creature.npcName .. " is waiting to hear the results of your mission!")
            end
        end
    end
    return true
end
 
Last edited:
I am not posting these scripts for you people who requested them, I am posting them for @Xikini, at least he is trying to learn to code and I don't mind if he tells me if it works or not, I respect his opinion, the rest of you can go to hell. :)
 
Thank you. I'll look through this. :p
@Xikini the script didn't work at all because now when i accept the task and msg him again
NPC: HI
PLAYER : Task
N: did you complete the mission?
P: Yes
N: REWARD
But i didn't kill any monster and i can take my reward Lol.
I don't understand how it's not working. I test all my scripts thoroughly before I post them. T.T
I'll re-install and test again.

Ok, so I set the kills on both to 10, and your right it isn't working.. But I have no idea why.
Testing ensues..

I'm an idiot. lmao..

I'll update the original post with the solution, but change all of the 'count' s at the end of the table inside the npc to 'itemCount'
and change this line
Code:
doPlayerAddItem(cid, config[x].reward, config[x].count, true)
to this
Code:
doPlayerAddItem(cid, config[x].reward, config[x].itemCount, true)
 
Thank you. I'll look through this. :p

I don't understand how it's not working. I test all my scripts thoroughly before I post them. T.T
I'll re-install and test again.

Ok, so I set the kills on both to 10, and your right it isn't working.. But I have no idea why.
Testing ensues..

I'm an idiot. lmao..

I'll update the original post with the solution, but change all of the 'count' s at the end of the table inside the npc to 'itemCount'
and change this line
Code:
doPlayerAddItem(cid, config[x].reward, config[x].count, true)
to this
Code:
doPlayerAddItem(cid, config[x].reward, config[x].itemCount, true)
I'm waiting for your post because i don't need to try script of this ass, and thanks again for your work.
 
Status
Not open for further replies.
Back
Top