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

Solved Can somone Fix this for me please?

Status
Not open for further replies.

Werewolf

Forbidden Ascension
Joined
Jul 15, 2012
Messages
886
Reaction score
123
Code:
local function getPlayerHealth(cid)
    if isPlayer(cid) then
        return getCreatureHealth(cid)
    end
end
 
local removeTime = 10
local HAVE_CLONE = 55498
local arr = {
    {
        {1},
        {2}
    },
 
    {
        {1, 1, 1},
        {0, 2, 0}
    },
 
    {
        {1, 1, 1},
        {1, 2, 1},
        {0, 0, 0}
    },
 
    {
        {1, 0, 1},
        {1, 2, 1},
        {1, 0, 1}
    },
 
    {
        {1, 1, 1},
        {0, 2, 1},
        {1, 1, 1}
    },
 
        {
        {1, 1, 1},
        {1, 2, 1},
        {1, 1, 1}
    }
}
 
local function removeCreatures(p)
    setPlayerStorageValue(p.cid, HAVE_CLONE, 0)
    if isCreature(p.creature) == TRUE then
        doRemoveCreature(p.creature)
    end
end
 
function onTargetTile(cid, pos)
    local creature = doSummonCreature("vampirebat", pos) --look here
    doConvinceCreature(cid, creature)
    doCreatureAddHealth(creature, getPlayerHealth(cid) + 5000)
    addEvent(removeCreatures, removeTime * 1000, {cid=cid, creature=creature})
    return TRUE
end
 
local combat = {}
for i = 1, 6 do
    combat[i] = createCombatObject()
    setCombatParam(combat[i], COMBAT_PARAM_EFFECT, 59)
    setCombatArea(combat[i], createCombatArea(arr[i]))
    _G["onTargetTile" .. i] = onTargetTile
    setCombatCallback(combat[i], CALLBACK_PARAM_TARGETTILE, "onTargetTile" .. i)
end
 
function onCastSpell(cid, var)
    local level = getPlayerLevel(cid)
    if getPlayerStorageValue(cid, HAVE_CLONE) ~= 1 then
        if level < 20 then
            doCombat(cid, combat[1], var)
        elseif level < 40 then
            doCombat(cid, combat[2], var)
        elseif level < 60 then
            doCombat(cid, combat[3], var)
        elseif level < 80 then
            doCombat(cid, combat[4], var)
        elseif level < 100 then
            doCombat(cid, combat[5], var)
        else
            doCombat(cid, combat[6], var)
        end
        setPlayerStorageValue(cid, HAVE_CLONE, 1)
    else
        doPlayerSendCancel(cid, "You are exhausted from summoning vampire bats")
    end
end


------------------------------------------------------------------------------------------------
This spell works Great, It summons Vampire bats for 10 seconds then they disappear.
HOWEVER.... They have this huge flaw...
When you summon them, they work fine. However. If you Log off Or you Die.... (OR if i happen to use the command (/reload spells) This spell brakes. and it tells the caster they are exhausted. FOREVER!, They can never ever use this spell again till i change the (local HAVE_CLONE = 55498) To another number and reload. But then it constantly brakes and people complain about it,,

Can someone Fix the spell so it still makes the bats disappear after 10 seconds but Get rid of the Part that says you cannot summon the bats till the current ones are gone... Mainly the (HAVE_CLONE) Is the problem. It works but... if you die/reload/log off The script thinks the Summons are still with you and Doesn't let you summon them because it thinks you have them out already... I need someone to get rid of that annoying feature... So i can just use the Normal spell exhaust in the Spells.xml. :D I would be very grateful! Thank you
 
Last edited by a moderator:
In the last part of the script, remove what I have highlighted in red...

Code:
function onCastSpell(cid, var)
	local level = getPlayerLevel(cid)
	[COLOR="#FF0000"]if getPlayerStorageValue(cid, HAVE_CLONE) ~= 1 then[/COLOR]
		if level < 20 then
			doCombat(cid, combat[1], var)
		elseif level < 40 then
			doCombat(cid, combat[2], var)
		elseif level < 60 then
			doCombat(cid, combat[3], var)
		elseif level < 80 then
			doCombat(cid, combat[4], var)
		elseif level < 100 then
			doCombat(cid, combat[5], var)
		else
			doCombat(cid, combat[6], var)
		end
		[COLOR="#FF0000"]setPlayerStorageValue(cid, HAVE_CLONE, 1)
	else
		doPlayerSendCancel(cid, "You are exhausted from summoning vampire bats")
	end[/COLOR]
	return true
end
Or replace the whole thing with the following - same difference. :p

LUA:
function onCastSpell(cid, var)
	local level = getPlayerLevel(cid)
	if level < 20 then
		doCombat(cid, combat[1], var)
	elseif level < 40 then
		doCombat(cid, combat[2], var)
	elseif level < 60 then
		doCombat(cid, combat[3], var)
	elseif level < 80 then
		doCombat(cid, combat[4], var)
	elseif level < 100 then
		doCombat(cid, combat[5], var)
	else
		doCombat(cid, combat[6], var)
	end
	return true
end
 
Thank you again J.DRE, Seems your helping me alot XD lately


<3 it works PERFECTLY
 
Last edited:
Status
Not open for further replies.
Back
Top