New SAI action: set gossip ID?

(hopefully this is the correct subforum - though this involves SAI it also involves changes to other core code)

I was trying to script Pusillin in Dire Maul with SAI and it appears I’d need an SAI action that can change a unit’s gossip ID.

Since gossipID is currently pulled straight from CreatureInfo/GoInfo (the template data), there’s no existing way for a script to change it.

My idea:

  1. add getGossipID to GameObjectAI & CreatureAI base classes. The base implementation will just use the creatureInfo/goInfo like they do now

  2. add getGossipID to Creature & GameObject classes, these will defer to the AI’s getGossipID if they have an AI, otherwise they’ll use the template info like they do now.

  3. all locations in the core where the gossipID is currently pulled from creatureinfo/goinfo will be changed to use the new Creature.getGossipID() & GameObject.getGossipID()

  4. create the SAI action SMART_ACTION_SET_GOSSIP_ID

  5. SmartAI & SmartGameObjectAI will override getGossipID and return a local member gossipID if it has been set by a previous action (otherwise it will return the template gossipID)

I can create the patch file for this, but wanted to run it past the devs to make sure I’m not going about it all wrong.

Changing gossip id is a hack.

But it could be implemented with something like “smart_action_send_gossip” where you could define which gossip option text / npc_text id to show (using current ADD_GOSSIP_ITEM(), SendGossipMenu())

I tried to fix Pusillin too but that can’t be done DB side (yet).

Sounds good. My only question then is: we have 6 action parameter columns available, how can we best use them? Maybe this:

npc text ID,

option icon,

option text ID 1,

actionNum 1,

option text ID 2

actionNum 2

All fields except npc text ID would be optional.

This would allow 2 different response options max, and they’d have to have the same icon. Is it safe to assume all options will be GOSSIP_SENDER_MAIN? The other sender types seem like they shouldn’t generally be used in AI scripts.

action_param1: npc_text.ID

action_param2: gossip_menu_option.menu_id


action_param4: boolean → if != 0, remove the menu_id/id (param2/3) from the creature

I’m not sure about what GOSSIP_SENDER_MAIN does (I never did a core gossip script)

I’ve tossed together the attached patch & tested it with scripts on both npcs & gameobjects, seems to work fine.

It only handles the 1st 2 parameters you described (param2 is optional if we just want to display the text without a response other than goodbye). I wasn’t clear on what you want to accomplish with param3 & param4. If you could give an example of a situation where you’re trying to remove an option I could see if I can alter it to handle that.

Note that it still respects the conditions table for gossip menu options, so if you want to hide a specific option under certain conditions that would probably work, too.

If it’s ready to be added as a ticket to the tracker I can toss it on there, just let me know. Thanks

PS Here’s SQL for a couple test scripts:

-- set orgrimmar frostwolf emissary to say ghost wolf text:

UPDATE `creature_template` SET `AiName` ='SmartAI' WHERE `entry` = 15106;

INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`event_type`,`action_type`,`action_param1`,`action_param2`,`target_type`,`comment`)

VALUES (15106,0,0,64,94,521,7495,7,'test-frostwolf emmissary speak on gossip hello');

-- have shards of myzrael in arathi respond with same text as above

UPDATE `gameobject_template` SET `ainame` = 'SmartGameObjectAI' WHERE `entry` = 138492;

INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`event_type`,`action_type`,`action_param1`,`action_param2`,`target_type`,`COMMENT`)

VALUES (138492,1,0,64,94,521,7495,7,'test-myzrael shard speak on gossip hello');

How would you script Pusillin where both the npc_text and the option that players click changes 3 or 4 times?

Btw, you didn’t attach anything /emoticons/default_tongue.png

I really attached it this time, oops.

To get Pusillin to work I would use event phase. Each onGossipHello event would have an event phase filter and based on phase show the correct npc_text & gossip_menu_option, and each gossip select would increment the phase & kick off his next waypoint movement.


Pushed to repo on…2e4f07afa6db21a

Thank you very much.

(Pusillin fix is next)