• 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,812
Solutions
582
Reaction score
5,372
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:
Credits for the request go to @Crip Killa who I've speaking with in private.

Use any item that can be used on another item (use with..) to sell loot.

Use wand on demon shield.
Do you want to sell?
Use wand on demon shield again.
Sold for 33k.

PS: There is a super secret power unlocked, if you use the sell wand, on itself. :oops:


data/actions/actions.xml

Code:
<action actionid="45003" event="script" value="sell_wand.lua"/>
data/actions/scripts/sell_wand.lua
Code:
local items = {
     [1] = { itemID = 2674, value = 1111},
     [2] = { itemID = 2152, value = 1111},
     [3] = { itemID = 2403, value = 1111}
}
local storage = 45001
local timedStorage = 45002
local simple_text = 45003 -- AID of sell wand

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

     if isCreature(itemEx.uid) then
         return true
     end
     if getThing(itemEx.uid).aid == simple_text then
         if getPlayerStorageValue(cid, simple_text) < 1 then
             setPlayerStorageValue(cid, simple_text, 1)
             doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "You are now using basic text.")
         else
             setPlayerStorageValue(cid, simple_text, 0)
             doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "You are now using standard text.")
         end
         return true
     end
      
     for i = 1, #items do
         if items[i].itemID == getThing(itemEx.uid).itemid then
             if getPlayerStorageValue(cid, storage) == items[i].itemID and getPlayerStorageValue(cid, timedStorage) > os.time() then
                 doRemoveItem(itemEx.uid, 1)
                 doPlayerAddMoney(cid, items[i].value)
                 setPlayerStorageValue(cid, storage, 0)
                 if getPlayerStorageValue(cid, simple_text) < 1 then
                     doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "You have sold ".. getItemNameById(items[i].itemID) .." for ".. items[i].value .." gold.")
                 else
                     doPlayerSendTextMessage(cid, MESSAGE_TRADE_NPC, "Item sold for ".. items[i].value .." gold.")
                 end
                 break
             else
                 setPlayerStorageValue(cid, storage, items[i].itemID)
                 setPlayerStorageValue(cid, timedStorage, (os.time() + 30))
                 if getPlayerStorageValue(cid, simple_text) < 1 then
                     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You are about to sell ".. getItemNameById(items[i].itemID) .." for ".. items[i].value .." gold.")
                     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Please ensure you have sufficient inventory slots to receive the reward.")
                     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "To confirm this transaction, use the Sell Wand again on this item.")
                 else
                     doPlayerSendTextMessage(cid, MESSAGE_TRADE_NPC, "Sell this item for ".. items[i].value .." gold?")
                 end
                 break
             end
         end
     end        
  
     return true
end

And here is a very very basic chest script, to give someone an item with the aid on it..
Alternatively you could "/attr aid 45003" lol :p

data/actions/actions.xml

Code:
<action actionid="45004" event="script" value="sell_wand_give.lua"/>
data/actions/scripts/sell_wand_give.lua
Code:
function onUse(cid, item, frompos, item2, topos)
       local thing = doPlayerAddItem(cid, 7735, 1)
       doSetItemActionId(thing, 45003)
       return true
end
 
Done! :)

Can you try explaining it again? Maybe provide a map?

an event where anyone who enters this, have to kill a monster, depending on their level will be the monster appears, and to display the monster has to stepping on a tile, and just 1 monster invoked by 1. The person whos step the tile has to kill his monster helped by other people, for someone else to step on the tile and another monster appears depending on the level that the person stepped beyond the tile has

sorry for my english i am using google translate
 
Last edited by a moderator:
Looking for monsters task, searched for it but i couldn't find the one that i need.
So simple one, You will take the mission of monsters with counting in private chat called TASKS and when you done, you will take your reward(Exp,ITEM ID,)
Thanks.
TFS 0.4
 
Looking for monsters task, searched for it but i couldn't find the one that i need.
So simple one, You will take the mission of monsters with counting in private chat called TASKS and when you done, you will take your reward(Exp,ITEM ID,)
Thanks.
TFS 0.4
I'm making something similar.. or rather.. practically identical to this for someone at the moment.
I will post it soon enough. (next couple of days.. cuz I'm kind of swamped with requests at the moment.)
an event where anyone who enters this, have to kill a monster, depending on their level will be the monster appears, and to display the monster has to stepping on a tile, and just 1 monster invoked by 1. The person whos step the tile has to kill his monster helped by other people, for someone else to step on the tile and another monster appears depending on the level that the person stepped beyond the tile has

sorry for my english i am using google translate
So.. Let's say there are 12 rooms.
pretend.. it's pictured as below. (my paint skills have been quoted as legendary by some.)

cZ2eVHo.png

12 rooms.
1 tile.
Step on tile, get teleported to empty room.
Monster spawned, based on level.
When monster dies, you can teleport to the reward room.

Is this what you are looking for?
 
So how did the custom items script work out for you?
I never heard back from you.. not even a ty :(
 
So how did the custom items script work out for you?
I never heard back from you.. not even a ty :(
I do thank you for the time, but it's not something were going to use I don't think.
It seemed to be mostly 1.x functions (which we could convert of course), and it wasn't going to do what we required it to do.
The other guy's solution, is not a good solution either.. as it's simply a work-around.
I don't understand why we can't just load the main function into the script.
I remember doing it in java.. where you load a scanner or file.. I just assumed there would be a way to do it in movements as well.
 
It seemed to be mostly 1.x functions, and it wasn't going to do what we required it to do.
The other guy's solution, is not a good solution either.. as it's simply a work-around.
I don't understand why we can't just load the main function into the script.
I remember doing it in java.. where you load a scanner or file.. I just assumed there would be a way to do it in movements as well.
Those aren't 1.x functions, that script was written back when 8.6 came out...
I am banging my head against the wall right now because we've talked about this many times on skype, pm's and on these forums, the distro version has 0 to do with the fundamentals of the lua language.
 
@tokenzz @Slafesko
Although I wanted to have it all in one table, It was just causing too many problems, but it's not really a big deal.

data/npc/turk the smelly.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Turk the Smelly" script="data/npc/scripts/turk the smelly.lua" walkinterval="500" floorchange="0">
   <health now="100" max="100"/>
   <look type="130" head="2" body="37" legs="35" feet="47" addons="3"/>
</npc>
data/npc/scripts/turk the smelly.lua
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
local xmsg = {}

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
   
function creatureSayCallback(cid, type, msg)
     if(not npcHandler:isFocused(cid)) then
         return false
     end
     
     local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
   
     local tasks = {
         [1] = {storage = 45003, name = "wasps"},
         [2] = {storage = 45005, name = "trolls"},
         [3] = {storage = 45007, name = "goblins"},
         [4] = {storage = 45009, name = "slimes"},
         [5] = {storage = 45011, name = "rotworms"},
         [6] = {storage = 45013, name = "amazons"},
         [7] = {storage = 45015, name = "valktries"},
         [8] = {storage = 45017, name = "larva"},
         [9] = {storage = 45019, name = "orcs"},
         [10] = {storage = 45021, name = "dwarves"},
         [11] = {storage = 45023, name = "minotaurs"},
         [12] = {storage = 45025, name = "ghouls"},
         [13] = {storage = 45027, name = "scarabs"},
         [14] = {storage = 45029, name = "ancient scarabs"},
         [15] = {storage = 45031, name = "demons skeletons"},
         [16] = {storage = 45033, name = "cyclops"},
         [17] = {storage = 45035, name = "vampires"},
         [18] = {storage = 45037, name = "necromancers"},
         [19] = {storage = 45039, name = "giant spiders"},
         [20] = {storage = 45041, name = "dragons"},
         [21] = {storage = 45043, name = "dragon lords"},
         [22] = {storage = 45045, name = "demons"}
     }
     
     local config = {
         ["wasps"]  = {storage = 45003, count = 50, experience = 1000, reward = 2160, itemCount = 1},
         ["trolls"]  = {storage = 45005, count = 50, experience = 1000, reward = 2160, itemCount = 1},
         ["goblins"]  = {storage = 45007, count = 50, experience = 1000, reward = 2160, itemCount = 1},
         ["slimes"]  = {storage = 45009, count = 50, experience = 1000, reward = 2160, itemCount = 1},
         ["rotworms"]  = {storage = 45011, count = 50, experience = 1000, reward = 2160, itemCount = 1},
         ["amazons"]  = {storage = 45013, count = 50, experience = 1000, reward = 2160, itemCount = 1},
         ["valktries"]  = {storage = 45015, count = 50, experience = 1000, reward = 2160, itemCount = 1},
         ["larva"]  = {storage = 45017, count = 50, experience = 1000, reward = 2160, itemCount = 1},
         ["orcs"]  = {storage = 45019, count = 50, experience = 1000, reward = 2160, itemCount = 1},
         ["dwarves"]  = {storage = 45021, count = 50, experience = 1000, reward = 2160, itemCount = 1},
         ["minotaurs"]  = {storage = 45023, count = 50, experience = 1000, reward = 2160, itemCount = 1},
         ["ghouls"]  = {storage = 45025, count = 50, experience = 1000, reward = 2160, itemCount = 1},
         ["scarabs"]  = {storage = 45027, count = 50, experience = 1000, reward = 2160, itemCount = 1},
         ["ancient scarabs"]  = {storage = 45029, count = 50, experience = 1000, reward = 2160, itemCount = 1},
         ["demons skeletons"] = {storage = 45031, count = 50, experience = 1000, reward = 2160, itemCount = 1},
         ["cyclops"]  = {storage = 45033, count = 50, experience = 1000, reward = 2160, itemCount = 1},
         ["vampires"]  = {storage = 45035, count = 50, experience = 1000, reward = 2160, itemCount = 1},
         ["necromancers"]  = {storage = 45037, count = 50, experience = 1000, reward = 2160, itemCount = 1},
         ["giant spiders"]  = {storage = 45039, count = 50, experience = 1000, reward = 2160, itemCount = 1},
         ["dragons"]  = {storage = 45041, count = 50, experience = 1000, reward = 2160, itemCount = 1},
         ["dragon lords"]  = {storage = 45043, count = 50, experience = 1000, reward = 2160, itemCount = 1},
         ["demons"]  = {storage = 45045, count = 50, experience = 1000, reward = 2160, itemCount = 1}
     }
   
     local x = msg:lower()
   
     if msgcontains(msg, "task") then
         local npcmsg = ""
         for i = 1, #tasks do
             local storage = getPlayerStorageValue(cid, tasks[i].storage)
             if storage <= 1 and storage >= -1 then
                 if npcmsg ~= "" then
                     npcmsg = npcmsg.. ", "
                 end
                 npcmsg = npcmsg..tasks[i].name
             end
         end
         selfSay("Tasks available: " ..npcmsg.. ".", cid)
   
     elseif config[x] then
         if getPlayerStorageValue(cid, config[x].storage) < 1 then
             selfSay("Would like you like to start the ".. x .." task?", cid)
             talkState[talkUser] = 1
             xmsg[cid] = msg
         elseif getPlayerStorageValue(cid, config[x].storage) == 1 then
             selfSay("Have you completed your task?", cid)
             talkState[talkUser] = 2
             xmsg[cid] = msg
         elseif getPlayerStorageValue(cid, config[x].storage) > 1 then
             selfSay("You have already completed this task. Thank you.", cid)
         end
     
     elseif msgcontains(msg, "yes") and talkState[talkUser] == 1 then
         local x = xmsg[cid]:lower()
         selfSay("Great! Once you have killed ".. config[x].count .." ".. x .." come back and see me.", cid)
         setPlayerStorageValue(cid, config[x].storage, 1)
         talkState[talkUser] = 0
       
     elseif msgcontains(msg, "yes") and talkState[talkUser] == 2 then
         local x = xmsg[cid]:lower()
         if getPlayerStorageValue(cid, config[x].storage + 1) == config[x].count then
             selfSay("Wonderful! Here is your reward.", cid)
             setPlayerStorageValue(cid, config[x].storage, 2)
             doPlayerAddExperience(cid, config[x].experience)
             doPlayerAddItem(cid, config[x].reward, config[x].itemCount, true)
         else
             selfSay("You have not killed enough ".. x ..". Come back when you have killed more.", cid)
         end
         talkState[talkUser] = 0   
       
     end
     return true   
end

npcHandler:setCallback(CALLBACK_GREET, greet)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Last edited:
data/creaturescripts/creaturescripts.xml
Code:
<event type="kill" name="TurktheSmellyTasks" event="script" value="turk_the_smelly_tasks.lua"/>
data/creaturescripts/login.lua [somewhere near the bottom with the other registered events]
Code:
registerCreatureEvent(cid, "TurktheSmellyTasks")
data/creaturescripts/turk_the_smelly_tasks.lua
Code:
local t = {
   [{"wasp"}] = {started = 45003, storage = 45004, kills = 50, raceName = "Wasps", npcName = "Turk the Smelly"},
   [{"swamp troll", "frost troll", "troll"}] = {started = 45005, storage = 45006, kills = 50, raceName = "Trolls", npcName = "Turk the Smelly"},
   [{"goblin"}] = {started = 45007, storage = 45008, kills = 50, raceName = "Goblins", npcName = "Turk the Smelly"},
   [{"slime"}] = {started = 45009, storage = 45010, kills = 50, raceName = "Slimes", npcName = "Turk the Smelly"},
   [{"rotworm", "carrion worm"}] = {started = 45011, storage = 45012, kills = 50, raceName = "Rotworms", npcName = "Turk the Smelly"},
   [{"amazon"}] = {started = 45013, storage = 45014, kills = 50, raceName = "Amazons", npcName = "Turk the Smelly"},
   [{"valkyrie"}] = {started = 45015, storage = 45016, kills = 50, raceName = "Valktries", npcName = "Turk the Smelly"},
   [{"larva"}] = {started = 45017, storage = 45018, kills = 50, raceName = "Larva", npcName = "Turk the Smelly"},
   [{"orc", "orc leader", "orc warrior", "orc warlord", "orc shaman", "orc berserker", "orc spearman"}] = {started = 45019, storage = 45020, kills = 50, raceName = "Orcs", npcName = "Turk the Smelly"},
   [{"dwarf", "dwarf guard"}] = {started = 45021, storage = 45022, kills = 50, raceName = "Dwarves", npcName = "Turk the Smelly"},
   [{"minotaur", "minotaur guard", "minotaur mage", "minotaur archer"}] = {started = 45023, storage = 45024, kills = 50, raceName = "Minotaurs", npcName = "Turk the Smelly"},
   [{"ghoul"}] = {started = 45025, storage = 45026, kills = 50, raceName = "Ghouls", npcName = "Turk the Smelly"},
   [{"scarab"}] = {started = 45027, storage = 45028, kills = 50, raceName = "Scarabs", npcName = "Turk the Smelly"},
   [{"ancient scarab"}] = {started = 45029, storage = 45030, kills = 50, raceName = "Ancient Scarabs", npcName = "Turk the Smelly"},
   [{"demon skeleton"}] = {started = 45031, storage = 45032, kills = 50, raceName = "Demons Skeletons", npcName = "Turk the Smelly"},
   [{"cyclops"}] = {started = 45033, storage = 45034, kills = 50, raceName = "Cyclops", npcName = "Turk the Smelly"},
   [{"vampire"}] = {started = 45035, storage = 45036, kills = 50, raceName = "Vampires", npcName = "Turk the Smelly"},
   [{"necromancer", "priestess"}] = {started = 45037, storage = 45038, kills = 50, raceName = "Necromancers", npcName = "Turk the Smelly"},
   [{"giant spider"}] = {started = 45039, storage = 45040, kills = 50, raceName = "Giant Spiders", npcName = "Turk the Smelly"},
   [{"dragon"}] = {started = 45041, storage = 45042, kills = 50, raceName = "Dragons", npcName = "Turk the Smelly"},
   [{"dragon lord"}] = {started = 45043, storage = 45044, kills = 50, raceName = "Dragon Lords", npcName = "Turk the Smelly"},
   [{"warlock"}] = {started = 45045, storage = 45046, kills = 50, raceName = "Demons", npcName = "Turk the Smelly"}
}
function onKill(cid, target, damage, flags)
   for v, k in pairs(t) do
     local master = getCreatureMaster(target)
     if(master and master ~= target) then return true end
     if(bit.band(flags, 1) == 1 and isMonster(target) and isInArray(v, getCreatureName(target))) then
       if(getCreatureStorage(cid, k.started) == 1) then
         if(getCreatureStorage(cid, k.storage) < 0) then
           doCreatureSetStorage(cid, k.storage, 0)
         end
         if(getCreatureStorage(cid, k.storage) < k.kills) then
           doCreatureSetStorage(cid, k.storage, getCreatureStorage(cid, k.storage) + 1)
           doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have defeated " .. getCreatureStorage(cid, k.storage) .. " out of " .. k.kills .. " " .. k.raceName .. "!")
         elseif getCreatureStorage(cid, k.storage) == k.kills then
           local mr = math.random(9)
           if (mr == 9) then
             doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have defeated enough " .. k.raceName .. "!  " .. k.npcName .. " is waiting to hear the results of your mission!")
           end
         end
       end
     end
   end
   return true
end
 
@Xikini you should have been more explicit of what you wanted to do in the support thread you made.
I won't rewrite your work, it might do more harm then good :p
 
@Xikini you should have been more explicit of what you wanted to do in the support thread you made.
I won't rewrite your work, it might do more harm then good :p
Yeah. I just didn't know how to explain what I wanted to do. Working in between shifts to try to get it done and not much sleep, so I'm a little irritable. :p
 
@Xikini Encountered one error:

Code:
Lua Script Error: [Npc interface]
data/npc/scripts/turk the smelly.lua:onCreatureSay

data/npc/scripts/turk the smelly.lua:22: attempt to call method 'isFocused' (a nil value)
stack traceback:
        data/npc/scripts/turk the smelly.lua:22: in function 'callback'
        data/npc/scripts/lib/npcsystem/npchandler.lua:297: in function 'onCreatureSay'
        data/npc/scripts/turk the smelly.lua:9: in function <data/npc/scripts/turk the smelly.lua:9>
 
Last edited:
@Xikini Encountered one error:

Code:
Lua Script Error: [Npc interface]
data/npc/scripts/turk the smelly.lua:onCreatureSay

data/npc/scripts/turk the smelly.lua:22: attempt to call method 'isFocused' (a nil value)
stack traceback:
        data/npc/scripts/turk the smelly.lua:22: in function 'callback'
        data/npc/scripts/lib/npcsystem/npchandler.lua:297: in function 'onCreatureSay'
        data/npc/scripts/turk the smelly.lua:9: in function <data/npc/scripts/turk the smelly.lua:9>
That's an issue with your npc's, not the script.
If I were to guess it's that the function 'isFocused' doesn't exist in your server.
Try the support board.
 
Status
Not open for further replies.
Back
Top