Jump to content

trying to make an addon pbo


Leigham

Recommended Posts

im trying to make an addon pbo, not giving out any hints what for yet, but i have created a function in a config.cpp

class CfgFunctions {
	class UD {
		class main {
			file = "UD";
			class Init {
				//preInit = 1;
				postInit = 1;
			};
		};

		class UD_scripts
		{
			file = "UD\scripts";
			class function {};

		};
	};
};

my fn_init

/*
	Update 16.02.2015
	By Leigham
*/
//Server side addon init.sqf
//Options For Admins 
UD_Debug = True;
//Compiling the Function to use in mission.pbo 
if (isServer) then {
UD_fnc_function = compile preprocessFileLineNumbers "\q\addons\UD\scripts\fn_DeployVic.sqf";
};

diag_log "UD INIT: Text Here";

//More to Come 

not going to show the file, would give to much away, but is file is fn_function.sqf and its directory is @epochhive\addons\UD\scripts (UD being the pbo)

and im trying to call it from the mission.pbo, i thought as a function i could call it from the mission pbo, if not how could i do this ?

 

anyhelp would be greatly appreciated and worth a beer, thanks : D

Link to comment
Share on other sites

Issues with PBOs not loading files are almost always pathing errors in the prefix files.  Double and triple check them.  Open the PBO in PBOManager and click the gear looking icon at the top of the window.  Look for the prefix field.  If it's not present, add it with the appropriate path, even if PBOPrefix is present.  Usually fixes it for me.

Link to comment
Share on other sites

https://www.dropbox.com/s/uqdugq0288ezksr/epoch.Chernarus.pbo?dl=0

https://www.dropbox.com/s/byx4vhm9zkgc72i/ud.pbo?dl=0

 

Mission.pbo, with the Script that calls the function, scroll wheel menu 

and drag the UD folder into @epochhive\addons 

 

if anyone could take a look would be defianalty worth a beer, ive tried many different filenames/paths, but the fn_init cant find the file 

Link to comment
Share on other sites

You don't need both prefix files/properties, one is enough, delete pboprefix file. You can edit values yourself or have a file inside your folder that PBO packers will pick up and create property automatically for you, but as I said - one is enough.

 

And no matter what, you need to keep folder structure in your scripts same as you instructed it within prefix value, judging by your screenshots it should look like this:

UD_fnc_function = compile preprocessFileLineNumbers "\UD\fn_DeployVic.sqf";

however one of your screenshots has this:

UD_fnc_function = compile preprocessFileLineNumbers "fn_DeployVic.sqf";

This is pointing to MPMissions pbo file (file that all clients downloads). If you keep it there, then this path will be valid, but since you want to use your own PBO, you must use your own paths that you define in pbo prefix.

 

This error:

19:20:44 Warning Message: Script scripts\fn_function.sqf not found

is looking for file in mission PBO under folder named "scripts"

 

If you are confused, here's 2 examples, spot the difference:

//this is scripts folder inside mission PBO
scripts\fn_function.sqf

//this is custom PBO with prefix value "scripts". File is in the root of folder.
\scripts\fn_function.sqf

Hope this helps.

Link to comment
Share on other sites

Precisely, but with a back-slash, not a forward-slash. And the file in that case would be placed in the root of pbo.

Also you don't have to use x\addons part if you don't want to. That's just a gimmick to keep things tidy between devs/mods.

Link to comment
Share on other sites

Let me give you another interesting example how BI split their huge files into smaller PBOs while keeping same structure and compatibility:

 

Let's say you want to create huge world with ton of custom objects and textures. When you pack it, it would end up around 5GB. This is very realistic scenario, tbh. When game loads, only headers and configs of PBO are read, that's it.

When you load terrain data, whole PBO is loaded from HDD into RAM and then required files are copied over, PBO is then unloaded.

If you have basic technical background, you should know that this is bad news on 32-bit OS, not to mention the time required to load the whole damn thing every time you drive few hundred meters with your car, forget flying.

 

Lets say, we have our terrain data, models, rvmats and textures in seperate folders. What can be done is - you simply pack each folder seperately and adjust PBO prefixes to match original folder structure.

 

Example:

// Windows folder structure before PBO packing
\myAwesomemod\terrain.wrp
\myAwesomemod\models\*.p3d
\myAwesomemod\data\*.paa
\myAwesomemod\mats\*.rvmat

//Instead of packing it all into one PBO, we create 4 smaller PBOs while maintaining perfect compatibility

// PBO prefix for WRP file
myAwesomemod

// PBO prefix for models
myAwesomemod\models

// PBO prefix for textures
myAwesomemod\data

// PBO prefix for materials
myAwesomemod\mats

This way if only model needs to be loaded or texture for specific terrain grid, only smaller PBO will be loaded instead of a whole. You can ofcourse keep splitting it into even smaller chunks, sky's the limit.

Link to comment
Share on other sites

Could not load '\ud\scripts'. Extension not listed in allowedPreprocessFileExtensions 

 

 

im getting this now ? any ideas ?

https://community.bistudio.com/wiki/server.cfg#Server_Security

 

you'll need to whitelist sqf, but pretty sure that will weaken your server's defenses if it was blacklisted by epoch devs.

Link to comment
Share on other sites

I'm afraid I got not answer to that one. This is a different problem and would probably make more sense to make a new topic for it, since your files are now found and loaded.

It could be somehow related to this issue posted by one of dayz/epoch devs, not sure tho. I am only guessing this because I've been told that A3E does not use init.sqf from mission pbo due to hacking issues. So obviously there's something else going on in the background, no idea what it is, don't have epoch server or files.

Best of luck on the issue, tho.

Link to comment
Share on other sites

Server File

if(isServer) then {
"UDVIC" addPublicVariableEventHandler {
private["_veh","_pos","_fuel","_damage","_direction","_searchRadius","_spawnPos"];
_veh = _this select 0;
_pos = _this select 1; _pos set[2, 0];
_fuel = if(count _this > 2)then[{_this select 2},{0.15 max (random .35)}];
_damage = if(count _this > 3)then[{_this select 3},{0.35 max (random .75)}];
_direction = if(count _this > 4)then[{_this select 4},{random 360}];


_veh = createVehicle[_veh, _Pos, [], 0, "NO_COLLIDE"];
_veh allowDamage false;
_veh setDir _direction;
_veh setVectorUp (surfaceNormal (getPos _veh));

_veh call EPOCH_server_setVToken;
_veh call EPOCH_server_vehicleInit;
_veh setVariable ["UD_vehicle", true];
_veh disableTIEquipment true;
_veh lock 2;

_veh setFuel _fuel;
_veh setDamage _damage;
_veh allowDamage true;

_veh
};
private["_veh","_pos","_fuel","_damage","_direction","_searchRadius","_spawnPos"];


};


and Client 

UDVIC = [
cutText [format["Checking if you have Salvage Metal for the Ebike"], "PLAIN DOWN"];
 
sleep 3;
 
    if ("ItemCorrugated" in magazines player) then{
player playActionNow "Medic";
sleep 3;
_spawn = "ebike_epoch";
    _posplr = [((getPos player) select 0) + 2, ((getPos player) select 1) + 2, 0];
    _dirplr = getDir player;
    _spawnveh =	[_spawn,_posplr,1,0,_dirplr] execvm"\ud\fn_deployvic.sqf";
    _spwnveh setVariable ["Sarge",1,true];
    
sleep 3;
 
cutText [format["You've used your Corrugated to build a Ebike."], "PLAIN DOWN"];
} else {
SystemChat "You need one Corrugated to build an Ebike"; 
};
];
publicVariableserver "UDVIC";

Something like that ?

Link to comment
Share on other sites

Not sure if it works to check the players magazines serverside and keep in mind, this code is not testet!

	/* client script */
titleText ["Checking if you have Salvage Metal for the Ebike", "PLAIN DOWN"];
sleep 3;
if("ItemCorrugated" in (magazines player))then[{
	titleText ["", "PLAIN DOWN"];
	player playActionNow "Medic";
	_spawnPos = player modelToWorld [0,2,0];
	_spawnPos set[2,(0 max (getPosATL player) select 2)];
	_spawnDir = (getDir player) -90;
	UDVIC = [player, _spawnPos, _spawnDir];
	sleep 3;
	publicVariableServer "UDVIC";
	sleep 1;
	titleText ["You've used your Corrugated to build a Ebike.", "PLAIN DOWN"];
},{
	titleText ["You need one Corrugated to build an Ebike", "PLAIN DOWN"];
}];



	/* Server script */
if(isServer) then {
	"UDVIC" addPublicVariableEventHandler {_this select 1 call Spawn_Ebike};

	Spawn_Ebike = {	private["_playerObj","_spawnPos","_spawnDir","_veh","_goat"];
		_playerObj = _this select 0;
		_spawnPos = _this select 1;
		_spawnDir = _this select 2;

		if("ItemCorrugated" in (magazines _playerObj))then[{
			_veh = createVehicle["Ebike_Epoch", _spawnPos, [], 0, "NO_COLLIDE"];
			_veh allowDamage false;
			_veh setPos _spawnPos;
			_veh setDir _spawnDir;
			_veh setVectorUp (surfaceNormal (getPos _veh));
			_veh call EPOCH_server_setVToken;
			_veh call EPOCH_server_vehicleInit;
			_veh setVelocity [0,0,.1];
			_veh allowDamage true;
		},{
			_goat = createAgent ["Goat_random_F", _spawnPos, [], 0, "FORM"];
			_goat setVariable ["BIS_fnc_animalBehaviour_disable", true];
			[_goat,_playerObj] spawn {
				private ["_goat","_playerObj","_end"];
				_goat = _this select 0;
				_playerObj = _this select 1;
				_end = time + 300;
				waitUntil{ UIsleep 10;
					_goat moveTo (getPos _playerObj);
				(!alive _goat || time >= _end)
				};
				_goat setDamage 1; sleep 30; hideBody _goat;
			};
		}];
	};

};
If it spawns a goat, we're all doomed!

Greez KiloSwiss

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...