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

Lua Stun spell problem

Fresh

Quack!
Joined
Oct 21, 2009
Messages
1,838
Solutions
18
Reaction score
617
Location
Poland
Hello
I've got that spell:
Lua:
function onCastSpell(cid, var)
	local pos = getPosByDir(getCreaturePosition(cid), getCreatureLookDirection(cid), 1)
	pos.stackpos = 253
	
	if isPlayer(getThingFromPos(pos).uid) then
		doCreatureSetNoMove(getThingFromPos(pos).uid, true)
		addEvent(doCreatureSetNoMove, 2000, getThingFromPos(pos).uid, false)
	end
	return true
end

The stun is working good - the 2 seconds not move
But i need to add that things:
- If player/monster have stun he got on self animation id: 31 per second;
- If player/monster is stunned, he cant cast spell (exhaustion);
- If stun going down (time is out) opponent got paralyze for 2 seconds;
 
there is other way to do that, in c++ source... try looking the poison effect
but there is a easyer way, just by .lua... Try something like this:
Lua:
local paral= createConditionObject(CONDITION_PARALYZE)
setConditionParam(paral, CONDITION_PARAM_TICKS, 5000)
setConditionFormula(paral, -0.6, -56, -0.6, -56)

local mut= createConditionObject(CONDITION_MUTED)
setConditionParam(mut, CONDITION_PARAM_TICKS, 2000)

function onCastSpell(cid, var)
	local pos = getPosByDir(getCreaturePosition(cid), getCreatureLookDirection(cid), 1)
	pos.stackpos = 253

    if isPlayer(getThingFromPos(pos).uid) then
      local stuntarg = getThingFromPos(pos).uid
      doSendMagicEffect(getCreaturePosition(stuntarg),31)
      addEvent(doSendMagicEffect,1000,getCreaturePosition(stuntarg),31)
      addEvent(doSendMagicEffect,2000,getCreaturePosition(stuntarg),31)
      doCreatureSetNoMove(getThingFromPos(pos).uid, true)
      addEvent(doCreatureSetNoMove, 2000, stuntarg, false)
      doAddCondition(target, mut)
      doAddCondition(target, paral)
    end
    return true
end

I didn't test it...
-stuned and muted for 2 sec
-paralyzed for 5 sec
 
Last edited:
yes, you need CONDITION_PACIFIED and/or CONDITION_EXHAUST with subid EXHAUST_COMBAT (for offensive spells) to prevent that
 
Back
Top