• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

MoveEvent My First Script : Health SQL

MagicHereos

Magic.org.pl
Joined
Nov 6, 2008
Messages
60
Reaction score
0
Hello, I wrote this :
movements/hp.lua :
Code:
-- Script by MAGIC
-- Help (EDITED) by Gelio
function onStepIn(cid, item, pos)
local hp = getCreatureHealth
if(pos.x == 814) and (pos.y == 1112) and (pos.z == 7)
then
doPlayerSendTextMessage(cid, 19, "Czujesz ukojenie")
doCreatureAddHealth(cid,hp)
doSendAnimatedText({x=814, y=1112, z=7}, "By Magic",8)
end
 return 1
end
And in movements.xml :
Code:
            <!-- Script of Magic -->
	<movevent event="StepIn" uniqueid="9213" script="hp.lua" />
If you go to this SQM, you have got full hp !
EDIT.
Opss, all text are in Polish, meaby somebody can translate it?: )
 
Last edited:
Erm, do you tried to use my script? I have posted this in your thread ._.

It's alot better!

Code:
function onStepIn(cid, item, pos)
local hp = getCreatureHealth(cid)
local max = getCreatureMaxHealth(cid)
local add = max - hp
local storage = 34652

if(pos.x == 814) and (pos.y == 1112) and (pos.z == 7) and (getPlayerStorageValue(cid, storage) == -1) then
doCreatureSay(cid, 19, "While walking through you feel refreshed...") and doPlayerAddHealth(uid, add)
setPlayerStorageValue(cid, storage, 1)
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
else
doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
end
return 1
end

Btw. It doesn't matter SQL or XML >.>

Regards,
Hermes
 
Last edited:
@2x UP
Sorry, I must edited first post (I click Enter and...:|)
@UP
Yes, your script is better, but I wrote this with help Gelio (Edited my ;P) and I like it (Po Polsku - daje mi satysfakcje) ; )
 
Code:
doSendAnimatedText({x=814, y=1112, z=7}, "Przekraczajac bramy rookguardu, czujesz ukojenie...",8)

Instead of declaring position again, use just `pos`.
The other thing is, that if I remember correctly, doSendAnimatedText supports only 16 characters, use doCreatureSay(cid, text, TALKTYPE_ORANGE_1)
Also, its SQM not SQL. -.^


@Up;

Maybe his script is better, but wont work :)
 
Last edited:
If blablabla Then is totally not needed here :p, but if you want make it configurable, and working on different positions you can use:

<movevent event="StepIn" pos="814;1112;7" script="hp.lua" />
<movevent event="StepIn" pos="234;2323;8" script="hp.lua" />
<movevent event="StepIn" pos="666;555;9" script="hp.lua" />

script:
Code:
function onStepIn(cid, item, pos)
	doPlayerSendTextMessage(cid, 19, "Czujesz ukojenie")
	doCreatureAddHealth(cid, getCreatureHealth)
	doSendAnimatedText(pos, "By Magic" ,8)
	return 1
end
 
But if you want to make it with storages, you have to make if .. then :p
 
If blablabla Then is totally not needed here :p, but if you want make it configurable, and working on different positions you can use:

<movevent event="StepIn" pos="814;1112;7" script="hp.lua" />
<movevent event="StepIn" pos="234;2323;8" script="hp.lua" />
<movevent event="StepIn" pos="666;555;9" script="hp.lua" />

script:
Code:
function onStepIn(cid, item, pos)
	doPlayerSendTextMessage(cid, 19, "Czujesz ukojenie")
	doCreatureAddHealth(cid, getCreatureHealth)
	doSendAnimatedText(pos, "By Magic" ,8)
	return 1
end
Thanks, I dont know about pos="xxx;yyy;z" :thumbup::thumbup:
And Question - How to make script, how give xx when player (all) adv form xx lvl to yy lvl?
I can wrote script, but how to make in ex. actions.xml or movevents.xml?:blink::blink:
 

Similar threads

Back
Top