Jump to content
Sign in to follow this  
inetpwnZ

link sqf in init/compiles.sqf

Recommended Posts

Hey i am making and extended mod for DayZ

The followed problem/issue is :

*compiles.sqf* Code

{

player_drink = compile preprocessFileLineNumbers "\z\addons\inet_main\actions\player_drink.sqf";

}

The compiles is Located in \inet_main\init\compiles.sqf also.

It seems like there is something wrong with the path

the "player_drink.sqf" dosen't get executed is there anyway i can check it if it got executed ?

is the \z\ necessary or just for files they are located in other addons or folders outside of inet_main?

Greetings , inet pwnZ

Share this post


Link to post
Share on other sites

I thought only a relative path was necessary when working inside an addon. Not sure how it works with higher up in the folder hierarchy. In fact I'm not sure at all.

Share this post


Link to post
Share on other sites

Usually easiest to just use the pbo name for everything, I usually omit addon prefixes when working with scripts and code inside an addon (easiest way).

Share this post


Link to post
Share on other sites

Short description :

The Problem

I want that drinking give's blood

I scripted it but it dosen't work

This is the drinking function

player_drink.sqf (drink works, giving blood dosen't work)

private["_hasFood","_item","_text","_key","_config","_sfx"];
disableserialization;
call gear_ui_init;
_onLadder =		(getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
if (_onLadder) exitWith {cutText [(localize "str_player_21") , "PLAIN DOWN"]};

if (vehicle player != player) exitWith {cutText ["You may not drink while in a vehicle", "PLAIN DOWN"]};

_item = _this;
_hasdrinkitem = _this in magazines player;

_config = configFile >> "CfgMagazines" >> _item;
_text = getText (_config >> "displayName");
_sfx = 	getText (_config >> "sfx");
_regen = 	getNumber (_config >> "bloodRegen");

if (!_hasdrinkitem) exitWith {cutText [format[(localize "str_player_31"),_text,"drink"] , "PLAIN DOWN"]};

player playActionNow "PutDown";
player removeMagazine _item;
sleep 1;
[player,_sfx,0,false] call dayz_zombieSpeak;

r_player_blood = r_player_blood + _regen;
if (r_player_blood > r_player_bloodTotal) then {
r_player_blood = r_player_bloodTotal;
};

if (_item == "ItemWaterbottle") then {
player addMagazine "ItemWaterbottleUnfilled";
};
player setVariable ["messing",[dayz_hunger,dayz_thirst],true];
player setVariable["USEC_BloodQty",r_player_blood,true];

/*
_update = player getVariable["updatePlayer",[false,false,false,false,false]];
_update set [4,true];
player setVariable["updatePlayer",_update,true];
*/

_id = [player,20,true,(getPosATL player)] spawn player_alertZombies;

dayz_lastDrink = time;
dayz_thirst = 0;

//Ensure Control is visible
_display = uiNamespace getVariable 'DAYZ_GUI_display';
_control = 	_display displayCtrl 1302;
_control ctrlShow true;

_bloodVal =		r_player_blood / r_player_bloodTotal;
if (_bloodVal >= 0.2) then {
_ctrlBlood ctrlShow true;
};
cutText [format[(localize  "str_player_consumed"),_text], "PLAIN DOWN"];

The Class :

config.cpp

class CfgMagazines {
class CA_Magazine;	// External class reference

class FoodDrink : CA_Magazine
{
	isWater = 1;
	count = 1;
	type = 256;
	bloodRegen = 200;

	class ItemActions
	{
		class Drink
		{
			text = "$STR_inet_drink";
			script = "spawn player_eat;";
		}; // class Drink
	}; // class ItemActions
}; // class FoodDrink
class ItemSodaMdew : FoodDrink
{
	scope = 2;
	sfx = "soda";
	displayName = "$STR_EQUIP_NAME_37";
	model = "\dayz_equip\models\soda_mdew.p3d";
	picture = "\dayz_equip\textures\equip_soda_mdew_ca.paa";
	descriptionShort = "$STR_EQUIP_NAME_37";
	bloodRegen = 6000;
}; // class ItemSodaMdew
};

compiles.sqf

player_drink =				compile preprocessFileLineNumbers "\z\addons\inet_main\actions\player_drink.sqf";

my prefix is set to z\addons\inet_main

(Random question how does the init\compiles.sqf get executed ? Automatic like the config.cpp ?)

Edited by inetpwnZ

Share this post


Link to post
Share on other sites

And I'm sure by "Giving Blood" you've lost a lot of us, this is why I suggested you ask this question on the DayZ forums :)

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×