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

!bestbloodhit , !bestspellhit - commands

Fresh

Quack!
Joined
Oct 21, 2009
Messages
1,838
Solutions
18
Reaction score
617
Location
Poland
Hello.
Im looking for that commands (TFS 0.3.6pl1):
- !bestbloodhit - shows the best hit from melee (regular attack)
- !bestspellhit - shows the best hit from spell

Anyone can write it if its possible ?
Thanks.
 
Creaturescripts:
XML:
<event type="statschange" name="BestHit" event="script" value="bestHit.lua"/>

Lua:
local bestMelee = 4500 -- free storage
local bestSpell = 4501 -- free storage

function onStatsChange(cid, attacker, type, combat, value)
	if isPlayer(attacker) then
		if combat == COMBAT_PHYSICALDAMAGE then
			if getCreatureStorage(attacker, bestMelee) < value then
				doCreatureSetStorage(attacker, bestMelee, value)
			end
		else
			if combat ~= COMBAT_NONE and combat ~= COMBAT_UNDEFINEDDAMAGE then
				if getCreatureStorage(attacker, bestSpell) < value then
					doCreatureSetStorage(attacker, bestSpell, value)
				end
			end
		end
	end
	return true
end

Lua:
function onLogin(cid)
	registerCreatureEvent(cid, "BestHit") -- add this line to login.lua
	return true
end

Monsters:
XML:
.
	<script>
		<event name="BestHit"/>
	</script>

Talkactions:
XML:
<talkaction words="!bestbloodhit" event="script" value="bestMelee.lua"/>
Lua:
local bestMelee = 4500 -- [same in onStatsChange script]
function onSay(cid, words, param, channel)
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Your best damage dealt as melee attack: '..math.max(0, getCreatureStorage(cid, bestMelee))..'.')
	return true
end


XML:
<talkaction words="!bestspellhit" event="script" value="bestSpell.lua"/>
Lua:
local bestSpell = 4501 -- [same in onStatsChange script]
function onSay(cid, words, param, channel)
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Your best damage dealt as spell attack: '..math.max(0, getCreatureStorage(cid, bestSpell))..'.')
	return true
end
 
Last edited:
Virrages, it don't work.
When I heal with my manarune it increase my spell damage.
My manarune is just adding mana with this function "doCreatuerAddMana(cid)".
 
yes this is why its fail :
1- states change occur when players stats is changed (he is hit, healed, etc..)
2- this script gives the most damage that was dealt to the player not by the player
3- if you tried to check if the attacker is player and increase the attacker max hit value then this will lack the attack values of players on monsters.
 
yes this is why its fail :
1- states change occur when players stats is changed (he is hit, healed, etc..)
2- this script gives the most damage that was dealt to the player not by the player
3- if you tried to check if the attacker is player and increase the attacker max hit value then this will lack the attack values of players on monsters.

1- so why I checking combat (or you can heal yourself as physical damage, so here it won't work)
2- i don't get you. to the player/monster damage = the attacker dealt damage <- and it is checking
3- so why you need to add line to every monster which I posted above
 
1- so why I checking combat (or you can heal yourself as physical damage, so here it won't work)
2- i don't get you. to the player/monster damage = the attacker dealt damage <- and it is checking
3- so why you need to add line to every monster which I posted above


Look this is the damage dealt by the attacker to the player so if you check for physical damage then this is the damage player receive not do I hope you got it!!
 
Back
Top Bottom