• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

[SOLVED] ResurrectPlayer on Item Use.

Status
Not open for further replies.

Reloac

BETA Tester
Hey

Been working on my item teleporter, and of course.. trying to add a new thing, the first i did worked like a charm but trying to make it resurrect someone when they use the item when dead, is proving to be harder than i thought, I've trolled through the source code to try and find other resurrect method but this was the only that i could find, and all i get when trying to use it is :

http://puu.sh/6wyBF.jpg

The combat one works perfectly, shows the error when someone is in combat and doesn't open the window.

Code:
	bool OnUse(Player* player, Item* item, SpellCastTargets const& targets)
	{
		if (player->IsInCombat())
		{
			ChatHandler(player->GetSession()).PSendSysMessage("[Error] Stone cannot be used in combat..");
			return false;
		}

		if (player->IsAlive())
		{
			player->ResurrectPlayer(1.0f);
		}

		player->PlayerTalkClass->ClearMenus();
		player->ADD_GOSSIP_ITEM(0, "|TInterface\\icons\\inv_misc_map02:30|t World Map", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
		player->ADD_GOSSIP_ITEM(0, "|TInterface\\icons\\achievement_pvp_h_15:30|t PvP Arena", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2);
		player->ADD_GOSSIP_ITEM(0, "|TInterface\\icons\\ability_paladin_swiftretribution:30|t Services", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3);
		player->SEND_GOSSIP_MENU(1, item->GetGUID());
		return true;
	}

& also tried it when a ghost/released and when i still have the release option.

Any help would be awesome, as i have no idea right now..
 
Last edited:

Tommy

Founder
Code:
if (player->IsAlive())

You're checking if the player IsAlive, not 'IsDead' or '!IsAlive()'.

Do:

Code:
if (!player->IsAlive())

or

Code:
if (player->IsDead())
 

Reloac

BETA Tester
Hey

I tried both if (!player->IsAlive()) and if (player->IsDead()) - both wont work.

IsAlive just did the same as it did when i used it without the ! and IsDead is undefined aparently.
 

Tommy

Founder
Hey

I tried both if (!player->IsAlive()) and if (player->IsDead()) - both wont work.

IsAlive just did the same as it did when i used it without the ! and IsDead is undefined aparently.

I do agree that IsDead doesn't work properly, but IsAlive() and !IsAlive() does.

Can the item even be used when the player is dead? Did you look into that?
 

Reloac

BETA Tester
Update, thought about maybe editing the spell::ChestCast section to allow it to check the spell id and if its 33227 (gossip) to allow it to be cast while dead else to carry on..

Code:
if (m_spellInfo->Id == 33227)
	{
		// do nothing (maybe return true;)
	}
	else if (!m_caster->IsAlive() && !(m_spellInfo->Attributes & SPELL_ATTR0_PASSIVE) && !((m_spellInfo->Attributes & SPELL_ATTR0_CASTABLE_WHILE_DEAD) || (IsTriggered() && !m_triggeredByAuraSpell)))
        return SPELL_FAILED_CASTER_DEAD;

Though should prob choose another spell that like spirit of redemption that is only gained when a priest dies so isn't a main spell

EDIT : Nope, no luck haha
 
Last edited:

Tommy

Founder
The item is custom made so i don't see how it wouldn't be able to be used.

Just because it is custom made doesn't mean it can work on death. :p

Have you looked for any items that can work while you're dead? If there are any, you could copy their flags or whatever. Although, I don't see any flags like that.

I'm honestly not sure and I can't test this myself right now.
 

Reloac

BETA Tester
Just because it is custom made doesn't mean it can work on death. :p

Have you looked for any items that can work while you're dead? If there are any, you could copy their flags or whatever. Although, I don't see any flags like that.

I'm honestly not sure and I can't test this myself right now.

Yeah im abit confused right now also, i might just edit the killedplayer stuff to give them an aura and hopefully it will work like soulstone giving them the choice to corpse run or choose soulstone resurrection, as i cant see a possible way to get it to work, wowhead doesn't show an option to sort it by usable items in combat only in area/battleground so.
 
Status
Not open for further replies.
Top