Jump to content
  • 0
Sign in to follow this  
poppen1234

Server trader NPCs

Question

So im running an ORI/epoch server. trying to get my trade npcs to spawn at the original ORI location.

No matter where i set their height. they will only spawn on the ground level. almost as if they are loading in before the map models are. is there a way to change the load order of these?

Share this post


Link to post
Share on other sites

8 answers to this question

Recommended Posts

  • 1
5 hours ago, poppen1234 said:

So im running an ORI/epoch server. trying to get my trade npcs to spawn at the original ORI location.

No matter where i set their height. they will only spawn on the ground level. almost as if they are loading in before the map models are. is there a way to change the load order of these?

Hello,

Try with setPosATL

 

Share this post


Link to post
Share on other sites
  • 0

Not sure what ori location is but are npc's spawning before objects/buildings?

also do you reset thier location after creatation

_this = createVehicle .......
_this setDir .......
_this setPos .......
_this setVectorUp ......

Share this post


Link to post
Share on other sites
  • 0
12 hours ago, Mig said:

Hello,

Try with setPosATL

 

how would i incorporate that. my file for traders are as such


 

Quote

 

[
    /******************ISLAND***********************/
    //Black Market
    ["GUE_Woodlander2", [23371.3,5283.87,25],50.2731],
    //Weapons
    ["RU_Citizen4",[23380.7,5276.52,25],48.5854],
    //Ammunition
    ["Profiteer1",[7361.08,4331.8,25],201.357],
    //Medical Supplies
    ["Dr_Hladik_EP1",[7398.85,4296.94,25],253.028],
    //Building/Parts
    ["Worker2",[23443.8,5303.18,50],267.079]
] call server_spawnTraders;

// Bankers
if (Z_singleCurrency && Z_globalBanking && Z_globalBankingTraders) then {
    [
        ["Functionary1_EP1",[9654.21,12559.9,0],47.3297],
        ["Functionary1_EP1",[23405.2,5307.31,0],286.2]
    ] call server_spawnTraders;
};

 

so would it be like

["GUE_Woodlander2", setPosATL  [23371.3,5283.87,25],50.2731],

Share this post


Link to post
Share on other sites
  • 0
15 hours ago, Crude said:

Not sure what ori location is but are npc's spawning before objects/buildings?

also do you reset thier location after creatation

_this = createVehicle .......
_this setDir .......
_this setPos .......
_this setVectorUp ......

In tavi the origional trader city is a little island out on the bottom right on the map.

 

i call my agents in my in my init in my mission files

Quote

if (isServer) then {
    if (dayz_POIs) then {call compile preprocessFileLineNumbers "\z\addons\dayz_code\system\mission\chernarus\poi\init.sqf";};
    call compile preprocessFileLineNumbers "\z\addons\dayz_server\system\dynamic_vehicle.sqf";
    call compile preprocessFileLineNumbers "\z\addons\dayz_server\system\server_monitor.sqf";
    call compile preprocessFileLineNumbers "maps\milbasekameni.sqf";
    //Get the server to setup what waterholes are going to be infected and then broadcast to everyone.
    if (dayz_infectiousWaterholes) then {execVM "\z\addons\dayz_code\system\mission\chernarus\infectiousWaterholes\init.sqf";};
    // Lootable objects from CfgTownGeneratorDefault.hpp
    if (dayz_townGenerator) then { execVM "\z\addons\dayz_code\system\mission\chernarus\MainLootableObjects.sqf"; };
    execVM "\z\addons\dayz_server\traders\taviana.sqf"; //Add trader agents

and my agent file looks like this.

Quote

[
    /******************ISLAND***********************/
    //Black Market
    ["GUE_Woodlander2",[23371.3,5283.87,25],50.2731],
    //Weapons
    ["RU_Citizen4",[23380.7,5276.52,25],48.5854],
    //Ammunition
    ["Profiteer1",[7361.08,4331.8,25],201.357],
    //Medical Supplies
    ["Dr_Hladik_EP1",[7398.85,4296.94,25],253.028],
    //Building/Parts
    ["Worker2",[23443.8,5303.18,50],267.079]
] call server_spawnTraders;

// Bankers
if (Z_singleCurrency && Z_globalBanking && Z_globalBankingTraders) then {
    [
        ["Functionary1_EP1",[9654.21,12559.9,0],47.3297],
        ["Functionary1_EP1",[23405.2,5307.31,0],286.2]
    ] call server_spawnTraders;
};

 

the traders work and are there. but the reset position etc is new to me. and not sure how to do it. ive basically got along on a wing and a prayer getting my server together

Share this post


Link to post
Share on other sites
  • 0
10 hours ago, poppen1234 said:

how would i incorporate that. my file for traders are as such


 

so would it be like

["GUE_Woodlander2", setPosATL  [23371.3,5283.87,25],50.2731],

You need to modify the file: server_spawnTraders.sqf
https://github.com/EpochModTeam/DayZ-Epoch/blob/master/SQF/dayz_server/compile/server_spawnTraders.sqf

 

it should look like this:
private "_trader";
{
	_trader = createAgent [_x select 0,_x select 1,[],0,"CAN_COLLIDE"]; 
	{_trader removeMagazine _x;} count magazines _trader;
	removeAllItems _trader;
	removeAllWeapons _trader;
	removeBackpack _trader;
	_trader switchMove "";
	_trader setDir (_x select 2);
	_trader setVehicleInit "this disableAI 'ANIM'; this disableAI 'AUTOTARGET'; this disableAI 'FSM'; this disableAI 'MOVE'; this disableAI 'TARGET'; this setBehaviour 'CARELESS'; this forceSpeed 0; this allowDamage false;";
	_trader setUnitAbility 0.6;
	_trader disableAI "ANIM";
	_trader disableAI "AUTOTARGET";
	_trader disableAI "FSM";
	_trader disableAI "MOVE";
	_trader disableAI "TARGET";
	_trader setBehaviour "CARELESS";
	_trader setcaptive true;
	_trader forceSpeed 0;
	_trader allowDamage false;
	_trader enableSimulation false;
  
    _trader setPosATL _x select 1;
  
} count _this;

processInitCommands;

 

Share this post


Link to post
Share on other sites
  • 0
13 hours ago, Mig said:
You need to modify the file: server_spawnTraders.sqf
https://github.com/EpochModTeam/DayZ-Epoch/blob/master/SQF/dayz_server/compile/server_spawnTraders.sqf

 

it should look like this:
private "_trader";
{
	_trader = createAgent [_x select 0,_x select 1,[],0,"CAN_COLLIDE"]; 
	{_trader removeMagazine _x;} count magazines _trader;
	removeAllItems _trader;
	removeAllWeapons _trader;
	removeBackpack _trader;
	_trader switchMove "";
	_trader setDir (_x select 2);
	_trader setVehicleInit "this disableAI 'ANIM'; this disableAI 'AUTOTARGET'; this disableAI 'FSM'; this disableAI 'MOVE'; this disableAI 'TARGET'; this setBehaviour 'CARELESS'; this forceSpeed 0; this allowDamage false;";
	_trader setUnitAbility 0.6;
	_trader disableAI "ANIM";
	_trader disableAI "AUTOTARGET";
	_trader disableAI "FSM";
	_trader disableAI "MOVE";
	_trader disableAI "TARGET";
	_trader setBehaviour "CARELESS";
	_trader setcaptive true;
	_trader forceSpeed 0;
	_trader allowDamage false;
	_trader enableSimulation false;
  
    _trader setPosATL _x select 1;
  
} count _this;

processInitCommands;

 

didnt work at all. im not sure what im doing wrong. but heres my rpt errors

 

18:30:28   Error Type String, expected Number
18:30:28 Error in expression <trader enableSimulation false;
 
_trader setPosATL _x select 1;
 
} count _this;
 
>
18:30:28   Error position: <setPosATL _x select 1;
 
} count _this;
 
>
18:30:28   Error Type String, expected Number

 

 

 

 

Share this post


Link to post
Share on other sites
  • 0

try
_trader setPosATL (_x select 1);

Did you remove the setPosATL from the other file if you added it.
["GUE_Woodlander2", setPosATL  [23371.3,5283.87,25],50.2731],

Also your best friend when scripting is logs

diag_log format["# MY LOG / DEBUG # %1",  _x select 1];

Add this to above or below _trader = createAgent

this will show you what the _x select 1 is and it should look something like [23371.3,5283.87,25]

# MY LOG / DEBUG # [23371.3,5283.87,25]

 

Share this post


Link to post
Share on other sites
  • 0
On 6/20/2022 at 6:47 PM, Crude said:

try
_trader setPosATL (_x select 1);

Did you remove the setPosATL from the other file if you added it.
["GUE_Woodlander2", setPosATL  [23371.3,5283.87,25],50.2731],

Also your best friend when scripting is logs

diag_log format["# MY LOG / DEBUG # %1",  _x select 1];

Add this to above or below _trader = createAgent

this will show you what the _x select 1 is and it should look something like [23371.3,5283.87,25]

# MY LOG / DEBUG # [23371.3,5283.87,25]

 

worked. thank you!

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Advertisement
  • Supporters
  • Discord

×
×
  • Create New...