Jump to content

NPC Instantly lootable?


Guest Stormedge

Recommended Posts

I suspect a bad hack at blizzard servers: If you click on them, they take you as their target before adding yout stuff to the inventory and disappearing afterwards. That makes me think they used CMSG_GOSSIP_HELLO and add the item/despawn the npc there - there is no looting window.

If the client is really sending CMSG_GOSSIP_HELLO, I guess it has to be implemented unsing ScriptDev2

EDIT: Such creatures are used for quest 1200, the questitem has a chance to be looted from item 35792 and that item, which is "looted" from these NPCs is created by a spell. So most probably their Hello function looks like "m_creature->CastSpell(47096, looter); m_creature->despawn();" :)

Link to comment
Share on other sites

Forget (almost) everything what I've said in my prior post. NoFantasy just told me some details:

Such creatures have the flag UNIT_NPC_FLAG_SPELLCLICK set which causes that special icon. If a player clicks on such a player, CMSG_SPELLCLICK is sent. So we probably need an additional table, which maps creature entries to spellids, which are casted on interaction.

Link to comment
Share on other sites

hmm..

I Think i will test it.

I Script a Mob in EventAI which use the spell on Aggro

If the Player attack this Lootable NPC the Mob will cast the Spell and reset after this..

But theres the Problem with the Curser.. u said its just a NPC Flag? Do u have the ID?

Edit: Ok, it worked! But i need this NPC Flag with this Loot Curser

Link to comment
Share on other sites

Note that the Icon may change, even if it's the same npc flag. UNIT_NPC_FLAG_SPELLCLICK is a mechanical wheel by default i think, but for some creature_template.iconName are defined in addition. Some are for taxi master(npc supposed to take you from ground at map 609, up to "main city" for example), others may be for a vehicle. They all work in same way though (at least as far as i can tell); you click the npc (like any gossip, attack or whatever), client will send opcode, and Mangos should then handle the rest.

I personally don't think using EventAI is ok here though, it's not some aggro event taking place. Like arrai explain, the most logical will be to create a link between creature entry and spell and check for the npc flag. It may be some conditions here. For example, when you are not on quest, should the "wheel" show? Probably not, the "lootable" mob should most likely act like any other, being attackackble.

Link to comment
Share on other sites

  • 2 weeks later...

Well people, I am glad I have stumbled here.

I have a working example of a quest that uses UNIT_NPC_FLAG_SPELLCLICK

Here are the details and yes, this WOTLK quest will continue to be broken till this is implemented.

Details:

---------

Quest #12605 (http://www.wowhead.com/?quest=12605). On this quest you need to "Pickup" 6 Primordial Hatchling. As per the descriptions on WoWhead:

"The hatchlings are yellow and all you have to do is right click on them to pick them up. They are located in the burning forest nearby at 47, 27."

and

"If you attack the eggs to make the hatchlings spawn, don't use Consecrate or Death and Decay, because that makes hatchlings attack you the moment they appear."

and

"Make sure when your opening the eggs for the hatchlings that you don't start attacking the hatchling when it comes out. If you do you won't be able to pick it up."

So on This quest you are required to find these eggs in Sholazar Basin. These eggs currently require a DB Fix so they do not chase you or aggro (Very strange site to see currently)

update creature_template set flags_extra=flags_extra|2, unit_flags=unit_flags|4 where entry=28408;

So now with that fix you are able to attack the eggs and they will not aggro or attack you back.

What happens is when you "kill" the egg (http://www.wowhead.com/?npc=28408) it should spawn on death:

Primordial Hatchling (http://www.wowhead.com/?npc=28389).

This is accomplished using Creature_AI and casting spell (http://www.wowhead.com/?spell=51595) on NPC death.

('2840801','28408','6','0','100','0','0','0','0','0','11','51595','0','0','0','0','0','0','0','0','0','0','Primordial Drake Egg - Summon Primordial Hatchling on Death');

So now we are able to get the Hatchling to spawn for us. Now comes the tricky part that I was scratching my head about until I found out about this topic....

To "Pickup" this NPC and get an inventory Quest Item you are required to have this spell cast:

Pickup Primordial Hatchling (http://www.wowhead.com/?spell=51593). This spell works properly and will place the quest item in your inventory and give you quest credit for it (With all 6 you can turn in the quest and complete it as well.... I tested this).

So how in the world does this spell get triggered I asked... Well the answer came to me by testing this spell:

Pickup Primordial Hatchling (http://www.wowhead.com/?spell=51592). This is the initial dummy trigger spell required. What this does is make the NPC despawn instantly. So you pair this up with the previous spell and it will give you a quest item in your inventory and also cause the NPC to despawn as it should (On Blizz). Thus the effect of "Picking Up The NPC".

Now the only problem we have is there is no "Quest Item" given to you or anything that can be used as a trigger point for spell 51592 to occur... to set off the chain of events that will give you the quest credit.

This is where UNIT_NPC_FLAG_SPELLCLICK comes in. This is our TRIGGER for that spell. If you are on this quest it will allow this flag option to click on the NPC and it will be linked to this initial dummy spell and casts it. There is no visual for this spell so it is a seemless transition.

So this is concrete proof that blizz uses this same system for this quest and most likely MANY more in WOTLK.

I agree that is entire event should NOT take place in Creature_AI. ACID can handle the initial quest setup functions like I already have for this quest but the actual UNIT_NPC_FLAG_SPELLCLICK MUST be handled within the core.

With all the info I have provided I hope this will give us something we can use for testing such a new feature to get it working as intended.

Thank You! :cool:

Link to comment
Share on other sites

If you are on this quest it will allow this flag option to click on the NPC and it will be linked to this initial dummy spell and casts it. There is no visual for this spell so it is a seemless transition.
Did you find that spellid somewhere in the UNIT_FIELD or do we have to add a new table spellclick_links(int npc_entry, int spellid)?
Link to comment
Share on other sites

+ `cast_flags` INT NOT NULL COMMENT 'first bit defines caster: 1=player, 0=creature; second bit defines target, same mapping as caster bit'

Is this really need?

Maybe spell always casted by player to creature, but spell have target mode "self" in case spell effect that expected to casted to player?

+ _player->EnterVehicle(vehicle);

I think this is must be moved to related spell cast aura apply code... instead special case...

Link to comment
Share on other sites

Hey Arrai,

I did the testing as you requested for the latest version. I am still unable to get it working. There is no "Alternate" icon presented and my only option is to attack them NPC. (I had to manually add the NPC)

I also noticed in Mangos Spell 51595 is not working. It does not summon the NPC so my ACID script currently does not work. It DOES work however in Trinity but I am unable to test this in Mangos (I overcome this problem I added the NPC Manually using .npc add 28389).

So unless something special happens when you use Spell 51595 it does something else special.

(I am doing my best to test this and get it working)

Link to comment
Share on other sites

Is this really need?

Maybe spell always casted by player to creature, but spell have target mode "self" in case spell effect that expected to casted to player?

I don't guess so, spell http://www.wowhead.com/?spell=51593 has ImplicitTargetA=25. So either our implementation of that targettype is wrong or the solution I suggested is correct
I think this is must be moved to related spell cast aura apply code... instead special case...
Yes, I will remove that code in a later version
I did the testing as you requested for the latest version. I am still unable to get it working. There is no "Alternate" icon presented and my only option is to attack them NPC. (I had to manually add the NPC)
Try to set quest=0 in npc_spellclick_spells. Did you gave that npc the SPELLCLICK flag?

I also noticed in Mangos Spell 51595 is not working. It does not summon the NPC so my ACID script currently does not work.

Might be a missing summontype.
Link to comment
Share on other sites

Well, with your system as we discussed this IS working now. But for Mangos we need to fix Spell 51595 (Summon) and also Spell 51592 (Despawn NPC). Because currently you can re-loot the SAME NPC 6 times and complete the quest right away. But if the NPC despawns with the proper spell then this SHOULD work like official.

I already have ACID support for this example quest and if we get this all cleaned up and implimented we will be in a position to fix a bunch of WOTLK quests.

Link to comment
Share on other sites

Well, with your system as we discussed this IS working now. But for Mangos we need to fix Spell 51595 (Summon)
I verified that it's a missing summon type - i will try to change the whole hardcoded summontype system by using SummonProperties.dbc.

I've updated my patch to implement despawning the NPS and added a better vehicle support - they also work using CMSG_SPELLCLICK.

Here are some example values, which will allows both picking up npc # 28389 and mounting npc #27629

INSERT INTO `npc_spellclick_spells` (`npc_entry`, `spell_id`, `quest_id`, `cast_flags`) VALUES
(28389, 51592, 12605, 1),
(28389, 51593, 12605, 3),
(27629, 49256, 0, 1);

Please test:)

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use