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

Forever aol (mod maybe?)

Darad

New Member
Joined
Jun 23, 2009
Messages
119
Reaction score
1
Hey guys,

I need a forever aol for latest version of TFS, been trying a lot of things with ondeath events but all it resulted in was either have loot drop or a player running around with 0 hp.

Any idea's?

ID of the amulet is 2196

creatureEvent script
PHP:
function onDeath(cid)
	doSendAnimatedText(getCreaturePosition(cid), "DEADED!", TEXTCOLOR_YELLOW)

	if getPlayerSlotItem(cid, 2) == 2196 then
		for i = PLAYERLOSS_CONTAINERS, PLAYERLOSS_ITEMS do
			doPlayerSetLossPercent(cid, i, 0)
		end
	end
	return TRUE

end

(putting this code in preparedeath resulted into an invincible character)
 
PHP:
    <movevent type="Equip" itemid="2196" slot="necklace" function="onEquipItem" script="faol.lua"/>
    <movevent type="DeEquip" itemid="2196" slot="necklace" function="onDeEquipItem" script="faol.lua"/>
results into: "You cannot equip that item there" or something like that.

Ok got it working for non redskulls. Now test it with red skull.

Code:
[COLOR=#b1b100]function[/COLOR] onEquip[COLOR=#66cc66]([/COLOR]cid, item, slot[COLOR=#66cc66])[/COLOR]
[LEFT]     [COLOR=#b1b100]for[/COLOR] i [COLOR=#66cc66]=[/COLOR] PLAYERLOSS_CONTAINERS, PLAYERLOSS_ITEMS [COLOR=#b1b100]do[/COLOR]
        doPlayerSetLossPercent[COLOR=#66cc66]([/COLOR]cid, i, 0[COLOR=#66cc66])[/COLOR]
    [COLOR=#b1b100]end[/COLOR]
[COLOR=#b1b100]return[/COLOR] TRUE
[COLOR=#b1b100]end[/COLOR]

[COLOR=#b1b100]function[/COLOR] onDeEquip[COLOR=#66cc66]([/COLOR]cid, item, slot[COLOR=#66cc66])[/COLOR]
    [COLOR=#b1b100]for[/COLOR] i [COLOR=#66cc66]=[/COLOR] PLAYERLOSS_CONTAINERS, PLAYERLOSS_ITEMS [COLOR=#b1b100]do[/COLOR]
        doPlayerSetLossPercent[COLOR=#66cc66]([/COLOR]cid, i, 10[COLOR=#66cc66])[/COLOR]
    [COLOR=#b1b100]end[/COLOR]
[COLOR=#b1b100]return[/COLOR] TRUE
[COLOR=#b1b100]end[/COLOR] 
[COLOR=#66cc66]
[/COLOR] [/LEFT]


 
Last edited by a moderator:
Lua:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Saints Amulet" version="1.0" author="Syntax" contact="[email protected]" enabled="yes">
	<description>
		This mod adds an infinite Aol to your server.
	</description>
	<item id="2196" article="a" name="Saints amulet" override="yes">
                <attribute key="weight" value="420"/>
	        <attribute key="slotType" value="necklace"/>
	        <attribute key="preventDrop" value="1"/>
	</item>
</mod>
 
Doesn't work with redskull :(

That mod doesn't work at all. Well doesn't make it infinite.
 
Last edited:
Code:
function onKill(cid, target)
	if isPlayer(target) then	
    		if getPlayerSlotItem(target, 2) == 2196 then
			for i = PLAYERLOSS_CONTAINERS, PLAYERLOSS_ITEMS do
				doPlayerSetLossPercent(target, i, 0)
			end
		end
	end
	return true
end
 
If loss percent = 0 works with red skull, then it should work.

#EDIT:
If it not work, try in player.cpp function dropLoot this code: (before uint32_t itemLoss = (uint32_t)std::floor((float)(loss + 5) * lossPercent[LOSS_ITEMS] / 1000.);)
Code:
	if (inventory[SLOT_NECKLACE] == [B]id of this amulet[/B])
	{
		sendRemoveInventoryItem((slots_t)SLOT_NECKLACE)
		return;
	}

But not tested :(
 
Last edited:
Ok, so no workaround except for diving into the source?

Latest update: I can trace onDeath that the player has the items, the losspercent gets set to zero, but he still drops everything.
 
Last edited:
hey man try this :)
PHP:
function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
	if isPlayer(cid) == true then
		if getPlayerSlotItem(cid, 2196) == true then
			doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), true)
			doCreatureAddHealth(cid, (getCreatureMaxHealth(cid) - getCreatureHealth(cid)), true)
			doCreatureAddMana(cid, (getCreatureMaxMana(cid) - getCreatureMana(cid)))
			doPlayerRemoveAllConditions(cid)
			doSendMagicEffect(getCreaturePosition(cid), CONST_ME_HOLYAREA)
			return false
		end
	end
	return true
end

function doPlayerRemoveAllConditions(cid)
	for i = 1, 45 do
		if getCreatureCondition(cid, i) == true then
			doRemoveCondition(cid, i)
		end
	end
	doRemoveConditions(cid)
end

using this script, you don't loose something, and, you not logout on die, only is teleported, ok? :)

and remember to remove the line in items.xml:
PHP:
<item id="2173" article="an" name="amulet of loss">
		<attribute key="weight" value="420"/>
		<attribute key="slotType" value="necklace"/>
		<attribute key="preventDrop" value="1"/>
		<attribute key="charges" value="1"/>
	</item>
to:
PHP:
<item id="2173" article="an" name="amulet of loss">
		<attribute key="weight" value="420"/>
		<attribute key="slotType" value="necklace"/>
	</item>
:)
 
Looks great, but the player is supposed to loose exp though! :D But im sure there's a function for that.

Those lines in items.xml were removed long ago :)

EDIT: Cool after some bug fixed the script worked. Just need to edit in that the player looses experience. I'll post full script in lua section with reference to your post :)
 
Last edited:
@request, mod worked for me o_O for the infinite anyway, but thread title never said you wanted it for redskulls, so I didn't make it for redskulls
 
Can someone make an Infinite AOL (ID: 2196) for TFS 0.3.4? When a player wears that amulet, he will not lose any items, even if he is redskull

please i need this script asap :p
 
@up

creaturescripts.xml:

PHP:
<event type="preparedeath" name="forever_aol" event="script" value="forever_aol.lua"/>

forever_aol.lua:

PHP:
function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
    if isPlayer(cid) == true then
        if getPlayerSlotItem(cid, CONST_SLOT_NECKLACE) == 2196 then
			doCreatureSetDropLoot(cid, false)
            doSendMagicEffect(getCreaturePosition(cid), CONST_ME_HOLYAREA)
            return true
        end
    end
    return true
end

how it works? players lose exp, lose skills, don't lose any eq(even with red\black skull), don't lose amulet.

and add this line to login.lua
PHP:
registerCreatureEvent(cid, "forever_aol")
 
This is what i have in my items.xml:
Code:
	<item id="2196" article="a" name="forever amulet of loss">
		<attribute key="weight" value="420"/>
		<attribute key="slotType" value="necklace"/>
                <attribute key="charges" value="10000000"/>
		<attribute key="preventDrop" value="1"/>

Perhaps i should add it in movevents?
 
The weird thing about this script is that you get the window INSIDE the temple. It works great though, better than the script that was posted earlier! Thanks a lot. Repped you :)
 
Back
Top Bottom