• 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+ Name player in Magic Wall - Wild Growth Rune and Firebomb

muchppl1x

New Member
Joined
Apr 4, 2020
Messages
22
Reaction score
1
I use base OTSERVER-BR GLOBAL version: 12.61
TFS 1.3

I need to put name of who played the magic wall, wild growth rune and fire bomb

If player look magic wall appear Casted by name player
If player look fire bomb appear Casted by name player
If player look wild growth rune appear Casted by name player
( After thrown and not in the rune obviously )


Magic Wall.lua
local combat = Combat()
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)

function onCreateMagicWall(creature, tile)
local item = Game.createItem(Game.getWorldType() == WORLD_TYPE_NO_PVP and ITEM_MAGICWALL_SAFE or ITEM_MAGICWALL, 1, tile)
item:setAttribute(ITEM_ATTRIBUTE_DURATION, math.random(14000, 20000))
end

combat:setCallback(CALLBACK_PARAM_TARGETTILE, "onCreateMagicWall")

local spell = Spell("rune")
function spell.onCastSpell(creature, variant, isHotkey)
return combat:execute(creature, variant)
end


spell:name("Magic Wall Rune")
spell:group("attack")
spell:id(86)
spell:cooldown(1 * 1500)
spell:groupCooldown(1 * 1500)
spell:level(32)
spell:magicLevel(9)
spell:runeId(2293)
spell:charges(3)
spell:isBlocking(true, true)
spell:allowFarUse(true)
spell:register()

Fire Bomb.lua
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITBYFIRE)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)
combat:setParameter(COMBAT_PARAM_CREATEITEM, ITEM_FIREFIELD_PVP_FULL)
combat:setArea(createCombatArea(AREA_SQUARE1X1))

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

Wild Growth Rune.lua
local combat = Combat()
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_EARTH)

function onCreateMagicWall(creature, tile)
local item = Game.createItem(Game.getWorldType() == WORLD_TYPE_NO_PVP and ITEM_WILDGROWTH_SAFE or ITEM_WILDGROWTH, 1, tile)
item:setAttribute(ITEM_ATTRIBUTE_DURATION, math.random(38000, 45000))
end

combat:setCallback(CALLBACK_PARAM_TARGETTILE, "onCreateMagicWall")

local spell = Spell("rune")
function spell.onCastSpell(creature, variant, isHotkey)
return combat:execute(creature, variant)
end

spell:name("Wild Growth Rune")
spell:group("attack")
spell:id(94)
spell:cooldown(1 * 1000)
spell:groupCooldown(1 * 1000)
spell:level(27)
spell:magicLevel(8)
spell:runeId(2269)
spell:charges(2)
spell:isBlocking(true, true)
spell:allowFarUse(true)
spell:vocation("druid;true", "elder druid")
spell:register()


I got it from Magic Wall alone .. for those who want to follow the code:

local combat = Combat()
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)

function onCreateMagicWall(creature, tile)
local item = Game.createItem(Game.getWorldType() == WORLD_TYPE_NO_PVP and ITEM_MAGICWALL_SAFE or ITEM_MAGICWALL, 1, tile)
item:setAttribute(ITEM_ATTRIBUTE_DURATION, math.random(14000, 20000))
end

combat:setCallback(CALLBACK_PARAM_TARGETTILE, "onCreateMagicWall")

local spell = Spell("rune")
function spell.onCastSpell(creature, variant, isHotkey)
local mwItem = Game.createItem(1497, 1, variant:getPosition())
if mwItem then
mwItem:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, "Casted by " ..creature:getName())
mwItem:decay()
end
return combat:execute(creature, variant)
end


spell:name("Magic Wall Rune")
spell:group("attack")
spell:id(86)
spell:cooldown(1 * 1500)
spell:groupCooldown(1 * 1500)
spell:level(32)
spell:magicLevel(9)
spell:runeId(2293)
spell:charges(3)
spell:isBlocking(true, true)
spell:allowFarUse(true)
spell:register()
 
Last edited:
Yes, you need to recompile
Bro.. i recompile and work all runes except wild growth rune

If i look wild growth i receive this: You see a rush wood.

@All

Yes i know to add attribute description tag in items.xml but no work too.

/// Edit:

<item id="1499" article="a" name="rush wood">
<attribute key="type" value="magicfield" />
<attribute key="decayTo" value="0" />
<attribute key="duration" value="45" />
<attribute key="blocking" value="1" />

Change items.xml description:

<item id="1499" article="a" name="rush wood">
<attribute key="type" value="magicfield" />
<attribute key="decayTo" value="0" />
<attribute key="description" value="By: |PLAYERNAME|."/>
<attribute key="duration" value="45" />
<attribute key="blocking" value="1" />

No work too.

Look after change is:

You see a rush wood.
By: |PLAYERNAME|.

( not correct name player , no capture )
 
Last edited:
You can use the onLook event and use the ITEM_ATTRIBUTE_OWNER attribute

real example:
Lua:
-- Default look
        description = description .. thing:getDescription(distance)
        if thing:getType():getType() == ITEM_TYPE_MAGICFIELD then
            local owner = Player(thing:getAttribute(ITEM_ATTRIBUTE_OWNER))
            if owner then
                description = description .. "\nCasted by " .. owner:getName()
            end
        end
 
show us your wild growth rune script
Here \/
local combat = Combat()
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_EARTH)

function onCreateMagicWall(creature, tile)
local item = Game.createItem(Game.getWorldType() == WORLD_TYPE_NO_PVP and ITEM_WILDGROWTH_SAFE or ITEM_WILDGROWTH, 1, tile)
item:setAttribute(ITEM_ATTRIBUTE_DURATION, math.random(38000, 45000))
end

combat:setCallback(CALLBACK_PARAM_TARGETTILE, "onCreateMagicWall")

local spell = Spell("rune")
function spell.onCastSpell(creature, variant, isHotkey)
return combat:execute(creature, variant)
end

spell:name("Wild Growth Rune")
spell:group("attack")
spell:id(94)
spell:cooldown(1 * 1000)
spell:groupCooldown(1 * 1000)
spell:level(27)
spell:magicLevel(8)
spell:runeId(2269)
spell:charges(2)
spell:isBlocking(true, true)
spell:allowFarUse(true)
spell:vocation("druid;true", "elder druid")
spell:register()
 
Back
Top