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

onEquip do this:

Mooosie

mistofdeath.com
Premium User
Joined
Aug 2, 2008
Messages
742
Solutions
2
Reaction score
52
Location
Sweden
I want that if the player equips the weapon on hand slot, it gives the player 20+ health on their current health directly, not like, they need to logout and in to get their 20+ hp..

is it like this? onEquip doCreatureSetMaxHealth(cid, getCreatureMaxHealth(cid)+20) if i want to give the player 20+ health on their current max health?

or like this:
onEquip doCreatureSetMaxHealth(cid, +20)

and

onDeEquip doCreatureSetMaxHealth(cid, getCreatureMaxHealth(cid)-20)
or
onDeEquip doCreatureSetMaxHealth(cid, +20)??

thanks
 
one bump every 24 hours.

It's this:
onEquip doCreatureSetMaxHealth(cid, getCreatureMaxHealth(cid)+20)
and this:
onDeEquip doCreatureSetMaxHealth(cid, getCreatureMaxHealth(cid)-20)
 
Last edited:
Sorry, but... I did that but... It did'nt work ;/

LUA:
 function onEquip(cid, item, slot)
	doCreatureSetMaxHealth(cid, getCreatureMaxHealth(cid)+20)
	return true
end	
 
function onDeEquip(cid, item, slot)
	doCreatureSetMaxHealth(cid, getCreatureMaxHealth(cid)-20)
	return true
end

XML:
 	<movevent event="Equip" itemid="7438" function="onEquipItem" slot="hand" script="elvish bow.lua"/>
	<movevent event="DeEquip" itemid="7438" function="onDeEquipItem" slot="hand" script="elvish bow.lua"/>
 
0.2
Code:
	<movevent event="Equip" itemid="7438" slot="hand" script="elvish bow.lua"/>
	<movevent event="DeEquip" itemid="7438" slot="hand" script="elvish bow.lua"/>
0.3/4
Code:
	<movevent type="Equip" itemid="7438" slot="hand" event="script" value="elvish bow.lua"/>
	<movevent type="DeEquip" itemid="7438" slot="hand" event="script" value="elvish bow.lua"/>

remember that it may crash if the item appears in the correct slot while being newly created
 
Lolzor, Now I can't wear it. It says, "You cannot dress this object there." when I try to put the bow in my hands but, when I put the bow in the armor or boot or head slot it says, "Put this object in both hands."... LOL? how to fix that? ;/

Error:
Code:
[26/06/2011 09:48:27] [Error - MoveEvents Interface] 
[26/06/2011 09:48:27] data/movements/scripts/elwish bow.lua:onEquip
[26/06/2011 09:48:27] Description: 
[26/06/2011 09:48:27] data/movements/scripts/elwish bow.lua:2: attempt to call global 'doCreatureSetMaxHealth' (a nil value)
[26/06/2011 09:48:27] stack traceback:
[26/06/2011 09:48:27] 	data/movements/scripts/elwish bow.lua:2: in function <data/movements/scripts/elwish bow.lua:1>

EDIT: FIxed that! but, now when I wear the bow in my hand, i get 40+ hp... Why? ;/

LUA:
 function onEquip(cid, item, slot)
	setCreatureMaxHealth(cid, getCreatureMaxHealth(cid)+20)
	return true
end	
 
function onDeEquip(cid, item, slot)
	setCreatureMaxHealth(cid, getCreatureMaxHealth(cid)-20)
	return true
end
EDIT2: Fixed that too, now when i have it equipped i get 20+ health but when i deequip it i get -20 health but i cant see it until i heal myself or get hit... ;/ How to fix that?
EDIT3: I get that Error cycotitan was talking about. When I create the elvish bow and get it on my hand directly, my console stops working... But i used his 0.36 script /;
EDIT4: I got it working. But i still get the console problem ;/
LUA:
function onEquip(cid, item, slot)
	setCreatureMaxHealth(cid, getCreatureMaxHealth(cid)+10)
	return true
end	
 
function onDeEquip(cid, item, slot)
	setCreatureMaxHealth(cid, getCreatureMaxHealth(cid)-20)
	doCreatureAddHealth(cid, -20)
	return true
end
 
Last edited:
Back
Top