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

[Spell] Remove Creature

Beto06

Legendary OT User
Joined
Jun 18, 2011
Messages
770
Solutions
4
Reaction score
1,003
Location
Brazil
Hello... Now, how can I make a function that removes all the Wolves (normal and summon) in a area (around the caster of the spell) and then do a buff (if don't have any Wolf, then return false). Here is the buff:
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, FALSE)

local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_SUBID, 1)
setConditionParam(condition, CONDITION_PARAM_BUFF, TRUE)
setConditionParam(condition, CONDITION_PARAM_TICKS, 1 * 60 * 1000)
setConditionParam(condition, CONDITION_PARAM_SKILL_SHIELD, 10)

local combat2 = createCombatObject()
setCombatParam(combat2, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
setCombatParam(combat2, COMBAT_PARAM_AGGRESSIVE, FALSE)

local condition2 = createConditionObject(CONDITION_REGENERATION)
setConditionParam(condition2, CONDITION_PARAM_SUBID, 2)
setConditionParam(condition2, CONDITION_PARAM_BUFF, TRUE)
setConditionParam(condition2, CONDITION_PARAM_TICKS, 1 * 60 * 1000)
setConditionParam(condition2, CONDITION_PARAM_HEALTHGAIN, 10)
setConditionParam(condition2, CONDITION_PARAM_HEALTHTICKS, 4000)

local combat3 = createCombatObject()
setCombatParam(combat3, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
setCombatParam(combat3, COMBAT_PARAM_AGGRESSIVE, FALSE)

local condition3 = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition3, CONDITION_PARAM_SUBID, 3)
setConditionParam(condition3, CONDITION_PARAM_BUFF, TRUE)
setConditionParam(condition3, CONDITION_PARAM_TICKS, 1 * 60 * 1000)
setConditionParam(condition3, CONDITION_PARAM_STAT_MAGICLEVEL, -10)

function onCastSpell(cid, var, param)
if doPlayerRemoveItem(cid, 10926, 1) == TRUE then
doPlayerAddItem(cid, 7488, 1)
pot_count = getPlayerItemCount(cid, 7488) 
doPlayerRemoveItem(cid, 7488, pot_count) 
doPlayerAddItem(cid, 7488, pot_count) 
doCombat(cid, combat, var)
else
doPlayerSendCancel(cid, "Sorry, you need a flask of mind control.")
return FALSE
end

doSetCreatureOutfit(cid,{lookType = 308, lookHead = getCreatureOutfit(cid).lookHead, lookBody = getCreatureOutfit(cid).lookBody, lookLegs = getCreatureOutfit(cid).lookLegs, lookFeet = getCreatureOutfit(cid).lookFeet, lookAddons = getCreatureOutfit(cid).lookAddons},1 * 60 * 1000)
doAddCondition(cid, condition)
doAddCondition(cid, condition2)
doAddCondition(cid, condition3)
return TRUE
end
Thanks :blink:
 
Last edited:
Try this, but i don't test this script:
PHP:
function doRemoveCreaturesInArea(creature, fromposition, toposition)
    -- This script in not multiplatform (z == z!)
    local wolfs = 0
    for zx = fromposition.x, toposition.x do
        for zy = fromposition.y, toposition.y do
            local target = getTopCreature({x = zx, y = zy, fromposition.z}).uid
            if (isCreature(target) and getCreatureName(target)) then
                wolfs = wolfs + 1
                doRemoveCreature(target)
            end
        end
    end
    return (wolfs > 0)
end

-- Usage:
-- doRemoveCreaturesInArea("Wolf", {x = 0, y = 0, z = 0}, {x = 0, y = 0, z = 0})
 
Well, I don't mean to remove monster in x or y position, I mean to remove around the caster of the spell...
Anyway, thanks.
 
http://otland.net/f132/spell-remove-creature-133701/index2.html#post1300259

and

Lua:
local p = getThingPos(cid)
doRemoveCreaturesInArea("Wolf", {x = p.x - 2, y = p.y + 2, z = p.z}, {x = p.x + 2, y = p.y - 2, z = p.z})




or



Lua:
function doSendMagicEffectInArea(pos, effect, area, monsterName) -- Function by mock
	local centro = {}
	centro.y = math.floor(table.getn(area)/2)+1
	for y = 1, table.getn(area) do
		for x = 1, table.getn(area[y]) do
			if area[y][x] > 0 then
				centro.x = math.floor(table.getn(area[y])/2)+1
				doSendMagicEffect({x = pos.x + x - centro.x, y = pos.y + y - centro.y, z = pos.z}, effect or 0)
				
				local target = getTopCreature({x = pos.x + x - centro.x, y = pos.y + y - centro.y, z = pos.z}).uid
				if isMonster(target) then
					if getCreatureName(target) == monsterName then
						doRemoveCreature(target)
					end
				end
			end
		end
	end
	return true
end

usage:

Lua:
local area = {
	{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
	{0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0},
	{0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0},
	{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
	{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
	{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
	{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
	{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
	{0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0},
	{0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0},
	{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0}
}

doSendMagicEffectInArea(getThingPos(cid), 5, area, "Wolf")
 
Back
Top