Jump to content

Triggering an action as part of a quest reward?


Recommended Posts

Hey, all. I'm wondering if this is possible with XPath/XML, or if custom C# code would be necessary.

 

I would like to trigger an action when the player completes a particular quest. The action already exists in the game as a triggered event.

 

Here's an example. Suppose I want to add a journal entry the first time the player completes a specific kind of quest. If I could just use a triggered_event tag, it might look something like this:

<triggered_effect trigger="onQuestFinished" action="AddJournalEntry" journal="myCustomJournalEntryTip">

 

(That's not what I actually want to do, that's just an example.)

 

Is there a reward type that does something similar?

 

...and, I know I could reward the user with a book that triggers that event when read. But I intentionally want the event to not involve player choice - they complete the quest, the action triggers, whether they like it or not.

 

Edited by khzmusik (see edit history)
Link to comment
Share on other sites

Well I was hoping to keep it a secret. Oh well. :)

 

I'm planning to do some quests that target different NPC factions. One thing I'd like to do is a "fetch" quest that targets the different faction POIs. For example, if the trader is sympathetic to Whiteriver, he'd say something like "the Duke stole something and we want it back" and send you on a fetch quest to a Duke POI. Other than the lore around it, the quest would still be a basic fetch quest.

 

The catch is that maybe the Duke's clan don't mind the player so much. So the player can just go in, search around the POI until they find the quest satchel, gather it, and return to the trader - all without fighting the Duke's clan members.

 

All of the above is actually by design, I know how to do all of it (with some SphereII Core help), and there are no issues.

 

But, I'd like it to have consequences. So, when that "fetch" quest is turned in to the trader, I'd like the player's relationship with the Duke faction to get worse. The code to change the player's faction relationship is in SphereII Core already, but it's a triggered action. The change in faction relationship is not done with a buff or with cvars, it literally sets a C# variable in the code.

 

So, I'd like this action to trigger as a "reward" for completing the quest.

 

Does that help at all? Or does it just confuse matters? 

Link to comment
Share on other sites

Hmm well that does make it trickier.. I dont dabble in code cuz well... i dont have the brains for that. I stick to making loopholes in the xmls to do what i want. lol... My way of doing it, had this been a cvar, would be something ive used in mods that i have on hold.. i was working on a quest world mod as well and needed certain things to appear in loot / cvars to change depending on what quest the player was on.. So i would have a fake quest... So.. bear with me here.

Quest A is the one the player does.. it rewards an item that, when held in the inventory (due to the "PlayerItemCount" requirement), would do something. Either slow the player completely to a stop, or change a cvar or something. Then have quest A reward the item, as well as quest B, which would have the objective to gather said item. This way it gets put into the players inventory, changing the cvar or whatever i needed, and then removed. If i needed the item to last a while, i would make it so the player cannot drop it.. The only issue with that is if the player puts it in their supply chests or something.

But as a non codey, that would be my hacky method of doing something based on a quest... This wont help in your case since their variables are not actually cvars, but actual variables.. But it might give some ideas on how to do it with codes... Sorry i can't help much!

Link to comment
Share on other sites

1 hour ago, Telric said:

Quest A is the one the player does.. it rewards an item that, when held in the inventory (due to the "PlayerItemCount" requirement), would do something. Either slow the player completely to a stop, or change a cvar or something. Then have quest A reward the item, as well as quest B, which would have the objective to gather said item. This way it gets put into the players inventory, changing the cvar or whatever i needed, and then removed. If i needed the item to last a while, i would make it so the player cannot drop it.. The only issue with that is if the player puts it in their supply chests or something.

 

Well, it sounds like I'll need to write some C# code to do what I want. Oh, well. I was hoping to avoid that, but c'est la vie.

 

But - the talk of Quest A/B did remind me of another riddle I've been trying to solve, and you might have alluded to a solution (if I understand right).

 

When you said "it gets put into the players inventory... and then removed" what was the "it" you were talking about? The item itself, or the buff?

 

I ask because I would like to create a quest that has a requirement that the player be wearing a specific item of clothing, and that clothing is given by the trader when the quest starts (it's a reward that is given in the "start" phase).

 

But I'd also like that item of clothing to be removed from the player's inventory when the quest is done - "done" meaning either turning in the quest or failing it. I don't want the clothing to be available to the player unless they're actively doing the quest.

 

I didn't quite understand all of what you were talking about with the two quests. Do you think something similar could be used to solve my quandary?

Link to comment
Share on other sites

It was just a generic item, but could be anything... I'm not able to test right now, but you might be able to make a 3 part quest.. Player accepts first quest. This one auto completes and rewards the items, then quest 2 is the real quest that shows the quest text and what not with the actual objectives. the player finishes those objectives and has one more pop up saying to fetch the clothing items. This is where i'd need to test.. If fetch quest objectives count what the player is wearing or not. If it doesnt, then the player would need to unequip the items for the quest to continue on.

It may work, it may not.. i'm not sure without testing. Some hacky bits will definitly be better with code though. :)

Link to comment
Share on other sites

You don't actually need the first quest in order to reward the player with items. If you specify that the items are given in the "start" phase, the player will have them in their inventory as soon as they accept the quest.

 

Here's an example. The player gets a plant fiber shirt when the quest starts. They are required to put it on and kill two zombies while wearing it.

<quest id="quest_KillZombiesInAPlantFiberShirt">
    <!-- ...the usual quest stuff omitted... -->

    <!-- This objective will automatically complete since we gave the player the shirt as a starting "reward" -->
    <objective type="FetchKeep" id="apparelPlantFiberShirt" value="1" phase="1" />

    <!-- Now continue with additional objectives in different phases -->
    <objective type="Wear" id="apparelPlantFiberShirt" phase="2" />
    <objective type="ZombieKill" value="2" phase="3" />
    <requirement type="Wearing" id="apparelPlantFiberShirt" phase="3" />

    <!-- This will automatically give the player the shirt when the quest starts -->
    <reward type="Item" id="apparelPlantFiberShirt" value="1" stage="start" />
    <!-- These are given when the quest completes -->
    <reward type="Exp" value="500" />
    <reward type="Item" id="casinoCoin" value="350" />
</quest>

 

Now, the question is - after the quest is over, can I take the shirt back?

 

(As a hypothetical background - let's say plant fiber shirts can't be crafted or looted. I want to make sure that no player could ever have them unless they were doing this quest.)

Link to comment
Share on other sites

...I've been thinking about this some more, and I think I can do what I want without needing to remove the item upon quest completion. But I'm going to leave this question open because others might find it useful. So if anyone out there does have a solution, let's hear it. :)

 

(EDIT: I realized that I'd have to do something different when I thought about the player not turning the quest in. What if they died? What if they failed the quest? etc.)

Edited by khzmusik (see edit history)
Link to comment
Share on other sites

1 hour ago, Laz Man said:

You can add journal tips via quests similar to how the tutorial quest chain does it.  

If you need an example I did it in my expanded quest mod (bloodmoon vanguard quest)

 

Thanks, but the journal tip was just an example. Really what I'd like to do is trigger one of SphereII's custom MinEvent actions.

 

The actions that you can put in the quest's <action> tag are not the same kind of actions. The only (vanilla) quest actions available are "ShowTip", "SpawnEnemy", "TrackQuest", and "TreasureChest". You could not use, say, the vanilla "AddBuff", "ModifyCVar", "ModifyScreenEffect", or "PlaySound" actions like you can for a triggered_effect.

 

Though, I did look at your quest mod, and it actually helped with another quest idea I had (a "tower defense" of a POI). So, thanks!

Edited by khzmusik (see edit history)
Link to comment
Share on other sites

  • 4 months later...
5 hours ago, Vegars said:

Depends what you wanna do i guess. More info would help. Buffs are quite nice and they might could be used  to do something, depending on what you want...

 

Pretty sure I mentioned exactly what I want to do...

 

It's already implemented in my Human Faction Quests modlet. What I do now, is reward the player with a book that, when read, triggers a buff that alters their faction relationships.

 

It's pretty easy to cheese since it's totally up to the player whether to read the book or not (or save it for later, whatever).

 

If it were possible to trigger a buff as a reward for a quest, then that would be preferable. But AFAIK there is no way to do that.  The only vanilla reward types are "Exp" (experience), "Item" (for particular items, usually casino tokens), "LootItem" (for an item from a loot group), "Quest", "ShowTip", and "SkillPoints".

 

Maybe I can help SphereII code up something for the A20 version of Core that will do this, but it's not feasible in A19.

Link to comment
Share on other sites

7 hours ago, khzmusik said:

 

Pretty sure I mentioned exactly what I want to do...

 

It's already implemented in my Human Faction Quests modlet. What I do now, is reward the player with a book that, when read, triggers a buff that alters their faction relationships.

 

It's pretty easy to cheese since it's totally up to the player whether to read the book or not (or save it for later, whatever).

 

If it were possible to trigger a buff as a reward for a quest, then that would be preferable. But AFAIK there is no way to do that.  The only vanilla reward types are "Exp" (experience), "Item" (for particular items, usually casino tokens), "LootItem" (for an item from a loot group), "Quest", "ShowTip", and "SkillPoints".

 

Maybe I can help SphereII code up something for the A20 version of Core that will do this, but it's not feasible in A19.

That was a spam post by a bot.  It just reposted the second post in this thread as its own

Link to comment
Share on other sites

19 hours ago, khzmusik said:

 

Whoops, sorry... I didn't even notice it just copied Telric's post. Spam bots are getting smarter I guess.

 

Not really (either the bots were clumsy or the person who used them).  You might have missed it when they first hit the forums.  There were something like new posts on 20+ threads in this subforum by only 2 usernames at the same time.  When you start looking at them, they were always alternating and both usernames posted the exact same thing in groups of 2 threads (so one username posted Thanks XXXXX and the other username posted the same thing in the next thread down).  Once you noticed that pattern, it was pretty obvious that they were bots posting.  It took me awhile to figure out where they were getting the text to post, but then I noticed that they would take a snatch of conversation from a previous post and post it as its own.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...