PDA

View Full Version : Call Pet and Revive Pet


Karmond
12-14-2004, 08:11 AM
It's a waste of space having both on your skill bar at the same time. You'll only need one, or the other.

What I want is to have Call Pet on my skill bar. If my pet dies I'd like that skill automatically switched with Revive Pet. Once I've revived my pet, I'd like it switched with Call Pet again.

or

Have a button that has some formula like the following:
if (PetIsDead) then
Revive Pet
else
Call Pet
end
I don't know how to code it at the moment, but I want to learn. What I would like to know is can either of the two be done? I'd prefer the first, but second is good too. :)

sarf
12-14-2004, 02:10 PM
The first could be done, but would be klutzy.

I'd recommend you to do a macro.

Shift-click to get the name of Call Pet/Revive Pet - I don't have a Hunter, so I can't do this.

macro code:

/script if ( ( UnitIsDeadOrGhost("pet") ) or ( UnitHealth("pet") <= 0 ) ) then CastSpellByName("Revive Pet"); else CastSpellByName("Call Pet"); end

That might work.

Sarf
---
Gotta run. Neighbors just sighted Elvis making crop circles.

Karmond
12-15-2004, 05:10 AM
/script if ( ( UnitIsDeadOrGhost("pet") ) or ( UnitHealth("pet") <= 0 ) ) then CastSpellByName("Revive Pet"); else CastSpellByName("Call Pet"); endThanks Sarf, I don't have the game yet (it's ordered, but waiting to come back in stock). But I was wondering if Mend Pet could also be thrown in there... of course it might get a little tricky if you wanted it to use the highest rank skill you have. Or even a check if you don't have enough mana to cast the highest rank you attempt to cast the next highest and so on. But for that you'd most likely need a mod as it won't fit into a macro. I've been looking through the commands list and I think UnitExists("pet") is what I want to check if the pet is "out", right?

so a simple macro to include Mend Pet (Rank 1) would be:

/script if ( ( UnitIsDeadOrGhost("pet") ) or ( UnitHealth("pet") <= 0 ) ) then CastSpellByName("Revive Pet"); elseif ( UnitExists("pet") ) then CastSpellByName("Mend Pet(Rank 1)"); else CastSpellByName("Call Pet"); end

Could this work?

If it's not UnitExists("pet") I want, perhaps HasPetUI() is it.

sarf
12-15-2004, 10:05 AM
It seems as if it would work - I don't know, I don't have a hunter to test with.

Sarf
---
When we talk to God it's called prayer. When God talks back it's called schizophrenia.

Kierstad
12-15-2004, 07:58 PM
I'll check it out tonight. I was trying to come up with an uber conditional script for doing a bunch of stuff on my hunter, until sarf pointed me to his one-hit-wonder. I might just modify that, credit going to him of course.

I would think the snippet snarf suggested will work fine. The only problem I foresee is with the current stable bug.

If you run across that as a hunter, make sure the bugged pet is in your active slot, then zone to another continent (not just an area, but go from one continent to the other) and it should allow to then call or revive your pet.


On a side note, I'm also trying to figure out a better way to do a feed macro. The current ones out there require that you have food in a particular slot.

What I'm trying to come up with is an intelligent one that will enumerate inventory until it finds a food item, then check it to see if it's what your pet likes, then /cast PetFeed (whatever it's called, not at home atm).

Could probably even be more complex and check to see the numeric value restored by the food (the higher restored, the more happiness gained per tick).

Lord Nakitomimaru
12-16-2004, 01:51 AM
The original script didn't work for me when I tried it.... I tried taking out the UnitHealth part of it, and the macro began working to call or revive, when I tested it out. I let my pet kill itself, and the macro revived, and when I first summoned my pet it worked for calling.

Problem: The macro did not revive my pet when I died after it... I have a sneaking suspicion that it's because I dropped the UnitHealth portion, but with that in there, the macro would only try to revive. :o/

Kierstad
12-16-2004, 05:16 AM
The original script didn't work for me when I tried it.... I tried taking out the UnitHealth part of it, and the macro began working to call or revive, when I tested it out. I let my pet kill itself, and the macro revived, and when I first summoned my pet it worked for calling.

Problem: The macro did not revive my pet when I died after it... I have a sneaking suspicion that it's because I dropped the UnitHealth portion, but with that in there, the macro would only try to revive. :o/

See below:


/script if UnitHealth("pet") <= 0 then CastSpellByName("Revive Pet") else CastSpellByName("Call Pet"); end


I've been using that up until I had to log off, and now can't get back on.
It works in any situation I've come across so far.

Lord Nakitomimaru
12-16-2004, 07:44 PM
No good. :o/ Spell revives pet, but just like the original script, it always tries to revive pet if pet isn't present, be it dead or dismissed.

Kierstad
12-17-2004, 12:36 AM
Funny, I'm using it right now and it works fine...lemme check my macro again and see what's up.

For me it works as thus:
Pet isn't present = It should check to see if it's health is zero first, if it is, it should revive it, if it isn't it should call it.

Pet is present = Same as above...

used it all afternoon yesterday and some today and it worked fine.

================= EDIT =====================
Woops heheh looks like i reverted back to Sarf's original suggestion.


/script if UnitIsDeadOrGhost("Pet") then CastSpellByName("Revive Pet") else CastSpellByName("Call Pet"); end

Karmond
12-17-2004, 12:31 PM
Hmm, thanks for testing it out guys. The game arrives on monday so I can start building up a hunter and get to work on some scripts (I've already started one, but it's a pain not being able to test it...).

With the feed pet, I was thinking the same thing. But have a 4 in 1 button.

Where you only mend pet if in combat and pet's health is below a preset %.
You feed pet when out of combat and pet's health is below a preset % OR happyness is below 3.

The other conditions stay the same.
Call Pet when pet doesn't exist.
Revive Pet if pet is dead.

I don't think you can do your feed pet idea (go through your bags looking for food) unless you had perhaps an array of foods your pet can eat or something else klutzy. It's easier keeping a certain food in a certain slot.

If you just want Call Pet and Revive Pet (2 in 1) maybe you could try this:/script if ( UnitExists("pet") ) then CastSpellByName("Revive Pet"); else CastSpellByName("Call Pet"); end

Or for a 3 in 1 try:/script if ( UnitExists("pet") ) then if ( UnitHealth("pet") ) then CastSpellByName("Mend Pet(Rank 1)"); else CastSpellByName("Revive Pet"); end else CastSpellByName("Call Pet"); endI'm assuming that UnitExists() still returns true if the pet is dead.

Kierstad
12-17-2004, 07:18 PM
I don't think you can do your feed pet idea (go through your bags looking for food) unless you had perhaps an array of foods your pet can eat or something else klutzy. It's easier keeping a certain food in a certain slot.

Actually there is a function in the API that allows you to get the pet's food type: GetPetFoodTypes(). My guess is that it will return integers telling you which food types it will eat. I just haven't had the time to test it out yet.



If you just want Call Pet and Revive Pet (2 in 1) maybe you could try this:/script if ( UnitExists("pet") ) then CastSpellByName("Revive Pet"); else CastSpellByName("Call Pet"); end

This won't work. The problem with this is that if your pet doesn't "exist" in the game world, it can be either dead or alive :/.

I'm goin to be messing around with it some more tonight because I really need to free up button space lol.

Lord Nakitomimaru
12-18-2004, 04:04 AM
I was putting some thought into this today, and please bear with my Visual Basic inspired line of thinking, but I think that the problem is that the script is seeing the pet as having zero health BECAUSE it's not summoned... If that's true, then the script would be something closer to:

/script if ( (UnitExists("Pet") and UnitIsDeadOrGhost("Pet") ) then CastSpellByName("Revive Pet"); else CastSpellByName("Call Pet"); end

This would give the script two conditions to compare it to - first, does a pet exist (If it doesn't, then obviously the pet hasn't been called yet) and if it does, does it's HP register as 0, in which case it would need to be revived.. I'll give this a try and see if it works.