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

Click Chest and Hits yourself X HP

krotus

New Member
Joined
Jul 15, 2009
Messages
65
Reaction score
3
I'd like that a chest located in somewhere of map which hits yourself if you click on it and would a red /orange message saying: "You has lost 500 hp!"

The idea is that you enter in a room which there are a lot of chests but only one is the correct and the rest are erroneous.
Greetings,
 
woahh!!! sick idea.

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
doTargetCombatHealth(0, cid, COMBAT_POISONDAMAGE, -300, -600, CONST_ME_POFF)
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Wr0nG!")
        doSendMagicEffect(getThingPosition(cid), CONST_ME_MAGIC_RED)
    return true
end

You can change pretty much everything, if you want it to only do 500 damage, just change -500, -500
atm it have min dmg & max.
 
Last edited:
You script is good but when I touch the chests only gives the magic effect, and Text saying Wr0nG! but the life doesn't goes down!

I was trying with action:

“doPlayerAddHealth(cid,500)”:
This will add 500 health to the player (cid). You can ofcourse replace 500 by any number you’d like! You can also make the -500 a negative number, this number will then be removed from the players health.

But I don't have idea how to do it.

The script action is actionid, isn't it?
 

Attachments

Last edited:
You script is good but when I touch the chests only gives the magic effect, and Text saying Wr0nG! but the life doesn't goes down!

Appears this error in log messages:
View attachment 21970

I was trying with action:

“doPlayerAddHealth(cid,500)”:
This will add 500 health to the player (cid). You can ofcourse replace 500 by any number you’d like! You can also make the -500 a negative number, this number will then be removed from the players health.

But I don't have idea how to do it.

The script action is actionid, isn't it?

I used that line before the doTarget~~ it wasnt showing damage, but
doPlayerAddHealth(cid,-500)
 
Doesn't work.... I think that I will do a quest that when you click on the chests, after spawn a monster in some position ... but with actionID

Do you know how do it?
 
try this

Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	doCreatureAddHealth(cid, -500)
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Wrong chest, You lost 500HP")
	doSendMagicEffect(getCreaturePosition, CONST_ME_CAKE)
    return true
end
 
I'm currently working Forgotten Server, version 0.4_SVN()
tibia version 8.60

The error doesn't appear on logs , just the HP doesn't go down... with:

Code:
doCreatureAddHealth(cid, -500)

OR

Code:
doPlayerAddHealth(cid,-500

OR

Code:
doTargetCombatHealth(0, cid, COMBAT_POISONDAMAGE, -300, -700, CONST_ME_POFF)
 
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	doCreatureAddHealth(cid, -500)
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Wrong chest, You lost 500HP.")
	doSendMagicEffect(getCreaturePosition[COLOR="#FF0000"](cid)[/COLOR], CONST_ME_CAKE)
    return true
end

Are you sure you are not a GM?
 
Yes, I'm trying it with normal players.

I did put your script and on action.xml I have:
Code:
<action actionid="7781" event="script" value="chestshits/chestsHit.lua"/>
 
What about this?
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	doCreatureAddHealth(cid, -500[COLOR="#FF0000"], true[/COLOR])
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Wrong chest, You lost 500HP.")
	doSendMagicEffect(getCreaturePosition(cid), CONST_ME_CAKE)
    return true
end
 
No, I'm obviously using normal character.
It's really rare, but every arguments positives like:
Code:
doCreatureAddHealth(cid, 500)
doCreatureAddHealth(cid, 500)

Works fine, but the negative arguments doesn't work:
Code:
doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
doCreatureAddHealth(cid, -500
)

NOTE: I CAN PUT NEGATIVE ARGUMENTS ON MANA LIKE, AND WORKS FINE:
doCreatureAddMana(cid, -getCreatureMaxMana(cid))

Maybe, there is somewhere to disable the funcions which pretend to cancel to hit yourself or get off your HP.. in some config files...

Any ideas?
 
Last edited:
Back
Top