|
stranger
|
OP
stranger
Joined: Jul 2014
|
Has anyone found out how to add Vendors yet? I tried duplicating the information from Fletcher, but I can't get the test Vendor to even strike up a conversation.
|
|
|
|
stranger
|
OP
stranger
Joined: Jul 2014
|
Gonna bump this topic. It's been 5 days.
|
|
|
|
journeyman
|
journeyman
Joined: Jul 2014
|
Did you script the dialogue?
|
|
|
|
stranger
|
OP
stranger
Joined: Jul 2014
|
Guess I'm not good at scripting. I tried, but didn't get anywhere. I'm a dunce when it comes to stuff like this.
|
|
|
|
apprentice
|
apprentice
Joined: Jul 2014
|
In a new mod, by default vendors are not enabled, you need to set up some stuff in the story scripting to get them to work. If you don't know how to add story scripting, I think there's a couple of larian tutorials up about it that you can watch.
Anyway, the first thing we want to do is make sure our vendor is global and then call this function:
CharacterSetCanTrade(CHARACTER_Player1, CHARACTER_OurVendor, 1);
If you have more than one character, you're going to have to call this for each player. Note that your player may not be called Player1 by default, you can change the name in the character menu (don't get confused, this is not the Display Name of the character and remember to generate definitions each time you change the name so that the compiler knows about your new name).
During dialog, the vendor will now have the trade icon available, however clicking it will do nothing.
What we need to do is add the function:
IF RequestTrade(_char, _trader) THEN ActivateTrade(_char, _trader, 1, 1, 1);
This will open a trade window, showing the vendor's inventory (they probably don't have much at this point). The player also won't have any money.
If we add the line:
ItemTemplateAddToCharacter("e7dd9633-26d4-4782-9d76-d7c27054f445", CHARACTER_OurVendor, 2); CharacterAddGold(CHARACTER_Player1, 10000);
To our story file and compile, then the vendor will have some two pairs of cloth boots to sell us and we should have enough money to buy them. However, when we attempt to buy the boots, nothing happens.
We need to add one last function:
IF HappyWithDeal(_Player,_Npc,_ValuePlayer,_ValueNpc) AND _ValuePlayer >= _ValueNpc THEN ExecuteDeal(_Player,1,0);
Now, when we make an offer, the vendor will sell to us if we've given gold equal or more in value to the goods we want.
At this point, very basic trading works. You can look in trade.txt for ways to expand it by generating random goods, affecting attitude, and checking for stolen goods.*
Oh. You probably just wanted to add a vendor to the main campaign. Well, all you need to do is make a global character, assign them some dialog, and add them in trade.txt. Then rebuild everything.
*Only being able to sell goods to Black Market Traders didn't make it into the shipped game, but there's remnants of the code lying around.
Last edited by roguelike; 21/07/14 09:58 AM.
|
|
|
|
stranger
|
stranger
Joined: Jul 2014
|
Great, i've tried but i've don't understand one thing, when I put a npc in Global statue, I can't Interact with him anymore. Idea ?
Script works, when I take control, npc have the boots, and is perfectly identified in definition. just Interaction problem.
|
|
|
|
stranger
|
OP
stranger
Joined: Jul 2014
|
Alright. Thanks, roguelike. I'll give it a shot when I have time. Seems fairly simple after reading your description.
|
|
|
|
apprentice
|
apprentice
Joined: Jul 2014
|
Great, i've tried but i've don't understand one thing, when I put a npc in Global statue, I can't Interact with him anymore. Idea ?
Script works, when I take control, npc have the boots, and is perfectly identified in definition. just Interaction problem. Oh yeah, hah. Global state also breaks dialog, I forgot about that. If you want to be able to talk to global characters you need to add: IF DialogStartRequested(_Char, _Player) THEN StartDefaultDialog(_Char, _Player); This will start whatever dialog they have assigned in their default dialog node.
|
|
|
|
apprentice
|
apprentice
Joined: Aug 2014
|
Where do I add that?
IF DialogStartRequested(_Char, _Player) THEN StartDefaultDialog(_Char, _Player);
IF i have multiple global characters, do I just need that once or for each global char? Do i copy it exact, or replace it with the characters names (so i'd have to do it 4x per npc?)
|
|
|
|
stranger
|
stranger
Joined: Jul 2014
|
Create a new goal if you have not done so already, as mentioned in the video tutorial on quest scripts. Here is my goal for my blacksmith, including all of the stuff mentioned here in this post. I did not add an item template yet, but just have the dialog button and such.
INIT: DB_Dialog(CHARACTER_Town_Blacksmith); CharacterSetCanTrade(CHARACTER_Player1, CHARACTER_Town_Blacksmith, 1); CharacterSetCanTrade(CHARACTER_Player2, CHARACTER_Town_Blacksmith, 1);
KB: IF DialogStartRequested(_Char, _Player) THEN StartDefaultDialog(_Char, _Player);
IF RequestTrade(_char, _trader) THEN ActivateTrade(_char, _trader, 1, 1, 1);
IF HappyWithDeal(_Player,_Npc,_ValuePlayer,_ValueNpc) AND _ValuePlayer >= _ValueNpc THEN ExecuteDeal(_Player,1,0);
Edit: So running it in the editor, the only thing I don't see is a message about why I can't do a trade if it's in my favor. But he will accept trades in his favor.
Last edited by Farmer Bob; 02/08/14 08:29 PM.
|
|
|
|
apprentice
|
apprentice
Joined: Aug 2014
|
I notice in your example you use DB_Dialog(CHARACTER_Town_Blacksmith);
where as in the official one they use DB_Dialogs(CHARACTER_Town_Blacksmith,"name_of_dialog_file");
any reason for the difference?
Specifically my dialog works great with non-globals, but when i use the exact same thing with a global, just adding your goal as a subgoal under start, I end up never being able to leave the conversation. I hit leave, and then am just... stuck in conversation.
Last edited by RestarttGaming; 03/08/14 04:57 AM.
|
|
|
Moderated by Bvs, ForkTong, gbnf, Issh, Kurnster, Larian_QA, LarSeb, Lar_q, Lynn, Monodon, Raze, Stephen_Larian
|
|