Jump to content
Sign in to follow this  
madmedic

Why doesnt this script work?

Recommended Posts

It is for Footmuch's A1 Skyraider...It is SUPPOSED to make the AI pilot climb to 400m after firing rockets, or dropping a Rockeye.

(I edited the config so that the plane carries 20 rockets and fires them in bursts of 4...and added a "fired" eventhandler to call this script)

It does not work...can anyone venture a guess as to why?

called with this eventhandler

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">fired="[_this] exec ""\rktskyraider\cluster.sqs""; [_this] exec {\skyraidercbu\scripts\climb.sqs}";

here is the script: "climb.sqs"

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

_weapon = _array select 1

_ammoname = _array select 4

_plane = _array select 0

; Decide what we've fired

? (_weapon == "RKTSandyGun"): goto "exit"

? (_weapon == "RKTRocketRail"): goto "rocketCheck"

? (_weapon == "RKTRockeyeRail"): goto "BombCheck"

#BombCheck

_bombcount = _plane ammo "RKTRockeye"

? (_bombcount == 3) : goto "bombaway"

? (_bombcount == 2) : goto "bombaway"

? (_bombcount == 1) : goto "bombaway"

? (_bombcount == 0) : goto "bombaway"

#rocketCheck

_rocketcount = _plane ammo "Zuni"

? (_rocketcount == 16) : goto "rocketaway"

? (_rocketcount == 12) : goto "rocketaway"

? (_rocketcount == 8) : goto "rocketaway"

? (_rocketcount == 4) : goto "rocketaway"

? (_rocketcount == 0) : goto "rocketaway"

#bombaway

_plane flyinheight 400

goto "exit"

#rocketaway

_plane flyinheight 400

goto "exit"

#Exit

exit

Share this post


Link to post
Share on other sites

Although I'm not quite sure why it doesn't work, you can make it a lot shorter and more effective concerning the game performance.

Eventhandler:

Quote[/b] ]fired="[_this] exec {\rktskyraider\cluster.sqs}; if ((_this select 1) in [{RKTRocketRail},{RKTRockeyeRail}]) then {if ((_this select 1) == "RKTRocketRail" && (((_this select 0) ammo {Zuni})%4 != 0)) then {(_this select 0) flyInHeight 400}}"

Sure about the "Zuni" ?

Share this post


Link to post
Share on other sites
Although I'm not quite sure why it doesn't work, you can make it a lot shorter and more effective concerning the game performance.

Eventhandler:

Quote[/b] ]fired="[_this] exec {\rktskyraider\cluster.sqs}; if ((_this select 1) in [{RKTRocketRail},{RKTRockeyeRail}]) then {if ((_this select 1) == "RKTRocketRail" && (((_this select 0) ammo {Zuni})%4 != 0)) then {(_this select 0) flyInHeight 400}}"

Sure about the "Zuni" ?

THANKS biggrin_o.gif

So...That is an event handler that will accomplish everything I need to do without calling in a seperate script???

(please bear with me...all that writing looks like Chinese to me)

Does that eventhandler call for a flyinheight 400 after a bomb drop also?...(I am a little confused, because it mentions the bomb rail and the rocket rail, but it only mentions the ammo of the rocket rail.

I need it to work for both

Share this post


Link to post
Share on other sites

That eventhandler throws an error message, and the game wont start confused_o.gif

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">CfgVehicles/skyraider/eventhandlers.fired' 'R' encountered instead of ';'

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">fired="[_this] exec {\rktskyraider\cluster.sqs}; if ((_this select 1) in [{RKTRocketRail},{RKTRockeyeRail}]) then {if ((_this select 1) == {RKTRocketRail} && (((_this select 0) ammo {Zuni})%4 != 0)) then {(_this select 0) flyInHeight 400}}"

the single " in the eh confuse the engine

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  

×