• 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 | Medusa Stun Beam with AddEvent Warning

Fresh

Quack!
Joined
Oct 21, 2009
Messages
1,838
Solutions
18
Reaction score
617
Location
Poland
Hello there dear OTLanders!
Im looking for someone who can make simple spell for monster Medusa.
As everyone knows Medusa have ability to turn someone who is looking straight on her face into stone.
It's any possibility to make that spell on TFS 1.X with few addEvents into spell?
( Im weak on spell making - specially on AddEvents, so I decide to post this thread here. If anyone have time to help me I will be very thankful )

The spell should have two phases:
- One warning with simply appear effect X on monster (before casting the stun)
and after 2-3 seconds, something like that the next phase should:
- Wave in-front of Medusa and stun players on this beam for like 5 seconds (change outfit to X)

I can do other parts like no attacking while player is stunned by myself I only need monster spell with these 2 addEvents.

Anyone could help me?
Thanks in advance,
F.
 
( Im weak on spell making - specially on AddEvents, so I decide to post this thread here. If anyone have time to help me I will be very thankful )
Here is some info on addEvent
This is the basic structure of an addEvent.
addEvent(function name or anonymous function parentheses within those parentheses you can have parameters, execution time, arguments if any)
addEvent returns an event id that you can use with stopEvent() by passing it the eventId to you guessed it, stop the event.

An example of an addEvent using an anonymous function, its a function with no name you might have seen it, it takes this form. function() end
An example of defining one in addEvent
Lua:
local arguments = "addEvent"
local executionTime = 1000
addEvent(function(parameter) 
    print("Wow I just executed an " .. parameter .. "!")
    end,
    executionTime, arguments
)
Both parameters & arguments if you have more than 1 are separated by commas, the parameters of a function whether anonymous or predefined its scope is only local to that function definition and does not exist outside of the function, arguments are containers that may hold a value which can and will be passed to the parameters so that function can process the data.
 
Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_SMALLPLANTS)
combat:setArea(createCombatArea(AREA_SQUAREWAVE5))

local condition = Condition(CONDITION_PARALYZE)
condition:setParameter(CONDITION_PARAM_TICKS, 20 * 1000)
condition:setFormula(-0.45, 0, -0.5, 0) -- random values, adjust it yourself
combat:addCondition(condition)

local conditionOutfit = Condition(CONDITION_OUTFIT)
conditionOutfit:setParameter(CONDITION_PARAM_TICKS, 20 * 1000)
conditionOutfit:setOutfit(0, 35, 0, 0, 0, 0) -- 35 is looktype, find the stone one yourself
combat:addCondition(conditionOutfit)

local function spell(cid)
    local creature = Creature(cid)
    if not creature then
        return true
    end

    combat:execute(creature, Variant(creature:getPosition()))
    return true
end

function onCastSpell(creature, variant)
    creature:getPosition():sendMagicEffect(CONST_ME_BIGPLANTS)
    addEvent(spell, 3 * 1000, creature.uid)
    return true
end
 
Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_SMALLPLANTS)
combat:setArea(createCombatArea(AREA_SQUAREWAVE5))

local condition = Condition(CONDITION_PARALYZE)
condition:setParameter(CONDITION_PARAM_TICKS, 20 * 1000)
condition:setFormula(-0.45, 0, -0.5, 0) -- random values, adjust it yourself
combat:addCondition(condition)

local conditionOutfit = Condition(CONDITION_OUTFIT)
conditionOutfit:setParameter(CONDITION_PARAM_TICKS, 20 * 1000)
conditionOutfit:setOutfit(0, 35, 0, 0, 0, 0) -- 35 is looktype, find the stone one yourself
combat:addCondition(conditionOutfit)

local function spell(cid)
    local creature = Creature(cid)
    if not creature then
        return true
    end

    combat:execute(creature, Variant(creature:getPosition()))
    return true
end

function onCastSpell(creature, variant)
    creature:getPosition():sendMagicEffect(CONST_ME_BIGPLANTS)
    addEvent(spell, 3 * 1000, creature.uid)
    return true
end


Working but everytime no matter what i set in Monster.xml of this creature etc.
Always wave is going down from creature (not in all directions) no matter how monster stay and player, always wave is casting bottom. :/
I dont have idea how to fix it
 
Code:
<instant name="medusa wave" words="###x" direction="1" aggressive="1" blockwalls="1" needtarget="0" needlearn="1" script="monster/medusa wave.lua" />

look at direction parameter.
 
Code:
<instant name="medusa wave" words="###x" direction="1" aggressive="1" blockwalls="1" needtarget="0" needlearn="1" script="monster/medusa wave.lua" />

look at direction parameter.

Still not working. Always casting wave to the bottom. No matter if is direction in spells.xml, if i put lenght etc. in monster.xml. :(
 
See this code, its for 0.3.6..
Code:
        local d = getDistanceBetween(getThingPos(cid), topos)
        addEvent(function, d * 70 + 100 - (d * 14) , cid, function2, false, false, typeee)
 
Back
Top