WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Wish List (https://www.wowinterface.com/forums/forumdisplay.php?f=15)
-   -   Unit_entered_vehicle!! (https://www.wowinterface.com/forums/showthread.php?t=27287)

turkoid 09-13-09 02:55 PM

Unit_entered_vehicle!!
 
So that this event is only called when the unit actually exists ><. Having to poll for existence of a unit when you have ENTERED it, is annoying.

Hoern 09-15-10 12:46 AM

I am confused, which makes me think I am missing something or misunderstanding the event. If I am not mistaken, it's fired whenever you enter or exit a vehicle. ... contains the unit name, "player" etc.

My only issue was, that sometimes it seemed to fire COMPANION_UPDATE instead of UNIT_[ENTERING|EXITING|ENTERED|EXITED]_VEHICLE. But as I said, I am likely misunderstanding the event.

Phanx 09-15-10 06:06 AM

UNIT_ENTERING_VEHICLE fires when the unit begins entering a vehicle.
UNIT_ENTERED_VEHICLE fires when the unit finishes entering a vehicle.
UNIT_EXITING_VEHICLE fires when the unit begins exiting a vehicle.
UNIT_EXITED_VEHICLE fires when the unit finishes exiting a vehicle.

In all cases, the unit passed as an argument to your event handler is the actual unit transitioning into/out of a vehicle. So, if you (the player unit) enter a vehicle, the ENTERING and ENTERED events will fire with "player" as their first argument.

I haven't played with these events extensively, but information about the unit's vehicle is definitely available after ENTERED has fired.

For units like "party2" you can just stick "pet" in there before the number, and query for information on the "partypet2" unit to learn about the unit's vehicle (eg. UnitHealth, UnitName); I'm not sure if "partyvehicle2" would work, as I've never tried it or seen any other addon using it.

The "player" unit is the only one where you actually have to change the unit token for API queries (since "playerpet" is not a valid unit token as of... some patch quite a while ago) to "pet", and the only one where I know "vehicle" will work.

If you're having a problem using these events to accomplish something, perhaps you could be more specific about what you're trying to accomplish and what problem(s) you're having.

@Hoern, COMPANION_UPDATE should fire when you enter a vehicle if (a) you had a non-combat pet summoned, since that pet is unsummoned when you enter a vehicle, or (b) you're summoning a mount that's also a vehicle, such as the Traveler's Tundra Mammoth.

Hoern 09-15-10 11:54 AM

Quote:

Originally Posted by Phanx (Post 206243)
@Hoern, COMPANION_UPDATE should fire when you enter a vehicle if (a) you had a non-combat pet summoned, since that pet is unsummoned when you enter a vehicle, or (b) you're summoning a mount that's also a vehicle, such as the Traveler's Tundra Mammoth.

Yes, I am a dumbo. I was crushing my cranium trying to figure out why suddenly it fired COMPANION_UPDATE on the same vehicle - until you made me realize I was on a toon who had a non-combat out by default.

But, say, wouldn't it be smarter (maybe not, as I said I am a dumbo :) to just check for PLAYER_GAINS_VEHICLE_DATA instead?


All times are GMT -6. The time now is 06:04 PM.

vBulletin © 2021, Jelsoft Enterprises Ltd
© 2004 - 2020 MMOUI