Jump to content

Quest question

By Смердокрыл
in Miscellaneous

Recommended Posts

Hey!

I wanna make a quest for the newly created characters (I want them to have the quest automatically when they are created) that would require them to use a nearby chest, which drops an item. An autocompletion thing should then come up.

Main points:

  • the item should not be consumed by the quest, so that the characters can later equip it
  • there are no NPCs involved (the quest is accepted and rewarded automatically)
  • I don't mind either using the object or receiving the item to trigger quest completion, as long as the item isn't consumed

Please, help

or not


 skarnnoggitlogpost.thumb.jpg.d752b4e8541

Link to comment
Share on other sites

A brief ponder and I've concluded adding quests on character creation can be done by the following:
- Execute a query in the process that creates a new character, inserting into character_queststatus the relevant details
- Character enters the world in an AreaTrigger that has a script to add the quest via a smart_script

I know the functionality involved in the quest completing upon the item being acquired. It was done very often in Cataclysm with the portraits showing up, but I'm too lazy to go find out how that's done.

However, for actually meeting the quest criteria, you could attach a smart_script to a chest object despawning - something it only does when its loot table has been emptied out. That smart_script could complete the criteria for the player who looted it and therefore the item itself would not be at all related to the quest but nonetheless be required to loot.

Iy6QvK4.png

Link to comment
Share on other sites

12 hours ago, Razmataz said:

That smart_script could complete the criteria for the player who looted it and therefore the item itself would not be at all related to the quest but nonetheless be required to loot.

Actually, I had a similar idea, but I don't think I found a smart_script action like that. Maybe I just missed it, I'll have another look today.

So, what requirement should I put in quest_template? I must put something, else it will just auto-complete instantly after being picked up.

12 hours ago, Razmataz said:

A brief ponder and I've concluded adding quests on character creation can be done by the following:

Both of "the following", or either?

12 hours ago, Razmataz said:

- Execute a query in the process that creates a new character, inserting into character_queststatus the relevant details

What do you mean? Editing the core?

12 hours ago, Razmataz said:

- Character enters the world in an AreaTrigger that has a script to add the quest via a smart_script

What exactly is an AreaTrigger? Something like an invisible imp npc? If not, how do I create one?

By the way, how can I make a 3d model show up in the quest window, like in those cataclysm quests you mentioned?

or not


 skarnnoggitlogpost.thumb.jpg.d752b4e8541

Link to comment
Share on other sites

16 hours ago, Razmataz said:

That smart_script could complete the criteria for the player who looted it

3 hours ago, Смердокрыл said:

Actually, I had a similar idea, but I don't think I found a smart_script action like that

Apparently there are only "add quest" and "fail quest" action_types. How insanely stupid

or not


 skarnnoggitlogpost.thumb.jpg.d752b4e8541

Link to comment
Share on other sites

11 hours ago, Смердокрыл said:

Actually, I had a similar idea, but I don't think I found a smart_script action like that. Maybe I just missed it, I'll have another look today.

You can use a smart_script. Use script SMART_ACTION_CALL_KILLEDMONSTER to award credit for a quest_objective that requires a certain NPC to be killed :)

 

11 hours ago, Смердокрыл said:

Both of "the following", or either?

On 2/14/2017 at 9:23 PM, Razmataz said:

Either works.

 

11 hours ago, Смердокрыл said:

What do you mean? Editing the core?

On 2/14/2017 at 9:23 PM, Razmataz said:

Yes. Probably in CharacterHandler.cpp WorldSession::HandleCharCreateOpcode, an insert into Character_QuestStatus (I think you'll need to add it to CharacterDatabase.cpp and .h as well)

 

11 hours ago, Смердокрыл said:

What exactly is an AreaTrigger? Something like an invisible imp npc? If not, how do I create one?

Yeah, it's a region of space made by some shape of some size around some centre coordinates that, upon entering, can execute a script through areatrigger_script or even Smart_Scripts (SMART_SCRIPT_TYPE_AREATRIGGER is source_type 2).

With one of the latest TrinityCore revisions you seem to be able to make AreaTriggers with Areatrigger_template. I've not dabbled, so I dunno how it might end up. You might also be lucky enough to find one of Blizzard's areatriggers serves your purposes.

 

11 hours ago, Смердокрыл said:

By the way, how can I make a 3d model show up in the quest window, like in those cataclysm quests you mentioned?

Quest_Template PortraitGiverText and Name is all I can find. They do not appear to be documented.

Iy6QvK4.png

Link to comment
Share on other sites

Here's my quest:

Spoiler

INSERT INTO `quest_template` (`ID`, `QuestType`, `QuestLevel`, `MinLevel`, `QuestSortID`, `QuestInfoID`, `SuggestedGroupNum`, `RequiredFactionId1`, `RequiredFactionId2`, `RequiredFactionValue1`, `RequiredFactionValue2`, `RewardNextQuest`, `RewardXPDifficulty`, `RewardMoney`, `RewardBonusMoney`, `RewardDisplaySpell`, `RewardSpell`, `RewardHonor`, `RewardKillHonor`, `StartItem`, `Flags`, `MinimapTargetMark`, `RequiredPlayerKills`, `RewardSkillId`, `RewardSkillPoints`, `RewardReputationMask`, `QuestGiverPortrait`, `QuestTurnInPortrait`, `RewardItem1`, `RewardAmount1`, `RewardItem2`, `RewardAmount2`, `RewardItem3`, `RewardAmount3`, `RewardItem4`, `RewardAmount4`, `ItemDrop1`, `ItemDropQuantity1`, `ItemDrop2`, `ItemDropQuantity2`, `ItemDrop3`, `ItemDropQuantity3`, `ItemDrop4`, `ItemDropQuantity4`, `RewardChoiceItemID1`, `RewardChoiceItemQuantity1`, `RewardChoiceItemID2`, `RewardChoiceItemQuantity2`, `RewardChoiceItemID3`, `RewardChoiceItemQuantity3`, `RewardChoiceItemID4`, `RewardChoiceItemQuantity4`, `RewardChoiceItemID5`, `RewardChoiceItemQuantity5`, `RewardChoiceItemID6`, `RewardChoiceItemQuantity6`, `POIContinent`, `POIx`, `POIy`, `POIPriority`, `RewardTitle`, `RewardTalents`, `RewardArenaPoints`, `RewardFactionID1`, `RewardFactionValue1`, `RewardFactionOverride1`, `RewardFactionID2`, `RewardFactionValue2`, `RewardFactionOverride2`, `RewardFactionID3`, `RewardFactionValue3`, `RewardFactionOverride3`, `RewardFactionID4`, `RewardFactionValue4`, `RewardFactionOverride4`, `RewardFactionID5`, `RewardFactionValue5`, `RewardFactionOverride5`, `TimeAllowed`, `AllowableRaces`, `LogTitle`, `LogDescription`, `QuestDescription`, `AreaDescription`, `QuestCompletionLog`, `RequiredNpcOrGo1`, `RequiredNpcOrGo2`, `RequiredNpcOrGo3`, `RequiredNpcOrGo4`, `RequiredNpcOrGoCount1`, `RequiredNpcOrGoCount2`, `RequiredNpcOrGoCount3`, `RequiredNpcOrGoCount4`, `RequiredItemId1`, `RequiredItemId2`, `RequiredItemId3`, `RequiredItemId4`, `RequiredItemId5`, `RequiredItemId6`, `RequiredItemCount1`, `RequiredItemCount2`, `RequiredItemCount3`, `RequiredItemCount4`, `RequiredItemCount5`, `RequiredItemCount6`, `RequiredSpell`, `ObjectiveText1`, `ObjectiveText2`, `ObjectiveText3`, `ObjectiveText4`, `RewardCurrencyId1`, `RewardCurrencyId2`, `RewardCurrencyId3`, `RewardCurrencyId4`, `RewardCurrencyCount1`, `RewardCurrencyCount2`, `RewardCurrencyCount3`, `RewardCurrencyCount4`, `RequiredCurrencyId1`, `RequiredCurrencyId2`, `RequiredCurrencyId3`, `RequiredCurrencyId4`, `RequiredCurrencyCount1`, `RequiredCurrencyCount2`, `RequiredCurrencyCount3`, `RequiredCurrencyCount4`, `QuestGiverTextWindow`, `QuestGiverTargetName`, `QuestTurnTextWindow`, `QuestTurnTargetName`, `SoundAccept`, `SoundTurnIn`, `VerifiedBuild`) VALUES (30562, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 524288, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'QuestName', 'LogDesc', 'QuestDesc', 'AreaDesc', 'QuestComp', 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Objective', 'Objective', 'Objective', 'Objective', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 'QuestComp', '', 890, 878, 15595);

 

The gameobject:

Spoiler

INSERT INTO `gameobject_template` (`entry`, `type`, `displayId`, `name`, `IconName`, `castBarCaption`, `unk1`, `size`, `Data0`, `Data1`, `Data2`, `Data3`, `Data4`, `Data5`, `Data6`, `Data7`, `Data8`, `Data9`, `Data10`, `Data11`, `Data12`, `Data13`, `Data14`, `Data15`, `Data16`, `Data17`, `Data18`, `Data19`, `Data20`, `Data21`, `Data22`, `Data23`, `Data24`, `Data25`, `Data26`, `Data27`, `Data28`, `Data29`, `Data30`, `Data31`, `unkInt32`, `AIName`, `ScriptName`, `VerifiedBuild`) VALUES (300208, 3, 79174, 'GobName', '', '', '', 1, 2, 195673, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0);

 

The loot table:

Spoiler

INSERT INTO `gameobject_loot_template` (`Entry`, `Item`, `Reference`, `Chance`, `QuestRequired`, `LootMode`, `GroupId`, `MinCount`, `MaxCount`, `Comment`) VALUES (195673, 80013, 0, 100, 0, 1, 0, 1, 1, NULL);

 

And the (not too) smart script:

Spoiler

INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES (300208, 1, 0, 0, 25, 0, 100, 0, 0, 0, 0, 0, 33, 1, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Finish quest by looting the gobject');

 

 

It's not working :\

or not


 skarnnoggitlogpost.thumb.jpg.d752b4e8541

Link to comment
Share on other sites

You need to create a new NPC, let's call it "Interact with Gobname" and let's give it an entry $ID.
In the Quest_template, requirednpcorgo needs to be $ID and RequiredNpcOrGoCount needs to be 1.
In Smart_script, Param1 needs to be $ID.

Right now your smart_script is probably triggering but you've not ordered it to credit the player with any monster kills, nor does your quest track those monster kills.

Iy6QvK4.png

Link to comment
Share on other sites

After a little research, I came up with some ideas as to how to proceed with this:

  • Try target type 27 (SMART_TARGET_LOOT_RECIPIENTS). This leaves me with the problem of the gameobject being available for looting to any players, not just those with the quest
  • Try a completely different method:
    1. Change gobject type to 2(QUESTGIVER)
    2. Add it to the gameobject_questender table
    3. Add a smart script with event type 20(SMART_EVENT_REWARD_QUEST), action type 56(SMART_ACTION_ADD_ITEM), and target type 7(SMART_TARGET_ACTION_INVOKER) 

The latter seems like a good option, because since the event is quest-related, it will only give the item to characters with the quest. However, I don't know whether questgiver gobjects work similarly to chest objects in being visible only to characters who have the related quest (for chests, the id goes to data8). Moreover, given the weirdness of the whole SmartAI system, I don't know whether the whole thing will actually work.

On 2/15/2017 at 0:03 AM, Razmataz said:

With one of the latest TrinityCore revisions you seem to be able to make AreaTriggers with Areatrigger_template. I've not dabbled, so I dunno how it might end up. You might also be lucky enough to find one of Blizzard's areatriggers serves your purposes.

To add the quest, I could do the following:

  1. Add an entry to AreaTrigger.dbc with the coordinates of the character starting point
  2. Add it to the areatrigger_scripts table with ScriptName "SmartTrigger"
  3. Make a smart script with event type 46(SMART_EVENT_AREATRIGGER_ONTRIGGER), action type 7 (SMART_ACTION_OFFER_QUEST) and Param2=1, and target type 7(SMART_ACTION_INVOKER)

However, I would expect this to give the quest to all players who step into the trigger, not just newly created characters, which is a problem. Would it be possible to add into the smart script a check whether the quest has been previously completed by the character? Also, the functionality of the ACTION_INVOKER target type is questionable.

or not


 skarnnoggitlogpost.thumb.jpg.d752b4e8541

Link to comment
Share on other sites

13 hours ago, Смердокрыл said:

However, I would expect this to give the quest to all players who step into the trigger, not just newly created characters, which is a problem. Would it be possible to add into the smart script a check whether the quest has been previously completed by the character? Also, the functionality of the ACTION_INVOKER target type is questionable.

You can use the Conditions table. You use the condition CONDITION_QUEST_NONE in conjunction with a CONDITION_SOURCE_TYPE_SMART_EVENT that details the smart_script you're dealing with. As long as the person meets the condition that they have not gotten/done the quest, they cannot execute the smart_script you define.

Another thing - I just realised and it is probably what was causing the initial stuff to not work - you didn't set the Gameobject to use SmartAI. You need to set 'AIName' to 'SmartGameObjectAI'.

Iy6QvK4.png

Link to comment
Share on other sites

1 hour ago, Razmataz said:

You can use the Conditions table

This worked wonderfully. Thank you so much!

AIName wasn't the problem. I'm not sure what was, but I think it was my quest type that was set to 2, or some flags, or whatever. It's complicated : )

Anyway, following the example of that Creepy Crate quest, I just made that object to be questender and give the item as quest reward.

So, basically, the whole quest, meaning getting it, doing it, and completing it - works fine. However, there's one thing left: would it be possible, for example using that conditions table, to make the object disappear (and never return) after being used to complete the quest, but only for the player who completed the quest? In short, for the player who is doing the quest, it would look as if he picked up the object, therefore it is no longer where it used to be. New players, however, would still see it there, because they haven't picked it up yet.

And another question on SmartAI, if you don't mind: I made a boat vehicle creature (the vehicle nature of it works fine, just in case), and I want it to do the following things:

  • Every time it is unmounted (PASSENGER_REMOVED or CHARMED with param 1, maybe?) it needs to change it's original position (isn't that what SET_HOME_POS does?) to it's current coordinates, so that even after the server is restarted, it would spawn there
  • Since it's using a waterwalk aura, I can't just spawn it on the water - it has to be a little bit below the water surface (z = -0.48, to be exact) in order to look partially submerged, like normal boats. I want the boats to jump to this coordinate (only Z) every time they are spawned/respawned/mounted. You know, in case they've been moved up/down somehow or whatever.
  • Not being able to walk/run on land

Could you help me with these?

or not


 skarnnoggitlogpost.thumb.jpg.d752b4e8541

Link to comment
Share on other sites

23 minutes ago, Смердокрыл said:

However, there's one thing left: would it be possible, for example using that conditions table, to make the object disappear (and never return) after being used to complete the quest, but only for the player who completed the quest?

Based on https://github.com/TrinityCore/TrinityCore/issues/18254 it looks like the functionality is not in yet.

 

23 minutes ago, Смердокрыл said:
  • Every time it is unmounted (PASSENGER_REMOVED or CHARMED with param 1, maybe?) it needs to change it's original position (isn't that what SET_HOME_POS does?) to it's current coordinates, so that even after the server is restarted, it would spawn there

SMART_ACTION_SET_HOME_POS is probably to do with creature AI, as the below snippet suggests.

if (Unit* unit = GetCharmerOrOwner())
        return victim->IsWithinDist(unit, dist);
    else
        return victim->IsInDist(&m_homePosition, dist);

You might actually have to endeavour in making a smart_script action that executes

creature->Relocate(x, y, z, o);

PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_CREATURE_POSITION);

stmt->setFloat(0, x);
stmt->setFloat(1, y);
stmt->setFloat(2, z);
stmt->setFloat(3, o);
stmt->setUInt64(4, lowguid);

WorldDatabase.Execute(stmt);

creature->SendTeleportPacket(creature->GetPosition());

You might or might not get the correct x, y and z coordinates from repurposing the SET_HOME_POS code. That's something you'd have to figure out I'm afraid!

 

23 minutes ago, Смердокрыл said:
  • Since it's using a waterwalk aura, I can't just spawn it on the water - it has to be a little bit below the water surface (z = -0.48, to be exact) in order to look partially submerged, like normal boats. I want the boats to jump to this coordinate (only Z) every time they are spawned/respawned/mounted. You know, in case they've been moved up/down somehow or whatever.

If you set its teleport to the exact coordinates it has when you exit, it might be fine. The only other way is to make the smart_script explicit for your boat to always set it to z = -0.48 and the x and y are other arguments entirely.

 

23 minutes ago, Смердокрыл said:
  • Not being able to walk/run on land

...CONDITION_IN_WATER? Maybe? Force eject them?

Another answer is creating a new inhabittype that restricts the boat from exiting water. I haven't a clue how to do this.

Iy6QvK4.png

Link to comment
Share on other sites

7 minutes ago, Razmataz said:

If you set its teleport to the exact coordinates it has when you exit, it might be fine. The only other way is to make the smart_script explicit for your boat to always set it to z = -0.48 and the x and y are other arguments entirely.

I don't quite understand what you mean. I want it to keep it's current x and y coordinates, but change it's z coordinate to -0.48.

9 minutes ago, Razmataz said:

...CONDITION_IN_WATER? Maybe?

Yes, but after the condition is checked, I need a certain smart script not to allow the boat to move, an it has to be checked during movement, so that if the boat collides with the shore, it would get stuck. Unfortunately, there is nothing similar to SMART_EVENT_CONDITION_CHANGE, so I have to choose another event type, and I really don't know which.

 

So, for the vehicle being mounted (or not), is it SMART_EVENT_CHARMED 0/1 or SMART_EVENT_PASSENGER_BOARDED/REMOVED?

or not


 skarnnoggitlogpost.thumb.jpg.d752b4e8541

Link to comment
Share on other sites

44 minutes ago, Смердокрыл said:

I don't quite understand what you mean. I want it to keep it's current x and y coordinates, but change it's z coordinate to -0.48.

1 hour ago, Razmataz said:

Yeah, sorry, you'd need to make a completely new smart_script action then. Potentially where the x, y and z parameters in that smart_script do ± the xyz coordinates it is at, so that you have 0, 0, -0.48. I can't think of any other way.

 

45 minutes ago, Смердокрыл said:

Yes, but after the condition is checked, I need a certain smart script not to allow the boat to move, an it has to be checked during movement,

Honestly the idea that you have is just not feasible without a large scale core edit. TrinityCore hasn't got any documentation on http://www.wowhead.com/item=85500/anglers-fishing-raft which is the closest thing I can find - preventing something from accessing land. It's a vehicle sort of thing because you're able to fish while on it (afaik).

 

48 minutes ago, Смердокрыл said:

So, for the vehicle being mounted (or not), is it SMART_EVENT_CHARMED 0/1 or SMART_EVENT_PASSENGER_BOARDED/REMOVED?

Don't know.

Iy6QvK4.png

Link to comment
Share on other sites

×
×
  • Create New...