Jump to content
Sign in to follow this  
Opticalsnare

need help with some scripts

Recommended Posts

Well its been a pretty frustrating day. Anyway ive got 2 mods which im trying to get work correctly one is visual effects and other sound effects but its just confusing to me atm, the two mods work correctly together but just using one mod for the time being to identifi the problem as it affects both mods if they are run on their own or not. The problem is that either the visual effects works only on vehicles or only on infantry weapons like rifles etc

class Extended_PostInit_EventHandlers {
WarFXPE_PostInit = "[] execVM ""WarFXPE\ParticleEffects\SCRIPTS\init.sqf"";";
};

This makes vehicle weapon based scripts work correctly, like sounds, other effects. But weapon based scripts for small arms wont work at all.

class Extended_PreInit_EventHandlers {
class WarFXPE {
	clientInit = "call compile preProcessFileLineNumbers 'WarFXPE\ParticleEffects\SCRIPTS\init.sqf'";
};
};

This allows weapon scripts to work correctly, but completly breaks the vehicle based scripts like smoke launchers and any other scripted events on the fired event handlier etc... Anyway ive pretty much exhausted my efforts in working this out for myself. So hopfully someone can help out in whatever means possible. I can also post other related parts of the script if need be.

Edited by Opticalsnare

Share this post


Link to post
Share on other sites

First I'll warn you I'm no scripting genius, so this may not get you ahead at all.

And without seeing the init.sqf, this is a shot in the dark too, but what's to stop you from splitting (or even copying) the init.sqf in to 2 scripts (eg init_veh.sqf & init_wep.sqf) and firing up each in the appropriate way that works?

The only problem I can see cropping up is if there's a chance variables will get shared when they shouldn't. If the variables are internal to the script (ie they don't need to be known outside of it), then you should make them private in the first line of the script to avoid weirdness.

private ["_varname1", "_varname2"];

It's an ugly solution, but sometimes the engine seems to demand the ugly method.

Share this post


Link to post
Share on other sites

Well heres some more of the scripts

weapon.cpp

class CfgPatches {
class WarFXPE_Weps {
	units[] = {};
	weapons[] = {};
	requiredVersion = 1.04;
	requiredAddons[] = {"Extended_EventHandlers", "WarFXPE","CAData","CAAir","CAAir2","CAAir3","CAA10","CACharacters","CASounds","CAWeapons","CAWeapons2","CAWheeled","CAWheeled2","CAWheeled3","CATracked","CATracked2"};
};
};

class Extended_Fired_EventHandlers {
class CAManBase {
	class WarFXPE_Weps {
		clientFired = "_this call Bis_Effects_EH_Fired;";
	};
};
};

class Extended_Killed_EventHandlers {
class CAManBase {
	class WarFXPE_Weps {
		clientKilled = "_this call Bis_Effects_EH_Killed;";
	};
};
};

init.sqf

waitUntil{not isNil "BIS_Effects_Init"};
if(isNil "WarFXPE") then
{

   WarFXPE=true;
   BIS_Effects_EH_Fired=compile preprocessFileLineNumbers "\warfxpe\ParticleEffects\SCRIPTS\fired.sqf";
   BIS_Effects_EH_Killed=compile preprocessFileLineNumbers "\warfxpe\ParticleEffects\SCRIPTS\killed.sqf";
   WarFXPE_25mm=compile preprocessFileLineNumbers "\warfxpe\ParticleEffects\SCRIPTS\ammo\25mm.sqf";
   WarFXPE_556x45=compile preprocessFileLineNumbers "\warfxpe\ParticleEffects\SCRIPTS\ammo\556x45.sqf";

};

fired.sqf

private ["_amm"];
_amm=_this select 4;
_this call (call compile GetText (configFile >> "CfgAmmo" >> _amm >> "WeaponEffects"));

Edited by Opticalsnare

Share this post


Link to post
Share on other sites

Ugh .cpp files! :butbut: they make my head bleed. :o

OK so as far as code goes, it all seems OK, with one questionable thing: --

Any reason why the "works on vehicles only" call -

class Extended_PostInit_EventHandlers {
WarFXPE_PostInit = "[] execVM ""WarFXPE\ParticleEffects\SCRIPTS\init.sqf"";";
};

isn't done like this:

class Extended_PostInit_EventHandlers {
[color="Red"]class WarFXPE {[/color]
	WarFXPE_PostInit = "[] execVM ""WarFXPE\ParticleEffects\SCRIPTS\init.sqf"";";
[color="Red"]};[/color]
};

Maybe the vehicle effects work when it's not called from inside a "class WarFXPE" statement because you haven't stuck the vehicle effects inside a "class WarFXPE" statement in the cpp or something like that?

And so it doesn't work on the Weapons because they're inside a "class WarFXPE" statement, and the vehicle ones aren't?

Or possibly the vehicle init should be inside a "class WFXPE_Vehs" statement, and the weapons init inside a "class WFXPE_Weps" statement, to keep them separate.

class Extended_PostInit_EventHandlers {
   class WarFXPE {
       class WarFXPE_Vehs {
           clientInit = "call compile preProcessFileLineNumbers 'WarFXPE\ParticleEffects\SCRIPTS\init.sqf'";
       };
       class WarFXPE_Weps {
           clientInit = "call compile preProcessFileLineNumbers 'WarFXPE\ParticleEffects\SCRIPTS\init.sqf'";
       };
   };
};

Try ditching the "class WarFXPE" bit from the weapons one and see if that breaks the weapons but works on the vehicles:

class Extended_PreInit_EventHandlers {
	WarFXPE_PostInit = "call compile preProcessFileLineNumbers 'WarFXPE\ParticleEffects\SCRIPTS\init.sqf'";
};

Sorry if I'm being really dumb asking these questions, but config.cpp addon stuff is a bit of a grey area for me.

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  

×