Jump to content
Sign in to follow this  
Messiah

Engine Eventhandler - Brain Fart

Recommended Posts

Ok, engine eventhandler returns an array containing the unit and the engine state, 1 or 0.

now, I'm executing the eventhandler thusly:

class Extended_Engine_EventHandlers
{
class ukf_landrover_base
{
	ukf_landrover_base_engine="_this exec ""\ukf_landrovers\scripts\startstop.sqs""";
 	};
};

I've also tried an array with old _this select nonsense in as well. The script:

_unit = _this select 0
_onoff = _this select 1

?!(Local _unit) : exit

?(_onoff==1) : goto "engineon"

#engineoff

_unit say ["ukf_landrover_engineoff", 20]

exit

#engineon

_unit say ["ukf_landrover_engineon", 20]

exit

nothing complex, but it errors at the (_onoff==1) part, type bool expected number. Now I always mix up the error messages and what they mean, but I assume thats saying that its expecting a boolean and I've asked for a number? The boolean the engine returns is true or false, 1 or 0, so I'm not sure whats wrong.

Bound to be something obvious and idiotic, as I said, I'm having a brain fart today

Share this post


Link to post
Share on other sites

_onoff is a boolean which cant be compared to a number.

you could just write

?_onoff : goto "engineon"

Share this post


Link to post
Share on other sites

d'oh

told you it was a brain fart moment, yes, of course, thank you

Share this post


Link to post
Share on other sites

You know what helps to clear the GAS? sidechat of your input/data _this. :D (for general fart reduction)

Share this post


Link to post
Share on other sites

that's far too sensible for my tastes... although now the script works, of course the damn game can't find my sounds...

class CfgSounds
{
sounds[] = {ukf_landrover_engineon, ukf_landrover_engineoff};   
 	class ukf_landrover_engineon
 	{
  		name = "ukflandroverengineon";
  		sound[] = {"\ukf_landrovers\sound\start.ogg", db0, 1};
  		titles[] = {};
	};
 	class ukf_landrover_engineoff
 	{
 		name = "ukflandroverengineoff";
  		sound[] = {"\ukf_landrovers\sound\stop.ogg", db0, 1};
  		titles[] = {};
 	};
};

beware possible brain fart moment again, but I see nothing wrong with that config entry (copy paste from the wiki no less)

Share this post


Link to post
Share on other sites

This is just a wild guess, i don't have much experience with configs.

As name in the config you define

name = "ukflandroverengineoff";

but when calling it, its

_unit say ["ukf_landrover_engineoff", 20]

Shouldn't it rather be

_unit say ["ukflandroverengineoff", 20]

?

Share this post


Link to post
Share on other sites

I think name is the name that appears in the mission editor 'effects' tab as the name of the sound file. I did have them both the same name at one stage (with underscores) but changed it in case it was causing conflicts.

no harm in trying again I suppose :D

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  

×