• 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,824
Solutions
586
Reaction score
5,403
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:
I hope this screen will describe my feelings about this script. XD Couldn't describe it in words.
2uhbjnk.jpg


It just don't stack automatically.
 
I hope this screen will describe my feelings about this script. XD Couldn't describe it in words.
2uhbjnk.jpg


It just don't stack automatically.
That has been a long standing issue with 0.3.x servers.
A work-around is to check how many they have of each item on the player.. remove them.. then re-add them as a group.

The reason it is a work-around is because if the player does not have enough cap to hold the entire stack of items, then the entire stack will drop on the ground.

Here it is, updated for what I described above. Hopefully you understand what I mean.

Untested.
Code:
local config = {
     item = {ID1, ID2}
}
function onKill(cid, target, lastHit)
     if isPlayer(cid) == TRUE and isPlayer(target) == TRUE and lastHit == TRUE then
         for i = 1, #config.item do
             count = {}
             countitem = getPlayerItemCount(cid, config.item[i])
             table.insert(count, countitem)
             doPlayerRemoveItem(cid, config.item[i], count)
             doPlayerAddItem(cid, config.item[i], (count + 1), true)
         end
     end
     return TRUE
end
 
Thanks for trying right now, but in game it's like that:
33d9vz5.jpg

If some1 kills me i have 0hp, black hp bar and can run.

Console here:
144d2f7.jpg
 
Thanks for trying right now, but in game it's like that:
33d9vz5.jpg

If some1 kills me i have 0hp, black hp bar and can run.

Console here:
144d2f7.jpg
Can you post the exact script you have installed?
Did you change the itemID's?
 
Code:
local config = {
     item = {2151, 5944}
}
function onKill(cid, target, lastHit)
     if isPlayer(cid) == TRUE and isPlayer(target) == TRUE and lastHit == TRUE then
         for i = 1, #config.item do
             count = {}
             countitem = getPlayerItemCount(cid, config.item[i])
             table.insert(count, countitem)
             doPlayerRemoveItem(cid, config.item[i], count)
             doPlayerAddItem(cid, config.item[i], (count + 1), true)
         end
     end
     return TRUE
end

Here you are :D
 
Code:
local config = {
     item = {2151, 5944}
}
function onKill(cid, target, lastHit)
     if isPlayer(cid) == TRUE and isPlayer(target) == TRUE and lastHit == TRUE then
         for i = 1, #config.item do
             count = {}
             countitem = getPlayerItemCount(cid, config.item[i])
             table.insert(count, countitem)
             doPlayerRemoveItem(cid, config.item[i], count)
             doPlayerAddItem(cid, config.item[i], (count + 1), true)
         end
     end
     return TRUE
end

Here you are :D
PMing you so we don't spam :p
 
If you are still taking requests, I'll make one, let me know if you are interested in making it.

Bank Account and Interest System

Instead of being able to store any amount of gold in a bank you have a limit of gold you can store.

You can increase this limit by purchasing an upgrade for your bank account

An upgrade for a bank account would also raise the interest rate that your account has, as long as a minimum balance is met.

Because there are varying interest rates, there are different tiers of interest rates.

Payouts for interest rates should occur daily or weekly (or configurable for any time)

Here is a quick table giving examples of different account levels/tiers.


Account Type (level) - Min-Max Balance - Interest Rate - Upgrade cost


Junior Saver (level 0) - 0 - 1,000 gold - 0% - 0
Student Account (level 1) - 1,000 - 5,000 gold - 4.5% - 1,000 gold
Bronze Saver (level 2) - 5,000 - 10,000 gold - 5.0% - 5,000 gold
Silver Saver (level 3) 10,000 - 15,000 gold - 5.5% - 10,000 gold
Gold Saver (level 4) - 15,000 - 20,000 gold - 6.0% - 15,000 gold
Platinum Account (level 5) - 20,000 - 25,000 gold - 6.5% - 20,000 gold


To recap, the account type is a name of the account, the min balance is the balance required to stay in the interest rate, the max balance is the max amount of gold that level of account can hold, and the upgrade cost is the cost to upgrade that account.

A player can not deposit more money into over his account limit, till he purchases access to the next level.

A player could have unlocked a Bronze saver account, but only have 1,000 gold in his account, so his interest rate would be 4.5%.



So the request would be a system that limits how much money you can deposit into the bank separated by tiers, an npc you talk to that lets you buy different bank account levels and checks your account type, and a globalevent that pays an interest rate every so many days.
 
I have some request for my ot, for a events zone can you help me?

I wanna know if u can help me to made a script to enter in some zone and kill a monster depends on level of whos step in some tile, but to end that event, every one whos enter in the event, need step in the tile and defeat their monster, and ends the event, go back to the teleport and enter in the reward zone, to click on a dice and depends on the number of the dice random givie you a random donation coins or event coins, but if u dont kill ur monster and dont have ur storage dont enter in the reward zone and back to temple or depot, can u made it? xD


Again xD
 
So the request would be a system that limits how much money you can deposit into the bank separated by tiers, an npc you talk to that lets you buy different bank account levels and checks your account type, and a globalevent that pays an interest rate every so many days.
The first part..
"a system that limits how much money you can deposit into the bank separated by tiers, an npc you talk to that lets you buy different bank account levels and checks your account type"
I can definitely do this part, however
"globalevent that pays an interest rate every so many days"
This part.. I'm not sure if I can do. I have an idea how I might do it, but it'll require quite a bit of trial and error.
I'm assuming it would be best to make the player come back and 'receive their reward' after x amount of time for the interest rate.
And if they deposit/withdraw anything from the account it would reset the timer for their interest rate payout.

Does this sound right?

If it does, send me your current banker npc through pm, and I'll see when I have time to create it.
 
The first part..
"a system that limits how much money you can deposit into the bank separated by tiers, an npc you talk to that lets you buy different bank account levels and checks your account type"
I can definitely do this part, however
"globalevent that pays an interest rate every so many days"
This part.. I'm not sure if I can do. I have an idea how I might do it, but it'll require quite a bit of trial and error.
I'm assuming it would be best to make the player come back and 'receive their reward' after x amount of time for the interest rate.
And if they deposit/withdraw anything from the account it would reset the timer for their interest rate payout.

Does this sound right?

If it does, send me your current banker npc through pm, and I'll see when I have time to create it.

Sent you a PM.

Also, the pay out is suppose to happen automatically, added directly to the bank account at whatever time frame interest rates are paid out. (Probably would be best to handle it on server start up, but that is expecting that the server has a daily server save.)
 
Made this for @God Mythera in the request section.

Easy quest chest system.
Simply give each chest/container/item Action ID 45000
and give each chest/container/item the Unique ID in script
And you'll have a full working quest chest/container/item that will reward the players whatever you decide.


daz5TN8.png


data/actions/actions.xml
Code:
<action actionid="45000" event="script" value="Xikini_easy_chests.lua"/>
data/actions/scripts/Xikini_easy_chests.lua
Code:
local config = {
     [1] = { uid = 45001, item = 11111, amount = 111},
     [2] = { uid = 45002, item = 11111, amount = 111},
     [3] = { uid = 45003, item = 11111, amount = 111},
     [4] = { uid = 45004, item = 11111, amount = 111}
}
local exstorage = 45000

function onUse(cid, item, fromPosition, itemEx, toPosition)
     if exhaustion.check(cid, exstorage) then
         doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
         doPlayerSendCancel(cid, "You are exhausted.")
         return true
     end
     exhaustion.set(cid, exstorage, 2)
     for i = 1, #config do
         if config[i].uid == item.uid then
             if getPlayerStorageValue(cid, config[i].uid) < 1 then
                 if getPlayerFreeCap(cid) >= getItemWeightById(config[i].item, config[i].amount) then
                     local item = doCreateItemEx(config[i].item, config[i].amount)
                     if(doPlayerAddItemEx(cid, item, false) ~= RETURNVALUE_NOERROR) then
                         doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
                         doPlayerSendCancel(cid, "You require free inventory space to obtain this reward.")
                     else
                         doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found ".. config[i].amount .." ".. getItemNameById(config[i].item) ..".")
                         setPlayerStorageValue(cid, config[i].uid, 1)
                     end
                 else
                     doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
                     doPlayerSendCancel(cid, "You require ".. getItemWeightById(config[i].item, config[i].amount) .." capacity to obtain this reward.")
                 end
             else
                 doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
                 doPlayerSendCancel(cid, "You have already obtained this reward.")
             end
             break
         end
     end
     return true
end
 
Bump.

Going to start giving out random mini scripts I use to help myself and/or I think are cool enough to share, whenever I want to bump this thread.

Somewhere on this forum someone wanted to change their players vocation in a quest, but retain their current skills.
This small movement script does just that.
The reason you remove, then re-add the experience, is so that their cap/hp/mana changes to the correct values of the new vocation

Code:
local vocation = 2

function onStepIn(cid, item, position, fromPosition)
   
     if isPlayer(cid) == TRUE then
         if getPlayerStorageValue(cid, 45001) < 1 then
             -- get players current experience, then remove it
             local experience = {}
             thing = (getPlayerExperience(cid))
             table.insert(experience, thing)
             doPlayerAddExperience(cid, -experience[1])
             
             -- change vocation
             doPlayerSetVocation(cid, vocation)
             
             -- give the player their experience back
             doPlayerAddExperience(cid, experience[1])
             
             -- Notify player of their new vocation, send effect and give storage
             doCreatureSay(cid, "Vocation changed! You are now a ".. getPlayerVocationName(cid) .."!", TALKTYPE_ORANGE_1, cid)
             doSendMagicEffect(position, 27)
             setPlayerStorageValue(cid, 45001, 1)
         end
     end
     
     return true
end
 
Hey, Xik

I'm trying to make a script but I think I need add storageValue's in it and I don't really understand how to use them/what they do.

Do you know a good and understandable tutorial about StorageValue's?

Regards,
 
Hey, Xik

I'm trying to make a script but I think I need add storageValue's in it and I don't really understand how to use them/what they do.

Do you know a good and understandable tutorial about StorageValue's?

Regards,
Storage values can be thought of as a number representation of a variable, they are used to reference a value.
Code:
local mystorage = 45001
setPlayerStorageValue(cid, mystorage, 1)
Is the same as
Code:
setPlayerStorageValue(cid, 45001, 1)
The value in mystorage is passed to setPlayerStorageValue and stored in the database to reference the value assigned to it.

Using an 8.6 server, if we look at the sql code you can see how the information is stored in a table
Code:
CREATE TABLE `player_storage`
(
    `player_id` INT NOT NULL DEFAULT 0,
    `key` INT UNSIGNED NOT NULL DEFAULT 0,
    `value` VARCHAR(255) NOT NULL DEFAULT '0',
    KEY (`player_id`), UNIQUE (`player_id`, `key`),
    FOREIGN KEY (`player_id`) REFERENCES `players`(`id`) ON DELETE CASCADE
) ENGINE = InnoDB;
player_id is the player's cid, key is a number representing the number to reference, value is character value to store
Code:
setPlayerStorageValue(cid, storage, value)

The same thing can be said for global storage, except that it isn't assigned to any particular player
Code:
CREATE TABLE `global_storage`
(
    `key` INT UNSIGNED NOT NULL,
    `world_id` TINYINT(2) UNSIGNED NOT NULL DEFAULT 0,
    `value` VARCHAR(255) NOT NULL DEFAULT '0',
    UNIQUE  (`key`, `world_id`)
) ENGINE = InnoDB;
Code:
setGlobalStorageValue(key, newValue)

When you call
Code:
getPlayerStorageValue(cid, mystorage)
-- or
getGlobalStorageValue(key)
You are retrieving the value stored in the database that is associated with this number.

I hope that helps :)
 
Status
Not open for further replies.
Back
Top