Gather Quest
- supadupa64
- Posts: 200
- Joined: Sun Mar 06, 2016 9:40 pm
- Contact:
Gather Quest
I set up everything perfectly to gather items, but I just can't figure out how to gather the item. The dialogue is set up, but when I try to interact with the object I can't get it to destroy and be added to the quest.
Game I'm working on:
Website: http://www.RuctionGames.com
Steam: http://store.steampowered.com/app/49682 ... en_Tablet/
Website: http://www.RuctionGames.com
Steam: http://store.steampowered.com/app/49682 ... en_Tablet/
Re: Gather Quest
Add this script to your object:
DestroyOnUse.cs
Also add a Persistent Destructible component. This will make saved games record the fact it was destroyed. When you load the game, it will make sure the object is still destroyed.
DestroyOnUse.cs
Code: Select all
using UnityEngine;
public class DestroyOnUse : MonoBehaviour
{
public PixelCrushers.DialogueSystem.Condition condition;
void OnUse(Transform user)
{
if (condition.IsTrue(user)) Destroy(this.gameObject);
}
}
- supadupa64
- Posts: 200
- Joined: Sun Mar 06, 2016 9:40 pm
- Contact:
Re: Gather Quest
Awesome! Thank you!
There's just one thing. Everything works except the quest tracker doesn't keep track of the number when I gather. I can collect one, but after that it doesn't move. Although, if I collect a different object first it goes to one, then to two if I collect the first one I created. But then back to one if I collect another object! lol? It's weird. I've tested it a bunch and can't seem to figure it out.
Here's a shot, maybe this can help.
There's just one thing. Everything works except the quest tracker doesn't keep track of the number when I gather. I can collect one, but after that it doesn't move. Although, if I collect a different object first it goes to one, then to two if I collect the first one I created. But then back to one if I collect another object! lol? It's weird. I've tested it a bunch and can't seem to figure it out.
Here's a shot, maybe this can help.
Game I'm working on:
Website: http://www.RuctionGames.com
Steam: http://store.steampowered.com/app/49682 ... en_Tablet/
Website: http://www.RuctionGames.com
Steam: http://store.steampowered.com/app/49682 ... en_Tablet/
- supadupa64
- Posts: 200
- Joined: Sun Mar 06, 2016 9:40 pm
- Contact:
Re: Gather Quest
Also, in the tutorial there was one little problem I saw when I played it and with my own quest. What's to stop the player from interacting with the quest object before the player gets the quest? o.O There has to be some kind of activate object script because we can't have the player collecting scrolls without getting the quest... And I shot all your enemies in your tutorial before I got the quest, then when I got it, uh oh, I can't do the quest any more. Ya know?
Game I'm working on:
Website: http://www.RuctionGames.com
Steam: http://store.steampowered.com/app/49682 ... en_Tablet/
Website: http://www.RuctionGames.com
Steam: http://store.steampowered.com/app/49682 ... en_Tablet/
Re: Gather Quest
Hi,
What should happen when the player interacts with a scroll before accepting the quest? Here are some design choices and the technical details of how to implement them:
1. Keep the scrolls hidden until the player accepts the quest:
Check your Increment On Destroy components. If the Max value is set to 1, then it will cap "numscrollsfound" at 1, even if the starting value is higher.supadupa64 wrote:Everything works except the quest tracker doesn't keep track of the number when I gather. I can collect one, but after that it doesn't move. Although, if I collect a different object first it goes to one, then to two if I collect the first one I created. But then back to one if I collect another object! lol? It's weird. I've tested it a bunch and can't seem to figure it out.
This is partly technical and partly a design choice.supadupa64 wrote:Also, in the tutorial there was one little problem I saw when I played it and with my own quest. What's to stop the player from interacting with the quest object before the player gets the quest? o.O There has to be some kind of activate object script because we can't have the player collecting scrolls without getting the quest... And I shot all your enemies in your tutorial before I got the quest, then when I got it, uh oh, I can't do the quest any more. Ya know?
What should happen when the player interacts with a scroll before accepting the quest? Here are some design choices and the technical details of how to implement them:
1. Keep the scrolls hidden until the player accepts the quest:
- Make all the scrolls children of an empty GameObject, for example called "Quest Scrolls".
- Make this empty GameObject a child of another GameObject, for example called "Quest Objects".
- Deactivate "Quest Scrolls".
- When the player accepts the quest, use the SetActive() sequencer command to activate "Quest Scrolls":
Code: Select all
SetActive(Quest Scrolls)
- Add a Persistent Active Data component to "Quest Objects". Configure it to activate "Quest Scrolls" only if the quest is active. This is for saved games.
- Use the updated version of DestroyOnUse that I just updated in my previous post. In the Condition section, add a quest condition that the quest must be active.
- Add an Alert Trigger with a message like "You can't pick that up yet." In the Condition section, add a quest condition that the quest must be unassigned.
- Let the player collect scrolls even if he hasn't accepted the quest.
- In your quest conversation, check the value of "numscrollsfound" before offering the quest to the player. If the player has already found all the scrolls, jump to the part of the conversation where the player turns in the scrolls to complete the quest.
- supadupa64
- Posts: 200
- Joined: Sun Mar 06, 2016 9:40 pm
- Contact:
Re: Gather Quest
Thank you again! I got scrolls to appear when I accept the quest and it works great.
It's still not keeping track of the scroll count. Something is obviously messed up. I feel like the problem is with the scroll not communicating the count correctly. Also, sometimes when I go back to the quest giver I can't interact with him... Hmmmm.. https://www.youtube.com/watch?v=5ZaWlo7wiX0
It's still not keeping track of the scroll count. Something is obviously messed up. I feel like the problem is with the scroll not communicating the count correctly. Also, sometimes when I go back to the quest giver I can't interact with him... Hmmmm.. https://www.youtube.com/watch?v=5ZaWlo7wiX0
Game I'm working on:
Website: http://www.RuctionGames.com
Steam: http://store.steampowered.com/app/49682 ... en_Tablet/
Website: http://www.RuctionGames.com
Steam: http://store.steampowered.com/app/49682 ... en_Tablet/
Re: Gather Quest
Hi,
What are you using to target the NPC, the Dialogue System's Selector? If so, it's possible that your player character model is blocking the raycast from the camera to the NPC at certain angles. If this is what's happening, you can consider changing the player's Layer to Ignore Raycast, but keep in mind that this will cause it to be ignored from other raycasts, too. I don't know if that impacts any other parts of your game or not.
Another alternative: You could switch to ProximitySelector and put it on a child GameObject that has a trigger collider in front of the player.
Are all of your scrolls set up exactly the same? Do they all have Increment On Destroy components? Is the Max value 10 on all of them?
What are you using to target the NPC, the Dialogue System's Selector? If so, it's possible that your player character model is blocking the raycast from the camera to the NPC at certain angles. If this is what's happening, you can consider changing the player's Layer to Ignore Raycast, but keep in mind that this will cause it to be ignored from other raycasts, too. I don't know if that impacts any other parts of your game or not.
Another alternative: You could switch to ProximitySelector and put it on a child GameObject that has a trigger collider in front of the player.
Are all of your scrolls set up exactly the same? Do they all have Increment On Destroy components? Is the Max value 10 on all of them?
- supadupa64
- Posts: 200
- Joined: Sun Mar 06, 2016 9:40 pm
- Contact:
Re: Gather Quest
Yes, I'm using selector dialogue script to select object and things. I press "e" for use. If I go around collecting scrolls the number randomly moves from 1 to 2 and back to 1, but never higher than 2. I changed the raycast in the selector options script and it didn't work. I feel like it may be a problem with how I set up the quest maybe. If I accept this quest, pick up one scroll, then go accept another quest from another NPC, it changes the scroll count to TRUE. No idea why it does that.
Every scroll is set up like this:
Every scroll is set up like this:
Game I'm working on:
Website: http://www.RuctionGames.com
Steam: http://store.steampowered.com/app/49682 ... en_Tablet/
Website: http://www.RuctionGames.com
Steam: http://store.steampowered.com/app/49682 ... en_Tablet/
Re: Gather Quest
It's the Persistent Destructible. Give each scroll a unique Persistent Destructible > Variable Name that's not numscrollsfound -- for example, Scroll01, Scroll02, Scroll03, etc.
- supadupa64
- Posts: 200
- Joined: Sun Mar 06, 2016 9:40 pm
- Contact:
Re: Gather Quest
I mean, wow, it worked, finally! I'm speechless, lol. THANK YOU!
Game I'm working on:
Website: http://www.RuctionGames.com
Steam: http://store.steampowered.com/app/49682 ... en_Tablet/
Website: http://www.RuctionGames.com
Steam: http://store.steampowered.com/app/49682 ... en_Tablet/