lucariell
|
  |
| Joined: 12 Dec 2013 |
| Total Posts: 159 |
|
|
| 23 Jul 2017 11:40 AM |
Can someone help me with in this? I've tried so much times but no success at it.
Well, When I have a dialog with an NPC and click on a choice, a certain tool must be removed from backpack, also after it the NPC wich I haved the dialog, must disappear too. |
|
|
| Report Abuse |
|
|
RuizuKun
|
  |
| Joined: 20 Jan 2016 |
| Total Posts: 1133 |
|
|
| 23 Jul 2017 12:00 PM |
use a Local script to detect the player talking to the NPC
Just put a script inside the Player
If you game is FE use RemoteEvents
This is Reality, NOT a Dream. |
|
|
| Report Abuse |
|
|
lucariell
|
  |
| Joined: 12 Dec 2013 |
| Total Posts: 159 |
|
|
| 23 Jul 2017 12:02 PM |
Well, Kindly, I am a bit confused xd well, I know I am annoying but I am newer about NPC
so please can you exactly say what I need to do inside those scripts? :) |
|
|
| Report Abuse |
|
|
|
| 23 Jul 2017 12:15 PM |
Put this inside the dialogue choice
script.Parent.DialogueChoiceSelected:connect(function(player,choice) wait(1) local tool = player.Backpack:FindFirstChild(name of tool) if tool then tool:Destroy() end workspace.(insert NPC name here):Destroy() end
This probably won't be exactly what you envisioned, but it should give you a head start. |
|
|
| Report Abuse |
|
|
lucariell
|
  |
| Joined: 12 Dec 2013 |
| Total Posts: 159 |
|
|
| 23 Jul 2017 12:47 PM |
theres an error that say: space expected by '('
Also It wont work, well. It seems its right, well, I asked that by the player choice, the tool must disappear by backpack and then NPC too must disappear. |
|
|
| Report Abuse |
|
|
Orxzify
|
  |
| Joined: 10 Jun 2017 |
| Total Posts: 137 |
|
|
| 23 Jul 2017 12:53 PM |
script.Parent.DialogueChoiceSelected:connect function(player,choice) wait(1) local tool = player.Backpack:FindFirstChild(name of tool) if tool then tool:Destroy() end workspace.(insert NPC name here):Destroy() end
Probably fixed it but probably not.
|
|
|
| Report Abuse |
|
|
lucariell
|
  |
| Joined: 12 Dec 2013 |
| Total Posts: 159 |
|
|
| 23 Jul 2017 05:01 PM |
| Same like before, but now arguments exepted.. Rip.. I am so sad.. |
|
|
| Report Abuse |
|
|
|
| 23 Jul 2017 05:07 PM |
| You have to replace "name of tool" and "insert NPC name here" with those respective fields. |
|
|
| Report Abuse |
|
|
lucariell
|
  |
| Joined: 12 Dec 2013 |
| Total Posts: 159 |
|
|
| 23 Jul 2017 05:16 PM |
Of course I did.
script.Parent.DialogueChoiceSelected:connect function(player,choice) wait(1) local tool = player.Backpack:FindFirstChild(Sword) if tool then tool:Destroy() end workspace.(Shop):Destroy() end
|
|
|
| Report Abuse |
|
|
|
| 23 Jul 2017 05:17 PM |
script.Parent.DialogueChoiceSelected:connect function(player,choice) wait(1) local tool = player.Backpack:FindFirstChild("Sword") if tool then tool:Destroy() end workspace["Shop]:Destroy() end
You really should use the output window. |
|
|
| Report Abuse |
|
|
| |
|
lucariell
|
  |
| Joined: 12 Dec 2013 |
| Total Posts: 159 |
|
|
| 23 Jul 2017 05:26 PM |
| the error is: Workspace.Shop.Head.Dialog.Sword.Script:1: function arguments expected near ':' |
|
|
| Report Abuse |
|
|
|
| 23 Jul 2017 05:29 PM |
Oops, didn't see that
script.Parent.DialogueChoiceSelected:connect(function(player,choice) wait(1) local tool = player.Backpack:FindFirstChild("Sword") if tool then tool:Destroy() end workspace["Shop]:Destroy() end) |
|
|
| Report Abuse |
|
|
lucariell
|
  |
| Joined: 12 Dec 2013 |
| Total Posts: 159 |
|
|
| 23 Jul 2017 05:31 PM |
Maybe forgot something else xd
Workspace.Shop.Head.Dialog.Sword.Script:7: unfinished string near '"Shop]:Destroy()' |
|
|
| Report Abuse |
|
|
|
| 23 Jul 2017 05:33 PM |
Put in the change I made with my post:
"Shop" |
|
|
| Report Abuse |
|
|
lucariell
|
  |
| Joined: 12 Dec 2013 |
| Total Posts: 159 |
|
|
| 23 Jul 2017 05:33 PM |
Woops I found it, Well replaced that:
DialogueChoiceSelected is not a valid member of DialogChoice |
|
|
| Report Abuse |
|
|
|
| 23 Jul 2017 05:36 PM |
| This script has to be a child of the base Dialog, and then you have to use the 'choice' argument to determine if the right choice was selected. |
|
|
| Report Abuse |
|
|
lucariell
|
  |
| Joined: 12 Dec 2013 |
| Total Posts: 159 |
|
|
| 23 Jul 2017 05:39 PM |
| Currently, the script is in the choice dialog, but so what can I do? It's still Died or half I mean, Lol Welp |
|
|
| Report Abuse |
|
|
|
| 23 Jul 2017 05:44 PM |
Add a lint like:
if choice == script.Parent.DialogChoice1.DialogChoice2. ... .DialogChoiceN then
You'll have to index the appropriate DialogChoice. Alternatively, you can add an ObjectValue to the main Dialog, set its value to the proper DialogChoice by clicking the value property then the DialogChoice in the explorer window. Then the line would be:
if choice == script.Parent.Value.Value then |
|
|
| Report Abuse |
|
|
lucariell
|
  |
| Joined: 12 Dec 2013 |
| Total Posts: 159 |
|
|
| 23 Jul 2017 05:47 PM |
| Where exactly? Sorry for asking this, but I repeat I am newer at NPC Lol. |
|
|
| Report Abuse |
|
|
|
| 23 Jul 2017 05:53 PM |
The second way is a bit more modular, so let's go with that.
Click the base Dialog (the one from which all of the choices extend). Then Insert an ObjectValue into this. You can name it something like "ToolChoice". In the explorer window, set the Value property by first clicking it in the properties window, then by searching through the explorer window until you find the dialog choice you want to trigger this event, and click that. The Value property should display the name of the dialogchoice if done right.
script.Parent.DialogueChoiceSelected:Connect(function(player,choice) if choice == script.Parent.ToolChoice.Value then wait(1) local tool = player.Backpack:FindFirstChild("Sword") if tool then tool:Destroy() end script.Parent:Destroy() end end) |
|
|
| Report Abuse |
|
|
lucariell
|
  |
| Joined: 12 Dec 2013 |
| Total Posts: 159 |
|
|
| 23 Jul 2017 05:58 PM |
WaitWon't work, did you forgot "Shop" or its alright? because the same errror dialog is not a valid thing of dialog thing etc.
|
|
|
| Report Abuse |
|
|
|
| 23 Jul 2017 06:03 PM |
| The script has to be in the Dialog object (the very first dialog that holds all of the dialog choices). |
|
|
| Report Abuse |
|
|
lucariell
|
  |
| Joined: 12 Dec 2013 |
| Total Posts: 159 |
|
|
| 23 Jul 2017 06:08 PM |
| Alright, But nothing changed, My dialog choice name is Sword and Kindly, well. It won't work yet. this is too hard as how I see as a beginner |
|
|
| Report Abuse |
|
|
|
| 23 Jul 2017 06:12 PM |
| So the ObjectValue's Value property should read "Sword and Kindly" in the property window. Is this true? |
|
|
| Report Abuse |
|
|