• 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 Get storage on kill

Lightonia

Lightonia.servegame.com
Joined
Jun 4, 2007
Messages
492
Reaction score
9
I really cant get this to work, please help out, i think my main problem is at :
Lua:
  if creature == "adel the skinny ass" then
       elseif demonkilled == -1 then
Lua:
function onKill(cid, target)

local demonstorage = 40001
local demonkilled = getPlayerStorageValue(cid,demonstorage)
local creature = getCreatureName(target)
 
  if creature == "adel the skinny ass" then
       elseif demonkilled == -1 then
           doCreatureSetStorage(cid, demonstorage, 1)
           end
           if demonstorage == 1 then
           doCreatureSay(cid, "You have been Enforced with skeletal powers", TALKTYPE_ORANGE_1)
           end
end
 
Lua:
function onKill(cid, target)
 
local demonstorage = 40001
local demonkilled = getPlayerStorageValue(cid,demonstorage)
local creature = getCreatureName(target)
 
	if creature == "adel the skinny ass" then
		if demonkilled == -1 then
           		doCreatureSetStorage(cid, demonstorage, 1)
          		doCreatureSay(cid, "You have been Enforced with skeletal powers", TALKTYPE_ORANGE_1)
           	end
	end
	return true
end
 
I get no errors at all, but the storage wont be put as i can't loot the item ( Need storage to loot item )
Heres the script to the action :
Lua:
 function onUse(cid, item, frompos, item2, topos)

local demonstorage = 40001


        --Demon Kill
       if item.uid == 10001 then
           queststatus = getPlayerStorageValue(cid,demonstorage)
           if demonstorage == 1 then
                        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You found a fine new dishtasha under the rock.")
                        doPlayerAddItem(cid,2656)
           else
               doCreatureSay(cid, 'This stone rubbles a little bit, but you might need skeletal powers to enforce it over.', TALKTYPE_ORANGE_1)
           end
    end

end
 
Do you get the message when you kill the monster? If not, did you spell the monster name right(capitals etc) and did you added the script correctly?
 
I did not get a message;
Login.lua
Lua:
registerCreatureEvent(cid, "KillRequirement")

creaturescripts.xml
Code:
<event type="kill" name="KillRequirement" event="script" value="killrequirement.lua"/>

adel the skinny ass.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<monster name="Adel the skinny ass" nameDescription="the king of the undead" race="undead" experience="5000" speed="330" manacost="62000">
    <health now="16200" max="16200"/>
    <look type="37" corpse="5963"/>
    <targetchange interval="5000" chance="8"/>
    <strategy attack="100" defense="0"/>
    <flags>
        <flag summonable="0"/>
        <flag attackable="1"/>
        <flag hostile="1"/>
        <flag illusionable="0"/>
        <flag convinceable="0"/>
        <flag pushable="0"/>
        <flag canpushitems="1"/>
        <flag canpushcreatures="1"/>
        <flag targetdistance="1"/>
        <flag staticattack="90"/>
        <flag runonhealth="0"/>
    </flags>
    <attacks>
        <attack name="melee" interval="3000" min="-0" max="-480"/>
        <attack name="lifedrain" interval="2000" chance="10" range="1" min="-40" max="-305"/>
                <attack name="physical" interval="500" chance="66" range="7" min="-1" max="-90">
            <attribute key="shootEffect" value="spear"/>
            </attack>
                    <attack name="melee" interval="1000" chance="80" range="7" radius="3" target="0" min="-20" max="-112">
            <attribute key="areaEffect" value="blackspark"/>
        </attack>
    </attacks>
    <defenses armor="25" defense="25"/>
    <elements>
        <element firePercent="100"/>
        <element deathPercent="100"/>
        <element earthPercent="100"/>
        <element holyPercent="-25"/>
    </elements>
    <immunities>
        <immunity paralyze="1"/>
        <immunity drunk="0"/>
        <immunity invisible="1"/>
    </immunities>
            <summons maxSummons="2">
        <summon name="Skeletor" interval="500" chance="80" max="2"/>
    </summons>
    <loot>
        <item id="2152" countmax="40" chance="100000"/><!-- gold coin -->
        <item id="2487" countmax="1" chance="10000"/><!-- throwing star -->
        <item id="2515" chance="9400"/><!-- guardian shield -->
        <item id="2178" chance="1000"/><!-- mind stone -->
        <item id="2050" chance="10000"/><!-- torch -->
        <item id="1987" chance="100000"><!-- bag -->
            <inside>
                <item id="2417" chance="5000"/><!-- battle hammer -->
                <item id="2482" chance="2857"/><!-- studded helmet -->
                <item id="2194" chance="700"/><!-- mysterious fetish -->
                <item id="2398" chance="10000"/><!-- mace -->
            </inside>
        </item>
    </loot>
    <script>
    <event name="KillRequirement"/>
</script>
</monster>
 
If you using linux I think you have to use Adel the skinny ass on the script instead of adel the skinny ass on this line:
Code:
if creature == "adel the skinny ass" then
 
Try:

Lua:
function onKill(cid, target, lastHit)
	if(not isPlayer(target)) and isPlayer(cid) and not(getCreatureMaster(target)) then	
		if getCreatureName(target) == "Adel The Skinny Ass" then
		doPlayerSetStorageValue(cid,40001, 1)
		doCreatureSay(cid, "You have been Enforced with skeletal powers", TALKTYPE_ORANGE_1)
		end
	end
	return true
end
 
creaturescripts.xml
Code:
<event type="kill" name="BossKill" event="script" value="bosskill.lua"/>

login.lua
Lua:
	registerCreatureEvent(cid, "BossKill")

bosskill.lua
Lua:
function onKill(cid, target, damage, flags)
	local killstorage = "25909"
	local name = getCreatureName(target):lower()
	
	if isPlayer(target) then return true end
	if name == 'testboss' then
		doCreatureSay(cid, 'You have defeated the ' .. name .. '. You may continue exploring now.', TALKTYPE_ORANGE_1)
		if(getCreatureStorage(cid, killstorage) < 1) then
		doCreatureSetStorage(cid, killstorage, 1)
		end
	end
	return true
end

in name write monster name using small letters
 
I dont really get any errors, but still don't work im beginning to think its the action that is wrong check it out, and thanks;
Lua:
 function onUse(cid, item, frompos, item2, topos)

local demonstorage = 39871
local demonteleport = {x=345, y=387, z=7} --Location to teleport to on the map if you pull the lever

        --Demon Kill
       if item.uid == 10001 then
           queststatus = getPlayerStorageValue(cid,demonstorage)
           if demonstorage == 1 then
                        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You found a fine new dishtasha under the rock.")
                        doPlayerAddItem(cid,2656)
                    doSendMagicEffect(demonteleport,10)
           else
               doCreatureSay(cid, 'This stone rubbles a little bit, but you might need skeletal powers to enforce it over.', TALKTYPE_ORANGE_1)
           end
    end

end
 
maybe you forgot entry in actions.xml
and you forgot doTeleportThing

removed this from your code:
if item.uid == 10001 then ... end - it will always return true

replaced demonstorage to queststatus(demonstorage returned false which was probably why it didn't worked)
Lua:
 function onUse(cid, item, frompos, item2, topos)
 
local demonstorage = 39871
local demonteleport = {x=345, y=387, z=7} --Location to teleport to on the map if you pull the lever
        --Demon Kill
           queststatus = getPlayerStorageValue(cid,demonstorage)
           if queststatus == 1 then
                        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You found a fine new dishtasha under the rock.")
                        doPlayerAddItem(cid,2656)
                    doSendMagicEffect(demonteleport,10)

           else
               doCreatureSay(cid, 'This stone rubbles a little bit, but you might need skeletal powers to enforce it over.', TALKTYPE_ORANGE_1)
           end
 
end
 
Thanks, worked but how do you do so that it sends another message after looting it, i tried with;
Lua:
       if demonstorage == 2 then
           doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have rubbled the stone, but can't find anything under it.")
           end
but did not work

- - - Updated - - -

By the way, you can loot the stone again everytime the server restart.
 
Back
Top