Jump to content
  • 0

Custom trader cities


BetterDeadThanZed

Question

This post started as a request for information on how add traders. The question was answered, so I thought I'd update my original post with instructions on how to do this:

 

It is easier to add traders if you don't want them to have their own inventory. This tutorial will start with explaining how to add traders and have them use the same database data/inventory as other traders.

 

Using the 3D editor, create a trader city. Place units at the locations where you want to have the traders standing. I am not going to explain how to use the 3D editor. You should already know how to do that.

Open server_traders.sqf for reference and keep it open.

Open mission.sqf and add an entry for your first new trader:

_unit_13001 = objNull;
if (true) then
{
  _this = createAgent ["GUE_Soldier_1", [2550.658, 8326.5928, 2.3534577], [], 0, "CAN_COLLIDE"];
  _unit_13001 = _this;
  _this setDir 114.59087;
  _this setVehicleInit "this allowDammage false; this disableAI 'FSM'; this disableAI 'MOVE'; this disableAI 'AUTOTARGET'; this disableAI 'TARGET'; this setBehaviour 'CARELESS'; this forceSpeed 0;  ";
  _this setUnitAbility 0.60000002;
_this allowDammage false; _this disableAI 'FSM'; _this disableAI 'MOVE'; _this disableAI 'AUTOTARGET'; _this disableAI 'TARGET'; _this setBehaviour 'CARELESS'; _this forceSpeed 0;_this enableSimulation false;};

_unit_#### can be a unique number not being used anywhere else in mission.sqf

 

"createAgent" should match one of the traders in the server_traders.sqf file. For example:

// Ammunition Neutral P
menu_BAF_Soldier_AMG_W = [
[["Assault Rifle Ammo",480],["Light Machine Gun Ammo",481],["Pistol Ammo",484],["Shotguns and Single-shot Ammo",573],["Sniper Rifle Ammo",482],["Submachine Gun Ammo",483]],
[],
"neutral"
];

This is a neutral ammunition trader. You can select "BAF_Soldier_AMG_W" and put it in the above mission.sqf file:

_this = createAgent ["BAF_Soldier_AMG_W", [2550.658, 8326.5928, 2.3534577], [], 0, "CAN_COLLIDE"];

Change the coordinates above with the coordinates from the new trader city you created. Also change these lines:

_unit_13001 = _this;
_this setDir 114.59087;

_unit matches the _unit number you chose above and setDir is in the mission file from the trader city you created.

 

What this does is spawns a trader with the classname "BAF_Soldier_AMG_W"", which the server recognizes is the neutral ammo trader as defined in the server_traders.sqf file. Please note that I pulled this from a Panthera server_traders.sqf so yours might be different.

 

After you've added all the traders this way, feel free to copy over the other items, such as tents, boxes, etc that you created in the mission you created in the 3D editor. Place all of this above the "processInitCommands;" commands at the bottom of the server's mission.sqf.

 

Creating traders with their own inventory

 

If you want to create unique traders that do not use the inventory of an existing trader, you need to do a little more.

 

After adding the tents, boxes, etc that make up your new trader city, and adding the traders as above, you perform the following steps.

 

In server_traders.sqf, you have to add the trader. It has to use a unique classname not being used by any other trader and it can not be used by any AI that you have on the server. If, for example, you use the same classname for this new trader as that of a bandit AI in your mission system, when you come across a dead bandit, you will get a trader prompt on your scroll menu!

 

For my example, I will use "Fiona". She is a trader I added to my Napf and Panthera servers that sells and buys rare food and drinks. This is what I added to server_traders.sqf:

// Rare Food and Drinks
menu_RU_Damsel5 = [
[["Rare Food/Drinks",700]],
[],
"neutral"
];

I used the model "RU_Damsel5". When you bring up the menu, it says "Rare Food/Drinks" and it uses trader ID 700. Whatever model you use, it needs to be added to the top of server_traders.sqf:

serverTraders = ["Tanny_PMC","BAF_Soldier_AMG_W","BAF_Soldier_AAA_DDPM","CZ_Special_Forces_MG_DES_EP1","Damsel5","GUE_Commander","GUE_Woodlander1","GUE_Woodlander3","GUE_Soldier_Sab","GUE_Soldier_Pilot","GUE_Soldier_2","Soldier_PMC","Citizen2_EP1","Rita_Ensler_EP1","RU_Farmwife1","US_Soldier_Medic_EP1","USMC_Soldier_TL","USMC_SoldierS_Engineer","UN_CDF_Soldier_AAT_EP1","ValentinaVictim","UN_CDF_Soldier_MG_EP1","GUE_Soldier_1","FR_Corpsman","GUE_Soldier_AR","Dr_Hladik_EP1","RU_Villager1","Reynolds_PMC","RU_Damsel5"];

In your database, you have to add the trader:

REPLACE INTO `server_traders` (`id`, `classname`, `instance`, `status`, `static`, `desc`) VALUES (700, 'RU_Damsel5', 24, 'friendly', NULL, 'Fionas Pub');

Then you have add the items the new trader will stock:

REPLACE INTO `traders_data` (`id`, `item`, `qty`, `buy`, `sell`, `order`, `tid`, `afile`) VALUES (7589, '["ItemSodaRabbit",1]', 1000, '[6,"ItemGoldBar",1]', '[3,"ItemGoldBar",1]', 0, 700, 'trade_items');

This adds the item "ItemSodaRabbit" with a quantity of 1000, selling for 6oz gold, buying for 3oz gold, to trader ID #700.

 

I hope that helps everyone! Let me know if you have questions. Thank you for everyone that answered the original post I made which led me to making this new post!

Link to comment
Share on other sites

Recommended Posts

  • 0

BetterDeadThanZed, do you know if it's possible to have traders accessible via UID instead of humanity. 

 

For example, can I make a custom trader that my donators and my donators only can access? 

 

I know I can make a dome and allow only specific UIDs into that dome, which is something I am trying to avoid. 

 

I don't but I'd bet if you posted that question in the script help forum, one of these expert coders can work it out.

Link to comment
Share on other sites

  • 0

I dont have a trader_items and some of my weapons are showing up as class names instead of pictures? Any help?

FriendlyPA, 

 

If weapons are showing up as classnames with no images you need to double check the line for the item. somewhere in there there's an issue. Could be a misspelling, quotation mark out of place, a space where it shouldn't be etc. 

 

Link the lines that the weapons are not showing. 

Link to comment
Share on other sites

  • 0

I dont have a trader_items and some of my weapons are showing up as class names instead of pictures? Any help?

 

All the items that the traders sell are in the trader_items table. It includes quantity and sell price as well as some other information. There's no way you could even have anything for traders to sell without it.

Link to comment
Share on other sites

  • 0

All the items that the traders sell are in the trader_items table. It includes quantity and sell price as well as some other information. There's no way you could even have anything for traders to sell without it.

Not true BetterDeadThanZed. 

 

I don't have trader_items either. I have traders_data. I guess it may have replaced the trader_items table.

 

databases_zps55f376d1.png

 

Above is my database

Link to comment
Share on other sites

  • 0

I'm having some trouble getting my traders in on my Panthera Server. I can get all of the buildings for the city in fine, but not the traders. I'm planning on making a second currency system in my server using the gems already in-game, but that's not important now and not contributing to my problem. I'll post what's been done so far and let me know if anyone can spot any problems with any of it...

 

My Mission.sqf code for the trader (I think this is the right file, the one I got from the map editor. I renamed it to the trader city I'm making)

_unit_666 = objNull;  
if (true) then
{
  _this = _group_1 createUnit ["INS_Worker2_DZ", [5234.498, 3868.4348, 0.022787789], [], 0, "CAN_COLLIDE"];
  _unit_666 = _this;
  _this setDir 161.38811;
  _this setVehicleInit "this allowDammage false; this disableAI 'FSM'; this disableAI 'MOVE'; this disableAI 'AUTOTARGET'; this disableAI 'TARGET'; this setBehaviour 'CARELESS'; this forceSpeed 0;";
  _this setUnitAbility 0.60000002;
  _this allowDammage false; _this disableAI 'FSM'; _this disableAI 'MOVE'; _this disableAI 'AUTOTARGET'; _this disableAI 'TARGET'; _this setBehaviour 'CARELESS'; _this forceSpeed 0;_this enableSimulation false;
};

My server_traders.sqf code for the trader:

// Weapons Gem Trader
menu_INS_Worker2_DZ = [
[["Assault Rifle",700],["Light Machine Gun",701],["Pistols",702],["Shotguns and Single-shot",703],["Sniper Rifle",704],["Submachine Guns",705],["Gem Conversion",693],
	[],
	"friendly"
];

And the code above, in the same file (INS worker, 4 names back from the end):

// DayZ Epoch TRADERS for 17
serverTraders = ["Tanny_PMC","BAF_Soldier_AMG_W","BAF_Soldier_AAA_DDPM","CZ_Special_Forces_MG_DES_EP1","Damsel5","GUE_Commander","GUE_Woodlander1","GUE_Woodlander3","GUE_Soldier_Sab","GUE_Soldier_Pilot","GUE_Soldier_2","Soldier_PMC","Citizen2_EP1","Rita_Ensler_EP1","RU_Farmwife1","US_Soldier_Medic_EP1","USMC_Soldier_TL","USMC_SoldierS_Engineer","UN_CDF_Soldier_AAT_EP1","ValentinaVictim","UN_CDF_Soldier_MG_EP1","GUE_Soldier_1","FR_Corpsman","GUE_Soldier_AR","INS_Worker2_DZ","Dr_Hladik_EP1","RU_Villager1","Reynolds_PMC"];

in the server_traders in my phpmyadmin:

5TmHqYs.png

 

 

And the trader_tids:

9JPWK0g.png

 

 

 

I think that's all of them. Please help me out, can't seem to figure out why it's not working.

Link to comment
Share on other sites

  • 0

Three things:

 

Check your RPT log for any errors. If there's an error in the mission.sqf, that will stop the traders from spwaning.

Secondly, double check the coordinates for your traders to be sure you have them in the right place.

Lastly, make sure you have INS_Worker2_DZ in the array at the top of the server_traders.sqf. That's the "serverTraders =" line. 

Link to comment
Share on other sites

  • 0

The coordinates are correct, the serverTraders= line has the trader in it (as shown in the pic). How do I check the RPT log (I'm new to this)

 

The RPT location depends on your server host. I use Vert Hosting and it's located in the "Bliss" folder. You'll need to check your server files for it. It should be called something like arma2oaserver.RPT.

Link to comment
Share on other sites

  • 0

This is the bulk of the spam inside the file. 

17:41:43   Error position: <ItemSodaRbull","ItemSodaRbull"]],
[
["M>
17:41:43   Error Missing ]
17:41:43 File z\addons\dayz_server\modules\Supplyitems.sqf, line 19
17:41:43 Error in expression <aRbull","ItemSodaRbull","ItemSodaRbull,"ItemSodaRbull","ItemSodaRbull"]
],
Link to comment
Share on other sites

  • 0

I have no idea what the Supplyitems.sqf is. That has nothing to do with the traders. What you want to look for is an error in mission.sqf. If you could use pastebin to post your entire RPT file, that would be helpful. Make sure you delete the RPT file, then start your server. After it's been running, you should log into the server to be sure everything loads, then log out and post that RPT. Please use pastebin, though.

Link to comment
Share on other sites

  • 0

All of it was too long to post, but here's a chunk I think has some of the errors involving traders. 

20:02:02 Error in expression <CAN_COLLIDE"];
_unit_177 = _this;
_this setDir 200.0;
_this setVehicleInit "this>
20:02:02   Error position: <setDir 200.0;
_this setVehicleInit "this>
20:02:02   Error setdir: Type Nothing, expected Object
20:02:02 File mpmissions\__cur_mp.panthera2\buildings\traders.sqf, line 9
20:02:02 Warning Message: You cannot play/edit this mission; it is dependent on downloadable content that has been deleted.
jetskiyanahuiaddon
20:02:02 Warning Message: You cannot play/edit this mission; it is dependent on downloadable content that has been deleted.
csj_gyroac
20:02:02 Warning Message: You cannot play/edit this mission; it is dependent on downloadable content that has been deleted.
csj_gyroac
20:02:03 Error in expression <CAN_COLLIDE"];
_unit_666 = _this;
_this setDir 161.38811;
_this setVehicleInit ">
20:02:03   Error position: <setDir 161.38811;
_this setVehicleInit ">
20:02:03   Error setdir: Type Nothing, expected Object
20:02:03 File mpmissions\__cur_mp.panthera2\buildings\tradercityUkanc.sqf, line 719
20:02:03 Warning Message: You cannot play/edit this mission; it is dependent on downloadable content that has been deleted.
jetskiyanahuiaddon
20:02:04 Warning Message: You cannot play/edit this mission; it is dependent on downloadable content that has been deleted.
jetskiyanahuiaddon
20:02:04 "HIVE: Starting"
20:02:04 "server_monitor.sqf execution count = 2"
20:02:04 "HIVE: trying to get objects"
20:02:04 "HIVE: attempt to kill.. HiveExt response:["PASS"]"
20:02:04 "HIVE: trying to get objects"
20:03:21 NetServer::finishDestroyPlayer(1996060184): DESTROY immediately after CREATE, both cancelled
20:03:56 NetServer::finishDestroyPlayer(178968193): DESTROY immediately after CREATE, both cancelled
20:04:38 "HIVE: found 2938 objects"
20:04:38 "HIVE: Commence Object Streaming..."
Link to comment
Share on other sites

  • 0

The first thing you need to do is fix the error with the SupplyItems.sqf. At the very least, comment out that line from wherever it loads, then stop your server, delete your RPT file, start your server/log into it, then log out and post the RPT file again. Your current RPT has to be gigabytes long with that error repeating over and over. Only when you have resolved that error will you be able to find the error in mission.sqf.

Link to comment
Share on other sites

  • 0

Would suggest you contact them and tell them to fix the script they are supplying as it has a bug.  Give them the error message.

 

17:41:43 Error in expression <aRbull","ItemSodaRbull","ItemSodaRbull,"ItemSodaRbull","ItemSodaRbull"]

As Buck0 said,

aRbull","ItemSodaRbull","ItemSodaRbull,"ItemSodaRbull","ItemSodaRbull"

should be

aRbull","ItemSodaRbull","ItemSodaRbull","ItemSodaRbull","ItemSodaRbull"

From the part of the log posted it looks like the setdir is not getting anything passed in the _this variable.  Hard to be sure without the actual sqf file and log (pastebin is 'not responding' trying to view the big log file it seems).

Link to comment
Share on other sites

  • 0

@betterdeadthanzed...

 

Thanks for the writeup.  I really want to do something with the trader cities and this saves a lot of groundwork.

 

 Any reason for the '_this' variable being used for the createagent command rather than just using the unit variable (i.e. _unit_13001 in your example) and then just using the unit id for the setdir etc ?.  Have not tried it so not sure if there are any querks that are forcing you to do it that way.

 

RB

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
  • Advertisement
×
×
  • Create New...