• 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
Premium User
Joined
Nov 17, 2010
Messages
6,756
Solutions
578
Reaction score
5,305
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:
thanks a lot bro @Xikini
i'll be waiting <3
I did a quick update on this old old script to make it easy to install.
If for whatever reason it doesn't work, I'm posting the unedited version of the working script as well.
Lua:
function onOutfit(cid, old, current)
   local mount_not_allowed = false
   if current.lookMount > 0 and current.lookType == 127 then
       mount_not_allowed = true
   end
   if current.lookMount > 0 and current.lookType == 126 then
       mount_not_allowed = true
   end
   if current.lookMount > 0 and current.lookType == 75 then
       mount_not_allowed = true
   end
   if mount_not_allowed == true then
       current.lookMount = 0
       doPlayerSetMounted(cid, false)
       doCreatureChangeOutfit(cid, current)
       doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "Mount disabled on this outfit.")
   end
   return true
end

I honestly doubt you'll have any issues though.

creaturescripts.xml
XML:
<event type="outfit" name="outfit_check" event="script" value="outfit_check.lua"/>
login.lua
Lua:
registerCreatureEvent(cid, "outfit_check")
outfit_check.lua
Lua:
local outfit_ids = {387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410}

function onOutfit(cid, old, current)
   local mount_not_allowed = false
   if current.lookMount > 0 then
       for i = 1, #outfit_ids do
           if current.lookType == outfit_ids[i] then
               mount_not_allowed = true
               break
           end
       end
   end
   if mount_not_allowed == true then
       current.lookMount = 0
       doPlayerSetMounted(cid, false)
       doCreatureChangeOutfit(cid, current)
       doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "Mount disabled on this outfit.")
   end
   return true
end
 
none of both scripts are working @Xikini i tried with looktype ids and just outfits ids
i can use mount with any problem :/ do you have others scripts to tests?
 
none of both scripts are working @Xikini i tried with looktype ids and just outfits ids
i can use mount with any problem :/ do you have others scripts to tests?
nope.
Dunno buddy. Works on my 0.3.7 test server :/
 
Hello Xikini, I have a question, I was looking on a server TFS1.2, but I can't understand at 100% this lines, can you explain me that?...
The thing I can't understand are marked on red:


local outfit = player:getSex() == PLAYERSEX_FEMALE and v["female"] or v["male"]


Long time ago, we are using many lines:
local sex = player:getSex()
if sex == 0 then
doSomethingFemale()
elseif sex == 1 then
doSomethingMale()
end

I know that lines are more short, but I cant understand how it work.
Thank you very much... Regards.
 
Hello Xikini, I have a question, I was looking on a server TFS1.2, but I can't understand at 100% this lines, can you explain me that?...
The thing I can't understand are marked on red:

local outfit = player:getSex() == PLAYERSEX_FEMALE and v["female"] or v["male"]

Long time ago, we are using many lines:
local sex = player:getSex()
if sex == 0 then
doSomethingFemale()
elseif sex == 1 then
doSomethingMale()
end

I know that lines are more short, but I cant understand how it work.
Thank you very much... Regards.
this would have been better in it's own support thread, instead of a request thread (especially since it's not for tfs 1.2)
Lua:
local var = (condition) and (value here to use if condition is true) or (another value here if condition is false)
it's just a shorter way of writing an if statement called ternary operation. here's how that would look if it were an if statement:
Lua:
local var = nil
if player:getSex() == PLAYERSEX_FEMALE then
    var = v["female"]
else
    var = v["male"]
end
Ternary operation - Wikipedia
 
Haail, can help-me do a script? I will send some informations:

Example: The player can destroy or build using the command to create items and destroy obstacles, however ... he will only be able to do this in the area that is in the script, otherwise he can destroy or build everything on the server, and also ... it can only create for example ... item id 1111 (wall-example)

We need an action event to destroy - such as command i guess, yep? exampe: /itemg (itemguild) will create an item, as /item
We need an action event to build - such as command i guess, yep? /rg (removeguild) will destroy an item/object as /r


Code:
doCreateItem(id, amount, position)
doRemoveItem(uid, true)
doRemoveItem(itemEx.uid, true)
isInRange(playerpos, fromPos, toPos)
alloweditems = {id1,  id2, id3, ...}
isInArray(array, value)
 
Last edited:
could you share your server sources bro? its a 8.7? regards
9.6 I think. and no I don't have the sources, I just work on the server. :/
Haail, can help-me do a script? I will send some informations:

Example: The player can destroy or build using the command to create items and destroy obstacles, however ... he will only be able to do this in the area that is in the script, otherwise he can destroy or build everything on the server, and also ... it can only create for example ... item id 1111 (wall-example)

We need an action event to destroy - such as command i guess, yep? exampe: /itemg (itemguild)
We need an action event to build - such as command i guess, yep? /rg (removeguild)


Code:
Creating item:
Code (Lua):
[LIST=1]
[*]doCreateItem(id, amount, position)
[/LIST]
Removing item by stored uid:
Code (Lua):
[LIST=1]
[*]doRemoveItem(uid, true)
[/LIST]
Removing item by target crosshair:
Code (Lua):
[LIST=1]
[*]doRemoveItem(itemEx.uid, true)
[/LIST]
Checking if player is in an area:
Code (Text):
[LIST=1]
[*]isInRange(playerpos, fromPos, toPos)
[/LIST]
Creating an array:
Code (Lua):
[LIST=1]
[*]alloweditems = {id1,  id2, id3, ...}
[/LIST]
Checking if some value is in an array:
Code (Lua):
[LIST=1]
[*]isInArray(array, value)
[/LIST]
This is much too advanced for me.
The create items allowed from list and player within xyz, I could do.. but the remove items thing.. yeah definitely not.
Also, if they created items too quickly, the player would be muted by the server for ages and ages. xD
 
TFS 0.4 (8.60)

Hello, you can make an invasion script by Globalevents, which every 1 hour spawns a monster, but I want the case to happen again, the previous beast disappear, in case no one kills him., to prevent it from being born several invasions in the same place
 
TFS 0.4 (8.60)

Hello, you can make an invasion script by Globalevents, which every 1 hour spawns a monster, but I want the case to happen again, the previous beast disappear, in case no one kills him., to prevent it from being born several invasions in the same place
You'll have to test for me, but I think this will work as intended.
(edit: Interval on 0.4 might be in seconds instead of milliseconds. Adjust as required.)
Lua:
--[[
<globalevent name="xikini_spawn_monsters_interval" interval="3600000" event="script" value="xikini_spawn_monsters.lua"/>
<globalevent name="xikini_spawn_monsters_startup" type="startup" event="script" value="xikini_spawn_monsters.lua"/>
]]--

xikini_monsters = {} -- global table

local spawning_config = {
    {"cyclops", {x = 1000, y = 1000, z = 7}},
    {"rotworm", {x = 1000, y = 1000, z = 7}},
    {"island troll", {x = 1000, y = 1000, z = 7}}
}

--[[  the onStartup function might not be required.
function onStartup()
    for i = 1, #spawning_config do
        xikini_monsters[i] = 0
    end
    return true
end
]]--

function onThink()
    for i = 1, #spawning_config do
        if not isMonster(xikini_monsters[i]) then
            xikini_monsters[i] = doCreateMonster(spawning_config[i][1]:lower(), spawning_config[i][2])
        end
    end
    return true
end
 
Last edited:
My request is this, see if you can make, ok?

One item called "Seed of the God's", ID: XXXX.

Duration of effect: 30s.


1 - When the player use this item(onUse), he can become 3 different "gods" with differents storages (RANDOM).
Each "god" have different outfits,
Ex:
God1 = Looktype 73,
God2 = Looktype 110,
God3 = Looktype 194.
AND DIFFERENT ATTRIBUTES BONUS.
God1 receive more speed,
God2 is immune against death damage,
God3 is immune against physical damage.

I think these immunities (death and physical damage) can be made by check storage in creaturescripts.)

Common for the 3 Gods:

Healing Mana = 15%
Healing Hp = 20%
Interval for healing HP/MP = 2seconds.

It would be possible? it's an idea I had recently, if you can, it will help the community and me too.

Thank you @Xikini, hugs!!
try this. (untested)

-- small edit made to script on line 29
XML:
<action itemid="111111111" event="script" value="xikini_buff_character.lua"/>
Lua:
local timer = 30 -- seconds
local config = {
   {storage = 45001, speed_percent = 30, outfit = 73, health_percent_recovery = 20, mana_percent_recovery = 15},
   {storage = 45002, speed_percent = 0, outfit = 110, health_percent_recovery = 20, mana_percent_recovery = 15},
   {storage = 45003, speed_percent = 0, outfit = 194, health_percent_recovery = 20, mana_percent_recovery = 15}
}

local function isPlayerBuffed(cid)
   for i = 1, #config do
       if getPlayerStorageValue(cid, config[i].storage) == 1 then
           return true
       end
   end
    return false
end

local function resetPlayerSpeed(cid, speed)
   if not isPlayer(cid) then
       return true
   end
   doChangeSpeed(cid, speed)
   return true
end

local function resetStorage(cid, storage)
   if not isPlayer(cid) then
       return true
   end
   setPlayerStorageValue(cid, storage, 0)
   return true
end

local function recovery(cid, health, mana, duration)
   if not isPlayer(cid) then
       return true
   end
 
   local cur_health = getCreatureHealth(cid)
   local max_health = getCreatureMaxHealth(cid)
   if cur_health < max_health then
       local add_health = health
       if cur_health + health > max_health then
           add_health = max_health - cur_health
       end
       doCreatureAddHealth(cid, add_health)
   end
 
   local cur_mana = getCreatureMana(cid)
   local max_mana = getCreatureMaxMana(cid)
   if cur_mana < max_mana then
       local add_mana = mana
       if cur_mana + mana > max_mana then
           add_mana = max_mana - cur_mana
       end
       doCreatureAddMana(cid, add_mana)
   end
 
   if duration >= 1 then
       addEvent(recovery, 2000, cid, health, mana, duration - 1)
   end
   return true
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
   if isPlayerBuffed(cid) == true then
       doSendMagicEffect(fromPosition, CONST_ME_POFF)
       doPlayerSendCancel(cid, "Sorry not possible. Already buffed with this item.")
       return true
   end
 
   local rand = math.random(#config)
   local index = config[rand]
   local health = getCreatureMaxHealth(cid) / 100 * index.health_percent_recovery
   local mana = getCreatureMaxMana(cid) / 100 * index.mana_percent_recovery
 
   if index.speed_percent > 0 then
       local speed = getCreatureSpeed(cid) / 100 * index.speed_percent
       doChangeSpeed(cid, speed)
       addEvent(resetPlayerSpeed, timer * 1000, cid, -speed)
   end
   setPlayerStorageValue(cid, index.storage, 1)
   addEvent(resetStorage, timer * 1000, cid, index.storage)
   doSetCreatureOutfit(cid, {lookType = index.outfit}, timer * 1000)
   addEvent(recovery, 0, cid, health, mana, timer / 2 + 1)
   doRemoveItem(item.uid, 1)
 
   return true
end

XML:
<event type="statschange" name="xikini_deny_damage" event="script" value="xikini_deny_damage.lua"/>
<event type="login" name="xikini_reset_deny_damage" event="script" value="xikini_reset_deny_damage.lua"/>
Lua:
registerCreatureEvent(cid, "xikini_deny_damage")
registerCreatureEvent(cid, "xikini_reset_deny_damage")
Lua:
local config = {
   {COMBAT_DEATHDAMAGE, 45002},
   {COMBAT_PHYSICALDAMAGE, 45003}
}

function onStatsChange(cid, attacker, type, combat, value)
   if type == STATSCHANGE_HEALTHLOSS or type == STATSCHANGE_MANALOSS and cid ~= attacker then
       for i = 1, #config do
           if combat == config[i][1] and getPlayerStorageValue(cid, config[i][2]) == 1 then
               return false
           end
       end
   end 
   return true
end
Lua:
local storages = {45001, 45002, 45003}

function onLogin(cid)
   for i = 1, #storage do
       if getPlayerStorageValue(cid, storage[i]) == 1 then
           setPlayerStorageValue(cid, storage[i], 0)
       end
   end
   return true
end
 
Last edited:
@Xikini, thank you for reply.
When i starts the server, no errors.
If i use the item, return this error in console:
Code:
[1:44:46.869] [Error - Action Interface]
[1:44:46.869] data/actions/scripts/xikini_buff_character.lua:onUse
[1:44:46.869] Description:
[1:44:46.869] data/actions/scripts/xikini_buff_character.lua:72: attempt to call upvalue 'config' (a table value)
[1:44:46.869] stack traceback:
[1:44:46.869]   data/actions/scripts/xikini_buff_character.lua:72: in function <data/actions/scripts/xikini_buff_character.lua:64>
recopy that script and try again. I beleive I fixed the issue.
 
Status
Not open for further replies.

Similar threads

Back
Top