Jump to content
Sign in to follow this  
nullsystems

Script not activated in CfgWeapons

Recommended Posts

Hello all, real quick config question here.

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

class CfgWeapons

{

class Default {};

class CarHorn: Default {};

class SportCarHorn: CarHorn {};

class NewHorn: SportCarHorn

{

displayName="Scream";

drySound[]={"\scripts\sound.ogg",30.0,1};

condition = "player in this && alive this";

statement = "[this] exec ""\scripts\script.sqs""";

};

};

Could someone explain why that script \scripts\script.sqs isnt being activated even tho the condition is being met?

I just need a script to be activated when that NewHorn weapon is used in a vehicle.

Also, why can I see "blinking = true" in some BI made scripts, but when I put it into my own light class or reflector class, it does nothing?

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

class Reflectors {

class Left {

color[] = {0.1, 0.1, 1, 1};

ambient[] = {0.5, 0.5, 0.5, 1};

position = "konec L svetla";

direction = "konec L svetla";

hitpoint = "L svetlo";

selection = "L svetlo";

size = 0.2;

brightness = 0.25;

blinking = true;

};

Share this post


Link to post
Share on other sites
Quote[/b] ]condition = "player in this && alive this";

statement = "[this] exec ""\scripts\script.sqs""";

You can't execute scripts from a weapon that way. Normally you would use a fired event handler, but that won't work either, with the default car horn.

You might be able to re-configure your own car horn to work with the event handler, but I've never tried it. So unless someone else can help, you may be out of luck?

Quote[/b] ] Also, why can I see "blinking = true" in some BI made scripts, but when I put it into my own light class or reflector class, it does nothing?

Have you defined the variable true, in your config?

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">#define true 1;

If not, try this:

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

Share this post


Link to post
Share on other sites

Aye, I understand what your saying there.

Its a shame about that.

Blinking, well I just checked and I have the define...and ive also tried the 1 method. Its just simply not working.

In the configs for UH60 and Road Sign Small ( two examples ) it has

class MarkerLights {

class RedBlinking {

blah;

blah;

blinking = 1;

};

};

No reflector class or light class...Just those.

I tried putting that in, but nothing happened...thats REALLY odd.

Do you think it could be assigned to AIR and STATIC only?

Share this post


Link to post
Share on other sites

It's defined in Bin.pbo under class AllVehicles. But I've only seen it used in buildings.pbo, so you might be right about it only applying to a certain class?

It is possible to do the same thing with a script, using the lightAttachObject command.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_Vehicle=_This Select 0;

_light = "#lightpoint" createVehicleLocal [0,0,0];

_light lightAttachObject [_Vehicle,_Vehicle selectionPosition "L svetlo"];

_light setLightAmbient[0.0, 1.0, 0.0];

_light setLightColor[0.0, 1.0, 0.0];

WaitUntil

       {

       _light setLightBrightness 1.0;

       Sleep 1;

       _light setLightBrightness 0;

       Sleep 1;

       !(Alive _Vehicle)

       };

lightDetachObject _light;

DeleteVehicle _Light;

Share this post


Link to post
Share on other sites

i tryed this out but keep getting error msg

light_error.jpg

bean looking for a blue flashing light for a wil got blue not got flash (script code not my hot point )

bk1276

Share this post


Link to post
Share on other sites

managed to get it working ok stupid thing it was was useing SQS instead of SQF.

just goes to show you what a letter can do

UNN

thank you lovely little script

bk1276

Share this post


Link to post
Share on other sites

lol UNN you read my mind. Just checked the post you made and had it setup like that yesterday.

Its a shame you cant impliment the blinking function, but we always find a way smile_o.gif

While the reflector class would of been nice to use for the function I need, an "orb" of light will do fine I suppose lol

Share this post


Link to post
Share on other sites
Quote[/b] ]lol UNN you read my mind. Just checked the post you made and had it setup like that yesterday.

Its a shame you cant impliment the blinking function, but we always find a way.

Yeah, it would be better if we could do all this within the configs. Plus the light source you get with that command, does not work well over large areas. But something is better than nothing.

Glad it came in handy for you, bk.

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  

×