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

[TFS 1.x] Free Scripting and Support

RazorBlade

Retired Snek
Joined
Nov 7, 2009
Messages
2,015
Solutions
3
Reaction score
629
Location
Canada
Until further notice, I will not be taking any further requests, and any incomplete requests will be put on hold. Due to serious medical concerns with some of my pets, I will not be actively using the forums or doing any scripting. Sorry for the inconvenience.





Well hello everyone. This seems to be a popular trend lately, and I basically already do it anyways. So why not, right?

I'm here to offer my scripting services and/or support, free of charge. I will make basic-medium scripts/systems for free. I may do large and more advanced systems as well, depending on how busy I am.

I support only LUA at this time. My PHP and C++ are both a little rusty.

I also offer support and bugfixing for existing scripts. I accept requests here or via PM and nothing will be released unless you agree to it.

I only support TFS 1.x and 1.1 or higher is preferred.

I'm not looking to reinvent the wheel. If the system you're requesting is already in existence and easily accessible, I won't make it. I can maybe make modifications to it, but that all depends on what you need.

Want to see some of my work? Check my signature.

First come, first served. I will not accept payment for priority service.

Want to thank me? Toss me a like on the post that helped you, and feel free to recommend me to your friends if you found my service to be fast and accurate to your request.

Have at it! :D
 
Last edited:
Could you create a knight spell that heals the caster for a % (configurable) of the damage? Say I have a pvp situation and a mage throws an sd at a knight with the spell on, the sd does 400 dmg but the knight gets healed 100 for example.

Sorry if it's not clear enough, I'm mashing up ideas for my server.
 
I can recommend RazorBlade as great support and a great scripter, helped me fix a problem in 15 minutes that I tried to fix for 4 hours.
(I linked this thread in my signature just because you made my day)
 
Could you create a knight spell that heals the caster for a % (configurable) of the damage? Say I have a pvp situation and a mage throws an sd at a knight with the spell on, the sd does 400 dmg but the knight gets healed 100 for example.

Sorry if it's not clear enough, I'm mashing up ideas for my server.
couldn't you just reduce the damage by 25%? :3
but of course it's possible. in fact, I basically already have a system that's like that.

https://otland.net/threads/tfs-1-2-conditions-resist-absorb-reflect-deflect.233406/

and for the spell you would just use something like this:
Code:
local t = 60 * 1000 -- length of time for effect
local v = 10 -- percentage of damage to resist


local combat = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)

local resist = Condition(CONDITION_ATTRIBUTES)
resist:setParameter(CONDITION_PARAM_BUFF_SPELL, 1)
resist:setParameter(CONDITION_PARAM_SUBID, 108) -- set subid as per main script to achieve desired effect
resist:setParameter(CONDITION_PARAM_TICKS, t)
player:setStorageValue(5, v)
combat:setCondition(resist)

function onCastSpell(creature, var)
return combat:execute(creature, var)
end

If this isn't quite what you're looking for, I can make something a little more specialized for you. The absorb effect in this script does almost what you want. it reduces damage by x% then heals the target that amount. It could be modified to take full damage and then heal them if that's what you want specifically.
 
Both pvp and pve.

I'd also like to ask for a spell collision system, but that might be too advanced and difficult, what it is is basically if 2 sorecerers for example cast exori mort at each other, theirs spells can collide and no damage is done to them but damage is done to the area in which they collided.
 
first one:
creaturescripts.xml
Code:
<event type="healthchange" name="resist" script="resist.lua" />

resist.lua:
to allow pve and pvp, just set pvpOnly to false at the top there.
Code:
local subId = 150
local pvpOnly = true

function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
    local player = Player(creature)
    if not player then
        return primaryDamage, primaryType, secondaryDamage, secondaryType
    end
    if primaryType == COMBAT_HEALING then
        return primaryDamage, primaryType, secondaryDamage, secondaryType
    end
    if pvpOnly then
        if not attacker or (attacker and not Player(attacker)) then
            return primaryDamage, primaryType, secondaryDamage, secondaryType
        end
    end
    if player:getCondition(CONDITION_ATTRIBUTES, CONDITIONID_COMBAT, subId) then
        local a = math.floor(primaryDamage * (creature:getStorageValue(5) / 100))
        creature:addHealth(a)
    end
    if primaryDamage == 0 and secondaryDamage == 0 then
        creature:getPosition():sendMagicEffect(CONST_ME_POFF)
    end
    return primaryDamage, primaryType, secondaryDamage, secondaryType
end

spell example:
Code:
local t = 60 * 1000 -- length of time for effect
local v = 10 -- percentage of damage to resist


local combat = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)

local resist = Condition(CONDITION_ATTRIBUTES)
resist:setParameter(CONDITION_PARAM_BUFF_SPELL, 1)
resist:setParameter(CONDITION_PARAM_SUBID, 150) -- don't change
resist:setParameter(CONDITION_PARAM_TICKS, t)
player:setStorageValue(5, v) -- you can change the 5, but make sure you change it in the creaturescript as well. It is the storage used to store the player's resist value.
combat:setCondition(resist)

function onCastSpell(creature, var)
    return combat:execute(creature, var)
end


As for the spell collision thing, i don't think it's possible. I don't think the spells can be blocked once cast unless they hit blocking objects like walls. If it is possible, I think it would likely require some pretty heavy source edits to allow spell areas to detect each other.
 
First of all, Thank you very much!!

In regards to the collision system, I used it on an old server I had, it was naruto themed and the jutsus could cancel each other out, it was a 0.3.6 server, here are the sources of it, maybe it can be upgraded to 1.1+?

Here's a video of it:

In the Data folder, create colisionLIB.lua:
Code:
function checkColision(cid)   -- Function by Ramza (Ricardo Ianelli)
  if getCreatureTarget(cid) ~= 0 then
     setPlayerStorageValue(cid, 9001, 'casting')
     local ppos, enemy = getCreaturePosition(cid), getCreatureTarget(cid)
     local epos = getCreaturePosition(enemy)

     if getPlayerStorageValue(enemy, 9001) == 'casting' and getCreatureTarget(enemy) == cid then
        setPlayerStorageValue(enemy, 9001, 'colision')
        setPlayerStorageValue(cid, 9001, 'colision')
        if ppos.x > epos.x and ppos.y > epos.y then
           cpos = {x = ppos.x - ((ppos.x - epos.x) / 2), y = ppos.y - ((ppos.y - epos.y) / 2), z = ppos.z}
        elseif ppos.x > epos.x and ppos.y < epos.y then
           cpos = {x = ppos.x - ((ppos.x - epos.x) / 2), y = epos.y - ((epos.y - ppos.y) / 2), z = ppos.z}
        elseif ppos.x < epos.x and ppos.y < epos.y then
           cpos = {x = epos.x - ((epos.x - ppos.x) / 2), y = epos.y - ((epos.y - ppos.y) / 2), z = ppos.z}
        elseif ppos.x < epos.x and ppos.y > epos.y then
           cpos = {x = epos.x - ((epos.x - ppos.x) / 2), y = ppos.y - ((ppos.y - epos.y) / 2), z = ppos.z}
        end
    
        doSendDistanceShoot(ppos, cpos, CONST_ANI_ENERGY)
        doSendDistanceShoot(epos, cpos, CONST_ANI_ENERGYBALL)
      
        local value = math.random(1, 3)
        doSendMagicEffect(cpos, 27+value)            
        return true
     else
        return false
     end
  end

end

Now altering energy strike spell to work with the system:
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_ENERGYAREA)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -1, -10, -1, -20, 5, 5, 1.4, 2.1)

local function spell(cid, var)
  if getPlayerStorageValue(cid, 9001) ~= 'colision' then
     doCreatureSay(cid, 'Strike!', TALKTYPE_ORANGE_1)
     setPlayerStorageValue(cid, 9001, nil)
     return doCombat(cid, combat, var)
  end
end

function onCastSpell(cid, var)
    checkColision(cid)
    doCreatureSay(cid, 'Energy...', TALKTYPE_ORANGE_1)
    addEvent(spell, 2000, cid, var)
end

In comparison, here's the normal energy strike:

Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_ENERGYAREA)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -1, -10, -1, -20, 5, 5, 1.4, 2.1)

function onCastSpell(cid, var)
    return doCombat(cid, combat, var)
end


So, any way of upgrading this script?
 
well, I've modified it to fit the standards of tfs 1.x, but I can't guarantee it'll work @luigilc
Code:
function checkCollision(creature)   -- Function by Ramza (Ricardo Ianelli)
    local player = Player(creature)
    if not player then
        return false
    end
    if creature:getTarget() then
        player:setStorageValue(9001, 2) -- casting
        local ppos, enemy = player:getPosition(), Player(creature:getTarget())
        local epos = enemy:getPosition()
        if not enemy then
            return false
        end
        if enemy:getStorageValue(9001) == 2 and enemy:getTarget() == player then
            enemy:setStorageValue(9001, 1) -- collision
            player:setStorageValue(9001, 1) -- collision
            if ppos.x > epos.x and ppos.y > epos.y then
              cpos = {x = ppos.x - ((ppos.x - epos.x) / 2), y = ppos.y - ((ppos.y - epos.y) / 2), z = ppos.z}
            elseif ppos.x > epos.x and ppos.y < epos.y then
              cpos = {x = ppos.x - ((ppos.x - epos.x) / 2), y = epos.y - ((epos.y - ppos.y) / 2), z = ppos.z}
            elseif ppos.x < epos.x and ppos.y < epos.y then
              cpos = {x = epos.x - ((epos.x - ppos.x) / 2), y = epos.y - ((epos.y - ppos.y) / 2), z = ppos.z}
            elseif ppos.x < epos.x and ppos.y > epos.y then
              cpos = {x = epos.x - ((epos.x - ppos.x) / 2), y = ppos.y - ((ppos.y - epos.y) / 2), z = ppos.z}
            end
   
            Position(ppos):sendDistanceEffect(cpos, CONST_ANI_ENERGY)
            Position(epos):sendDistanceEffect(cpos, CONST_ANI_ENERGYBALL)
     
            local value = math.random(1, 3)
            Position(cpos):sendMagicEffect(27+value)            
            return true
        else
            return false
        end
    end
end

Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ENERGYAREA)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)
combat:setFormula(COMBAT_FORMULA_LEVELMAGIC, -1, -10, -1, -20, 5, 5, 1.4, 2.1)

local function spell(creature, var)
    local player = Player(creature)
    if not player then
        return combat:execute(creature, var)
    end
  if player:getStorageValue(9001) ~= 1 then -- collision
     player:setStorageValue(9001, -1)
     return doCombat(cid, combat, var)
  end
end

function onCastSpell(creature, var)
    checkCollision(creature)
    addEvent(spell, 2000, creature, var)
end
 
nYoEzZf

https://imgur.com/nYoEzZf
I get that error using that collision system. I put the checkCollision function inside global.lua, that right?
 
Also:
slight change to the spell from the first request. forgot that player doesn't exist till I make it exist :3
Code:
local t = 1 * 60 * 1000 -- length of time for effect (1 minute)
local v = 10 -- percentage of damage to resist


local combat = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)

local resist = Condition(CONDITION_ATTRIBUTES)
resist:setParameter(CONDITION_PARAM_BUFF_SPELL, 1)
resist:setParameter(CONDITION_PARAM_SUBID, 108) -- resist all
resist:setParameter(CONDITION_PARAM_TICKS, t)
combat:setCondition(resist)

function onCastSpell(creature, var)
    local player = Player(creature)
    if not player then
        return combat:execute(creature, var)
    end
    player:setStorageValue(5,v)
    return combat:execute(creature, var)
end
 
nYoEzZf

https://imgur.com/nYoEzZf
I get that error using that collision system. I put the checkCollision function inside global.lua, that right?
EDIT:
Code:
local function spell(cid, var)
    local creature = Creature(cid)
    local player = Player(cid)
    if not player then
        return combat:execute(creature, var)
    end
  if player:getStorageValue(9001) ~= 1 then -- collision
     player:setStorageValue(9001, -1)
     return combat:execute(creature, var)
  end
end

function onCastSpell(cid, var)
    local creature = Creature(cid)
    checkCollision(creature)
    addEvent(spell, 2000, cid.uid, var)
end
Try that.
 
1. That's weird. The heal would come at the same time as the damage. Can you put "print(a)" just before creature:addHealth(a)?
2.
Code:
function checkCollision(creature)   -- Function by Ramza (Ricardo Ianelli)
    local player = Player(creature)
    if not player then
        return false
    end
    if creature:getTarget() then
        player:setStorageValue(9001, 2) -- casting
        local ppos, enemy = player:getPosition(), Player(creature:getTarget())
        if not enemy then
            return false
        end
        local epos = enemy:getPosition()
        if enemy:getStorageValue(9001) == 2 and enemy:getTarget() == player then
            enemy:setStorageValue(9001, 1) -- collision
            player:setStorageValue(9001, 1) -- collision
            if ppos.x > epos.x and ppos.y > epos.y then
              cpos = {x = ppos.x - ((ppos.x - epos.x) / 2), y = ppos.y - ((ppos.y - epos.y) / 2), z = ppos.z}
            elseif ppos.x > epos.x and ppos.y < epos.y then
              cpos = {x = ppos.x - ((ppos.x - epos.x) / 2), y = epos.y - ((epos.y - ppos.y) / 2), z = ppos.z}
            elseif ppos.x < epos.x and ppos.y < epos.y then
              cpos = {x = epos.x - ((epos.x - ppos.x) / 2), y = epos.y - ((epos.y - ppos.y) / 2), z = ppos.z}
            elseif ppos.x < epos.x and ppos.y > epos.y then
              cpos = {x = epos.x - ((epos.x - ppos.x) / 2), y = ppos.y - ((ppos.y - epos.y) / 2), z = ppos.z}
            end
   
            Position(ppos):sendDistanceEffect(cpos, CONST_ANI_ENERGY)
            Position(epos):sendDistanceEffect(cpos, CONST_ANI_ENERGYBALL)
     
            local value = math.random(1, 3)
            Position(cpos):sendMagicEffect(27+value)            
            return true
        else
            return false
        end
    end
end
 
combat should definitely exist. the spell looks like this?
Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ENERGYAREA)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)
combat:setFormula(COMBAT_FORMULA_LEVELMAGIC, -1, -10, -1, -20, 5, 5, 1.4, 2.1)

local function spell(cid, var)
local creature = Creature(cid)
local player = Player(cid)
if not player then
return combat:execute(creature, var)
end
if player:getStorageValue(9001) ~= 1 then -- collision
player:setStorageValue(9001, -1)
return combat:execute(creature, var)
end
end

function onCastSpell(cid, var)
local creature = Creature(cid)
checkCollision(creature)
addEvent(spell, 2000, cid.uid, var)
end
 
Oh I had a typo! The collision system works! the spells cancel each other out when they meet! amazing man thank you so so much!

The healing one isn't working though
 
Back
Top