Jump to content

AI recruitment for epoch


Lacost

Recommended Posts

@ force i think it should be {15494.1,146,16990.9} if i remember right direction goes between the two world space numbers, middle number is directing, from whet ive been able to work out since i got thrown into the deep end and had to do all the server side gig

your right ,

 I overlooked it and thanks for the help that got my issue fixed....

Link to comment
Share on other sites

 I can't seem to get it to work with infstar antihack.

I adjusted ah.sqf like previous post said and added , && (isNull (findDisplay 20001)) to that line , which fixed menu box not staying up problem.

Now the dialog box will stay up but now when i select unit to buy one  such as "Bodyguard" then  I hit recruit nothing happens no queing nadda. like the ah is blocking the action to create the unit.

anyone know how to get this working?

 

 

Link to comment
Share on other sites

nice initiative ...

 

however, i think you are overlooking a few things here ...

 

1. you could easy dynamicly add the trader to the map along with a marker

 

2. the cleanup of this is incomplete/missing, if you just delete the ai, it will still have eventhandlers attatched that will not be deleted along with the ai and will possibly lag the server in the end / over time

 

not sure how you will do it, but you need to have some kind of check if a player is disconnected or dead and then from there send control to the server wich eventually deletes them, at some point (might not be optimal to delete them, the second the player dies, or they wont be very useful to guard the dead body)

 

possibly you could add something in (i think the name of the script is) player_died.sqf, however it will still be a mess in case player disconnects/cobat logs as there wont be any cleanup in that case.

 

but i like the idea ... its cool

Link to comment
Share on other sites

ok heres something that should help all others to add this mod ... i added the trader with dynamic spawn, which in terms means this will work for any map

 

i also added option to set a static spawn, if someone wishes to do so (can even add an array of positions, to choose from) ...

 

open init.sqf and change the content to this:

//by Bon_Inf*

#include "config.sqf"

BON_RECRUIT_PATH = "bon_recruit_units\";

bon_max_units_allowed = _max_group;


bon_recruit_queue = [];

if(isServer) then{
	diag_log "[PMC_CONTRACTOR]: Server Adding PVEvent ...";
	"bon_recruit_newunit" addPublicVariableEventHandler {
		_newunit = _this select 1;
		[_newunit] execFSM (BON_RECRUIT_PATH+"unit_lifecycle.fsm");
	};
	diag_log "[PMC_CONTRACTOR]: Server Building Trader ...";
	private ["_coords"];
	if(!_useStaticCoords)then{
		waitUntil {(!isNil "BIS_fnc_findSafePos")};
		_coords = [getMarkerPos 'Center',0,8000,20,0,2000,0] call BIS_fnc_findSafePos;
	}else{
		waitUntil {(!isNil "BIS_fnc_selectRandom")};
		_coords = _staticCoords call BIS_fnc_selectRandom;
	};
	diag_log format["[PMC_CONTRACTOR]: Found position for PMC Contractor ... (%1) %2",mapGridPosition _coords,_coords];
/////////////////////////////////////////////////////////////
	/*
	this is taken from:
	objectMapper.sqf Author: Joris-Jan van 't Land
	Edited by HALV
	*/
	private ["_multiplyMatrixFunc"];
	_multiplyMatrixFunc =
	{
		private ["_array1", "_array2", "_result"];
		_array1 = _this select 0;
		_array2 = _this select 1;
		_result =
		[
		(((_array1 select 0) select 0) * (_array2 select 0)) + (((_array1 select 0) select 1) * (_array2 select 1)),
		(((_array1 select 1) select 0) * (_array2 select 0)) + (((_array1 select 1) select 1) * (_array2 select 1))
		];
		_result
	};
/////////////////////////////////////////////////////////////

	_randir = (random 360);
	//create trader and objects
	_objects = [
	["Land_CamoNet_EAST",				0.709961,-0.51001,	-167.21477],
	["Misc_Cargo1B_military",			5.69727,-0.706299,	-2.8818593],
	["Misc_cargo_cont_net1",			-4.14941,0.804443,	-26.693502],
	["SignM_FOB_Revolve_EP1",			5.53516,2.65137,	-182.78931],
	["Info_Board_EP1",					-3.35449,1.47534,	-116.36801],
	["Desk",							0.25293,1.05273,	188.31465],
	["Land_Chair_EP1",					-0.34375,-1.01563,	-73.404587],
	["AmmoCrates_NoInteractive_Medium",	3.55762,0.761719,	0],
	["AmmoCrates_NoInteractive_Large",	3.38379,-1.71509,	0]
	];

	_unit = createAgent ["UN_CDF_Soldier_SL_EP1", [(_coords select 0),(_coords select 1),0] , [], 0, "CAN_COLLIDE"];
	_unit setVehicleInit "this allowDammage false; this disableAI 'FSM'; this disableAI 'MOVE'; this disableAI 'AUTOTARGET'; this disableAI 'TARGET'; this setBehaviour 'CARELESS'; this forceSpeed 0;this addAction [""Recruit Units"",""bon_recruit_units\open_dialog.sqf""];";
	_unit setUnitAbility 0.60000002;
	_unit setDir _randir;
	_unit allowDammage false; _unit disableAI 'FSM'; _unit disableAI 'MOVE'; _unit disableAI 'AUTOTARGET'; _unit disableAI 'TARGET'; _unit setBehaviour 'CARELESS'; _unit forceSpeed 0;_unit enableSimulation false;
	processInitCommands;

	{
		_name = _x select 0;
		_offsetX = _x select 1;
		_offsetY = _x select 2;
		_offsetDir = _x select 3;
		_Dir = (_randir + _offsetDir);
		_rotMatrix =[[cos _randir, sin _randir],[-(sin _randir), cos _randir]];
		_newRelPos = [_rotMatrix, [_offsetX,_offsetY]] call _multiplyMatrixFunc;
		_pos = [(_coords select 0) + (_newRelPos select 0), (_coords select 1) + (_newRelPos select 1), 0];
		_obj = createVehicle [_name, _pos, [], 0, "CAN_COLLIDE"];
		_obj setDir _Dir;
		_obj setPos _pos;
		_obj setVariable ["objectLocked", true, true];
//		if(_name == "SignM_FOB_Revolve_EP1")then{
//			_obj setVehicleInit "";				//this is to apply a diffrent texture to the sign
//		};
	}forEach _objects;
	diag_log "[PMC_CONTRACTOR]: PMC Contractor Build ... Server sending Position";
	PV_Merc_trader = _coords;
	publicVariable "PV_Merc_trader";
};



// Client stuff...


if(!isDedicated) exitWith{
	diag_log "[PMC_CONTRACTOR]: Client waiting for Trader Position ...";
	waitUntil {sleep 1;(!isNil "PV_Merc_trader")};
	//create marker
	if(_useLocalMarkers)then{
		_marker = createMarkerLocal ["PMC_Contractor", PV_Merc_trader];
		_marker setMarkerShapeLocal "ICON";
		_marker setMarkerTypeLocal "mil_dot";
		_marker setMarkerTextLocal "PMC Contractor";
		_marker setMarkerColorLocal "ColorBlack";
		diag_log "[PMC_CONTRACTOR]: Client created local markers ...";
	}else{
		if (getMarkerColor "PMC_Contractor" == "") then {
			_marker = createMarker ["PMC_Contractor", PV_Merc_trader];
			_marker setMarkerShape "ICON";
			_marker setMarkerType "mil_dot";
			_marker setMarkerText "PMC Contractor";
			_marker setMarkerColor "ColorBlack";
			diag_log "[PMC_CONTRACTOR]: Client created markers ...";
		};
	};
};

open config.sqf and change the content to this:

UNIT1_PRICE = [["ItemGoldBar",2]];//[["ItemGoldBar",0]]-free
UNIT2_PRICE = [["ItemGoldBar",0]];
UNIT3_PRICE = [["ItemGoldBar",1]];
UNIT4_PRICE = [["ItemGoldBar",2]];
UNIT5_PRICE = [["ItemGoldBar",2]];

_max_group = 3;

//some antihacks will want this false, default false ... if you have no antihack, set to true
_useLocalMarkers = false;
//set to true and add static coords below
_useStaticCoords = false;

//set static cords here, if more than one is added, a random position will be choosen from these
_staticCoords = [
//[0,0,0],
//[0,0,0]
];

however ... imo, most of this should be moved serverside, idk why the author decided not to make the server spawn and cleanup the ai.

Link to comment
Share on other sites

 

would be nice if someone edited the menu and made the 2 buttons actually have text on them, not new but not experienced to know  how ... right now the buttons are blank. iv had to white list about 5 different cmd menus to get this running smooth with no kicks  :) just trial and error... 

 

what text is missing for you?

Link to comment
Share on other sites

found a bug in your config.sqf

UNIT1_PRICE = [["ItemGoldBar",2]];//[["ItemGoldBar",0]]-free
UNIT2_PRICE = [["ItemGoldBar",0]];
UNIT3_PRICE = [["ItemGoldBar",1]];
UNIT4_PRICE = [["ItemGoldBar",2]];
UNIT5_PRICE = [["ItemGoldBar",2]];

_max_group = 5;

 

body guard guy is free

Link to comment
Share on other sites

i set them to open fire and they fire at ai fine, might change them to attack zeds, atm my players get the menu and it flickers away for some reason :/

 

 

I added in this script and have the same issue with the menu - ie approach vendor, scroll over and select Recruit, the menu appears for a second displaying the vendors options eg bodyguard, sniper, etc , but quickly disappears before i can react to the options.

Link to comment
Share on other sites

I added in this script and have the same issue with the menu - ie approach vendor, scroll over and select Recruit, the menu appears for a second displaying the vendors options eg bodyguard, sniper, etc , but quickly disappears before i can react to the options.

 

your antihack is blocking the addaction ... you need to allow commanding menus as the action currently cannot be whitelisted

 

@all

on a side note i now have a working script that makes spawns the ai serverside ... i also added some code that will hopefully force the ai to return to the player (if too far from the player), rearms the ai and hopefully also prevent shooting within defined safezones

Link to comment
Share on other sites

your antihack is blocking the addaction ... you need to allow commanding menus as the action currently cannot be whitelisted

 

I had considered that, i turned off battleye as a test, but it seems the issue is still there.  

 

What i had thought is that there maybe some other antihack in operation, according to the hosts console currently no BE/Antihack are enabled, but im sceptical over that as when in game, hitting escape to display the usual menu system ie Save/Restart/Respawn/Options/Abort - at the top of the window, it says DAYZ ANTIHACK in red ( http://www.imagehousing.com/image/1197603 )  - granted this isnt proof of an antihack entity, i suppose it could just be branding.

 

Is there some where something like that would be universally launched from ? ie init.sqf or something?  Sorry for sounding a bit wishy washy, this isnt my server, im just assisting in adding in scripts for them.  If i can get a clue of what and where to look i will gladly resume hunting

 

Any help appreciated :).

Link to comment
Share on other sites

I had considered that, i turned off battleye as a test, but it seems the issue is still there.  

 

What i had thought is that there maybe some other antihack in operation, according to the hosts console currently no BE/Antihack are enabled, but im sceptical over that as when in game, hitting escape to display the usual menu system ie Save/Restart/Respawn/Options/Abort - at the top of the window, it says DAYZ ANTIHACK in red ( http://www.imagehousing.com/image/1197603 )  - granted this isnt proof of an antihack entity, i suppose it could just be branding.

 

Is there some where something like that would be universally launched from ? ie init.sqf or something?  Sorry for sounding a bit wishy washy, this isnt my server, im just assisting in adding in scripts for them.  If i can get a clue of what and where to look i will gladly resume hunting

 

Any help appreciated :).

 

 

Found the problem - the hosts had bundled a "lite" version of infistar - no access to the folder, so i turned it off for now, menus in this script and others are now behaving woop! 

Link to comment
Share on other sites

Ok one last thing from me - two buttons on the menu system from the vendor appears to be blank - randomly clicking will purchase an AI unit, but cannot figure out how to add in the actual text on the vendors menu.

 

I have been over the additions and cant spot anything missing or added in wrong, anyone got any pointers?

 

Snapshot of vendor in current state:  http://www.imagehousing.com/image/1197616

 

 

thanks again  :)

Link to comment
Share on other sites

Ok one last thing from me - two buttons on the menu system from the vendor appears to be blank - randomly clicking will purchase an AI unit, but cannot figure out how to add in the actual text on the vendors menu.

 

I have been over the additions and cant spot anything missing or added in wrong, anyone got any pointers?

 

Snapshot of vendor in current state:  http://www.imagehousing.com/image/1197616

 

 

thanks again  :)

 

I had this same issue. It doesn't state that you have to put the stringtable.csv anywhere, but you actually do.. 

 

Make sure your "stringtable.csv" file is in the root of your mission folder.

Link to comment
Share on other sites

I had this same issue. It doesn't state that you have to put the stringtable.csv anywhere, but you actually do.. 

 

Make sure your "stringtable.csv" file is in the root of your mission folder.

 lol i just found that out by myself and had come back to post the solution ! :lol:  but thanks for replying - glad i got there in the end!

Link to comment
Share on other sites

Hiya Stench, thanks for that, i tried but I must of screwed up somewhere as they still arent engaging zeds

 

zombie_generate.sqf taken from pbo and put into custom folder in root of mission

 

 

//Add some loot
_rnd = random 1;
if (_rnd > 0.3) then {
    _lootType =         configFile >> "CfgVehicles" >> _type >> "zombieLoot";
    if (isText _lootType) then {

        _array = [];
        if (DZE_MissionLootTable) then {
            _array = getArray (missionConfigFile >> "cfgLoot" >> getText(_lootType));
        } else {
            _array = getArray (configFile >> "cfgLoot" >> getText(_lootType));
        };
        if (count _array > 0) then {
            _loot = _array call BIS_fnc_selectRandomWeighted;
            if(!isNil "_array") then {
                _agent addMagazine _loot;
            };
        };
    };
};

_agent addRating -1000000;


//Start behavior
_id = [_position,_agent] execFSM "\z\AddOns\dayz_code\system\zombie_agent.fsm";

 

 

 

 

 

Called zombie_generate.sqf file from the bottom of my init.sqf:

 

call compile preprocessFileLineNumbers "custom\zombie_generate.sqf";

 

 

Any ideas what im doing wrong?

Link to comment
Share on other sites

your antihack is blocking the addaction ... you need to allow commanding menus as the action currently cannot be whitelisted

 

@all

on a side note i now have a working script that makes spawns the ai serverside ... i also added some code that will hopefully force the ai to return to the player (if too far from the player), rearms the ai and hopefully also prevent shooting within defined safezones

@Halvhjearne,

care to share this serverside addition?

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Advertisement
×
×
  • Create New...