• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lua Magic wall

Sigoles

Discord: @sigoles
Joined
Nov 20, 2015
Messages
1,209
Solutions
2
Reaction score
154
I wanted to get the name of who attacked while giving magicwall look. tried:

LUA:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)
combat:setParameter(COMBAT_PARAM_CREATEITEM, ITEM_MAGICWALL)
combat:setDescription(string.format("Rune thrown by:", creature:getName()))

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

tfs 1.2
 
Wouldn't you just move it inside the onCastSpell, so it knows what creature is?
Maybe I'm under thinking this though..

LUA:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)
combat:setParameter(COMBAT_PARAM_CREATEITEM, ITEM_MAGICWALL)

function onCastSpell(creature, variant, isHotkey)
    combat:setDescription(string.format("Rune thrown by:", creature:getName()))
    return combat:execute(creature, variant)
end
 
Wouldn't you just move it inside the onCastSpell, so it knows what creature is?
Maybe I'm under thinking this though..

LUA:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)
combat:setParameter(COMBAT_PARAM_CREATEITEM, ITEM_MAGICWALL)

function onCastSpell(creature, variant, isHotkey)
    combat:setDescription(string.format("Rune thrown by:", creature:getName()))
    return combat:execute(creature, variant)
end

we got an error:

attempt to call method 'setDescription' (a nil value)
 
Back
Top