Jump to content
Sign in to follow this  
hamis

Eventhandler problem

Recommended Posts

Well,what's wrong with this?Whatever i try,i get error msg's.

class GunClouds : WeaponCloudsGun

{

cloudletGrowUp=0.200000;

cloudletFadeIn=0;

cloudletFadeOut=0.400000;

cloudletDuration=0.200000;

cloudletAlpha=1;

cloudletAccY=2;

cloudletMinYSpeed=-10;

cloudletMaxYSpeed=10;

interval=0.020000;

size=0.300000;

sourceSize=0.015000;

};

};

class EventHandlers

{

init="_this exec ""\@ECP\EECP_Tracer_Init.sqs""";

};

class Civilian:Man

Share this post


Link to post
Share on other sites

Maybe if you posted the error message as well. Because if its an "Input detected after end of file" message you've got an extra }; in there somewhere, if its "'X' detected instead of 'Y'" message, its something else entirely...

Share this post


Link to post
Share on other sites

Well,it's }; problem.Can't get them right,cutting config or doesn't know what EH is for!

Share this post


Link to post
Share on other sites
Guest [B.B.S.] T_D

I think it has to look like this. One }; must be moved to the end to close the class of your object or whatever:

class GunClouds : WeaponCloudsGun

{

cloudletGrowUp=0.200000;

cloudletFadeIn=0;

cloudletFadeOut=0.400000;

cloudletDuration=0.200000;

cloudletAlpha=1;

cloudletAccY=2;

cloudletMinYSpeed=-10;

cloudletMaxYSpeed=10;

interval=0.020000;

size=0.300000;

sourceSize=0.015000;

};

class EventHandlers

{

init="_this exec ""\@ECP\EECP_Tracer_Init.sqs""";

};

<span style='color:red'>};</span>

class Civilian:Man

Share this post


Link to post
Share on other sites

Well,not as good as i thought.Now ofp does start about every fourth time. crazy_o.gif

Share this post


Link to post
Share on other sites

Try :

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">init="[_this select 0] exec ""\@ECP\EECP_Tracer_Init.sqs""";

Share this post


Link to post
Share on other sites
Try :

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">init="[_this select 0] exec ""\@ECP\EECP_Tracer_Init.sqs""";

That's unnecessary, "[_this select 0]" is the exact same thing as "_this" when you're using it for init eventhandlers ("_this" is actualy equal to "[_this select 0]", since the init eventhandler only has 1 parameter, so when the script looks for "_this select 0", it's looking in "[_this select 0]", for the first item in the array, which is "_this select 0", and if you use "_this" in the config then it'll still be looking at "[_this select 0]", since "_this" is an array of all of the parameters, if it where a different EH, killed for example, "_this" would equal "[_this select 0,_this select 1,_this select 2], so then using "[_this select 0,_this select 1,_this select 2] for parameters in executing the script in the eventhandler, it's just a waste of space). Both will work, the latter is just shorter and usualy what more experienced scripters use.

Share this post


Link to post
Share on other sites

Didn't work. sad_o.gif Is there better way to init this(Bn_tracer at the end):

// PBO release path

#define ECP_EH_INIT "IF (format[{%1},ECP_path] == {scalar bool array string 0xfcffffef}) THEN { ECP_path = {\ECP_Effects\}; _this exec (ECP_path+{ECPinit.sqs});{_c = _x camcreate [0,0,0]} foreach [{ECP_MKII},{ECP_M61},{ECP_M67},{ECP_F1},{ECP_RGO},{ECP_RDG1},{ECP_ANM8},{ECP_ANM83},{ECP_

M18Red},{ECP_M18Green}]}; _this exec (ECP_path+{init.sqs});[_this select 0,2]call loadFile""\Bn_tracer\addTracerUnit.sqf"""

It needs EECP_tracer_init to prevent specops and snipers having tracers.And how to init these in FDF_Mod?

Share this post


Link to post
Share on other sites
Didn't work. sad_o.gif Is there better way to init this(Bn_tracer at the end):

// PBO release path

#define ECP_EH_INIT "IF (format[{%1},ECP_path] == {scalar bool array string 0xfcffffef}) THEN { ECP_path = {\ECP_Effects\}; _this exec (ECP_path+{ECPinit.sqs});{_c = _x camcreate [0,0,0]} foreach [{ECP_MKII},{ECP_M61},{ECP_M67},{ECP_F1},{ECP_RGO},{ECP_RDG1},{ECP_ANM8},{ECP_ANM83},{ECP_

M18Red},{ECP_M18Green}]}; _this exec (ECP_path+{init.sqs});[_this select 0,2]call loadFile""\Bn_tracer\addTracerUnit.sqf"""

It needs EECP_tracer_init to prevent specops and snipers having tracers.And how to init these in FDF_Mod?

First tell us what you are trying to do, cause all that crap you wrote doesn't mean a thing out of context. I don't know wether or not you want ALL of the ECP scripts to run on the unit or just the tracers, or whatever, I have no idea what you are trying to do because you're showing me an otherwise perfectly fine (although quite uneconomical) line of code.

Please?

Share this post


Link to post
Share on other sites

Well,it works now.I inited EECP_tracer_init.sqs for each specop and sniper individually.What i mean is it caused startup problem when inited as man class EH.Why uneconomical?What is best way to init both for non ECP configs?

Share this post


Link to post
Share on other sites
Well,it works now.I inited  EECP_tracer_init.sqs for each specop and sniper individually.What i mean is it caused startup problem when inited as man class EH.Why uneconomical?What is best way to init both for non ECP configs?

You never answered my question, therefore I cannot answer yours. What do you mean by "init both for non ECP configs?" I'm not familiar with ECP, so what the hell does "for non ECP configs" mean in terms of executing (<- thats a proper verb, "init" is not) init EH's? What is a "non ECP config" in this case - are you talking about compatability? Be specific - not everyone thinks like you do... icon_rolleyes.gif

And it's uneconomical because it clutters the init eventhandler, it can be better organized into a more effecient script, the init EH should NOT be used as an init field like the ones in the editor. It is different, and should be treated so!

confused_o.gif When will people learn? I learned everything I know about scripting just by reading tons of lines of code - if you do this enough it starts to make sense and later on you laugh at how obvious it is - common sense, experience, and just accepting things.

Share this post


Link to post
Share on other sites

Well,sorry.I mean what is best way to execute these in normal configs(resistance,FDF_Mod,other mods)?Bn_tracer\addTracerUnit.sqf adds realistic tracers for weapons,EECP_tracer_init.sqs removes them from specops and snipers.

Share this post


Link to post
Share on other sites
Well,sorry.I mean what is best way to execute these in normal configs(resistance,FDF_Mod,other mods)?Bn_tracer\addTracerUnit.sqf adds realistic tracers for weapons,EECP_tracer_init.sqs removes them from specops and snipers.

Don't bother with the ECP scripts if all you want is the tracers, in fact I can practically guaruntee you that the ECP script won't work they way you want it to either. You should make your own script based off of ECP's script so you can change it to fit your needs. I can't offer anymore help without seeing "EECP_tracer_init.sqs" though.

Share this post


Link to post
Share on other sites

It is not ECP script,but added to the end of first line of code.And it works very well.Problem is that normal configs don't have these lines,so i don't know where to execute them.

;EECP_Tracer_Init.sqs

;07/05/05

_u = _this select 0

MachineGunners = ["SoldierWMG", "SoldierEMG", "SoldierGMG"];

SpecOps = ["SoldierWSniper", "SoldierWSaboteurPipeHGS","SoldierWLAWSniper", "SoldierWSaboteur", "SoldierWSaboteurPipe", "SoldierWSaboteurDay", "SoldierWSaboteurPipeHG", "SoldierWSaboteurLaser", "SoldierESniper", "SoldierESaboteurPipe", "SoldierESaboteurBizon", "SoldierESaboteurPipeHG","Hunter", "SoldierGSniper"];

~1

? typeOf _u in SpecOps:exit;

? typeOf _u in MachineGunners:goTo "MG"

[_u, 2]call loadFile {\bn_tracer\addTracerUnit.sqf};

exit;

#MG

[_u, 5]call loadFile {\bn_tracer\addTracerUnit.sqf};

exit;

Share this post


Link to post
Share on other sites

Ok, I see now. Save yourself a lot of trouble and copy that script into the new addon and execute it through the init EH, you don't even need to execute the Bn scripts, this script does it for you.

Ex:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class EventHandlers

{

init="_this exec ""\path\script.sqs""";

};

Share this post


Link to post
Share on other sites

Well,what is the best place (exact line) to execute this eh?I tried between class man and class civilian,but it caused ofp to start about every fourth time i tried to!

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  

×