Page 1 of 1

rage detection?

Posted: Sat Jan 15, 2011 6:31 am
by botje
anybody knows what i need to do to detect current rage level?

i want to let my char use a rage potion when its below 10, but i dont even know how to

find it xd

tried checking in player.lua, but it didnt show up there :S

thanx in advance guys ^^

Botje

Re: rage detection?

Posted: Sat Jan 15, 2011 6:59 am
by lisa
rage is for warrior right and starts at 0 and builds up during battle?
If you set it to use the pot anytime its under 10 it would constantly use pots.

Tha game itself designates what ever the character uses to power it's spells to be mana. They have a Manatypeid, rage = 2.

So

Code: Select all

UnitMana("player")
would technically get the value u want if you are after the value for Class1, it's a romscript though so need to use sendmacro.

As for rombot itself, I couldn't find any reference to rage. Maybe admin or rock5 could comment if rage is treated same as mana when it comes to getting values.

Re: rage detection?

Posted: Sat Jan 15, 2011 7:14 am
by rock5
It looks like player.MP holds the level of whatever power your class uses but it is also copied to the relevant variable.

So for example, for warriors, player.MP is copied to player.Rage. For magic users player.MP is copied to player.Mana, etc.

So as a warrior you can check player.MP or player.Rage. They are the same.

As to continuously using the potion, you could check whether you are in battle as well as if your rage is below 10.

Re: rage detection?

Posted: Sat Jan 15, 2011 7:45 am
by lisa
rock5 wrote:As to continuously using the potion, you could check whether you are in battle as well as if your rage is below 10.
Wouldn't it use a pot at the start of all combat, assuming your rage went to 0 between battles. I know my rage on warr is used up completely anytime it has rage.

Re: rage detection?

Posted: Sat Jan 15, 2011 8:06 am
by botje
well, ofcourse i would only let it use it in battle :)

and thanx guys, im gonna check if i can get something to work ^^

Botje

Re: rage detection?

Posted: Sat Jan 15, 2011 8:14 am
by rock5
lisa wrote:
rock5 wrote:As to continuously using the potion, you could check whether you are in battle as well as if your rage is below 10.
Wouldn't it use a pot at the start of all combat, assuming your rage went to 0 between battles. I know my rage on warr is used up completely anytime it has rage.
Well yeh. He said he wanted to use the potions when his rage was below 10. Maybe that's the way he wants to use it.

In the end, if you can think how and when to use the potion then there is a way to write it up.

Re: rage detection?

Posted: Sat Jan 15, 2011 9:08 am
by botje
exactly, im sure i can think of something :)

and dont forget the potions have a minute cooldown, so it wont be like all the time using it anyway ^^

Botje

Re: rage detection?

Posted: Mon Jan 17, 2011 5:41 pm
by botje

Code: Select all

if( 10 < player.Rage ) then
	inventory:useItem("Rage Potion") -- the name of the potion
end
this should work then right?

Botje

Re: rage detection?

Posted: Mon Jan 17, 2011 7:03 pm
by lisa
if you wanted to use a potion anytime you have more than 10 rage then.

Code: Select all


if(  player.Rage > 10 ) then
   inventory:useItem("Rage Potion") -- the name of the potion
end

try not to use < in code as it can mess things up, I didn't test this but it should work, should.

Re: rage detection?

Posted: Mon Jan 17, 2011 7:11 pm
by botje
it should actually use it UNDER 10 rage

how would that be then?

Re: rage detection?

Posted: Mon Jan 17, 2011 7:22 pm
by lisa
botje wrote:

Code: Select all

if( 10 > player.Rage ) then
	inventory:useItem("Rage Potion") -- the name of the potion
end
this should work then right?

Botje
Pretty much what you had but with the > instead of <.

Re: rage detection?

Posted: Mon Jan 17, 2011 7:29 pm
by botje
cool, thank you :)

Botje

Re: rage detection?

Posted: Mon Jan 17, 2011 7:32 pm
by lisa
happy to help =)