Jump to content
  • 0

Server trader NPCs


poppen1234

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?

Link to comment
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

 

Link to comment
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 ......

Link to comment
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],

Link to comment
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

Link to comment
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;

 

Link to comment
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

 

 

 

 

Link to comment
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]

 

Link to comment
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!

 

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
  • Discord

×
×
  • Create New...