Home   Help Search Login Register  

Author Topic: Tailrotor script  (Read 549 times)

0 Members and 2 Guests are viewing this topic.

GI-YO

  • Guest
Tailrotor script
« on: 11 Jan 2005, 13:09:28 »
I keep getting this error when using the tailrotor fail script out the ed department : '!_random[ # ]: error ! Type number, expected Bool'

And im trigering it using this line of code in a WP :
[cobra, 1, 1] exec "tailrotor.sqs"

cobra is name of the heli

Heres the script :

; tail-rotor fail script by Vektorboson
; SYNTAX
; [CHOPPER, <RANDOMKILLS, MAXKILLS>] exec "effects\tailrotor.sqs"
; CHOPPER is the helicopter
; RANDOMKILLS is either true or false (random people are killed)
; MAXKILLS is maximum of randomkills

_heli   = _this select 0
_random = true
_maxkills = 4
?count _this == 2: _random = _this select 1; _maxkills = 4
?count _this == 3: _random = _this select 1; _maxkills = _this select 2

; Position of helicopter engine (adjust this for different helicopters!)
_enginePos = [0, -3, 1]

drop ["cl_fire", "", "Billboard", 1, 1, _enginePos, [0,-3,1], 0, 1, 1, 0.001, [1,5], [[1,1,1,1],[1,1,1,0]],
  • , 0.1, 0.2, "", "", _heli]

~0.05
drop ["cl_fire", "", "Billboard", 1, 1, _enginePos, [0,-3,1], 0, 1, 1, 0.001, [1,5], [[1,1,1,1],[1,1,1,0]],
  • , 0.1, 0.2, "", "", _heli]

~0.02
drop ["cl_fire", "", "Billboard", 1, 1, _enginePos, [0,-3,1], 0, 1, 1, 0.001, [1,5], [[1,1,1,1],[1,1,1,0]],
  • , 0.1, 0.2, "", "", _heli]

_AddDir = 0.1
~(random 1)

#loop
_dir = getDir _heli
?_AddDir < 5: _AddDir = _AddDir + 0.05
_heli setDir (_dir + _AddDir)
_v = Velocity _heli
_heli setVelocity  [((_v select 0) / 1.001), ((_v select 1) / 1.001), -5]
drop ["cl_basic", "", "Billboard", 7, 7, _enginePos, [0,0,0], 0, 1, 1, 0.001, [1,5], [[0,0,0,0],[0,0,0,0.7],[0,0,0,0]],
  • , 0.1, 0.2, "", "", _heli]

~0.01
?getPos _heli select 2 > 2: goto "loop"

?alive _heli: _heli setDammage 0.8; _heli setFuel 0
?!alive _heli: exit

?!_random: exit
; now the randomkills
_crew = crew _heli
_c = count _crew
_i = 0
_kills = 0
#crew
_unit = _crew select _i
?random 1 > 0.8 && _unit != player: _unit setdammage (random 1)
?random 1 > 0.8 && _unit != player && _kills < _maxkills: _unit setdammage 1; _kills = _kills + 1
_i = _i + 1
?_i < _c: goto "crew"

Any help would be appreciated.
cheers

GI-YO
« Last Edit: 11 Jan 2005, 13:10:15 by GI-YO »

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Tailrotor script
« Reply #1 on: 11 Jan 2005, 13:19:42 »
I'm not a scripter so I'm not going to delve into the detail but the fundamental problem is that the  the local variable _random is being used twice, for two different things.    Once as a boolean and once for extracting an element of an array.

Plenty of reviewed ArmA missions for you to play

Offline RujiK

  • Members
  • *
  • KoKo Puh-Fizzles!
Re:Tailrotor script
« Reply #2 on: 11 Jan 2005, 19:30:51 »
One problem in your scripting is you have a global variable in your condition.

Instead of having _random = true change it too random1 = true (adding the one because random is a command.)

Then change the bottom condition and this should work.
However with this scripting running more than one of this script could cause bugs as their are conditions which are already defined.
I like your approach, lets see your departure.
Download the New Flashlight Script!

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:Tailrotor script
« Reply #3 on: 11 Jan 2005, 22:44:11 »
i know a better way, but I have no clue why they would put a check that will always turn up the same unless you edit the script

just delete that check, all it does is exits he script if the variable _random is false, but he is setting it to true in the script, so that seems utterly useless to me...

Offline johnnyboy

  • OFPEC Patron
  • ****
  • Matan los Pantalones!!!
Re:Tailrotor script
« Reply #4 on: 12 Jan 2005, 00:31:22 »
I use this script, and I believe there is nothing wrong with it.

The error message is very indicative of the problem "Type Number, expected Boolean".   When calling the script be sure you pass in a boolean for the _random parameter.   I'm guessing you are passing in a number for this parameter, instead of a boolean.

Or when calling the script, try it without the last two parameters, and the _random is defaulted to true.  I bet the script works then.

Good luck.

El Cojon: "Do you like to Tango?"
You: "Only in Bagango."
Download Last Tango in Bagango and discover how El Cojon earned his name...

GI-YO

  • Guest
Re:Tailrotor script
« Reply #5 on: 13 Jan 2005, 15:19:54 »
Right then cheers for the responses, I forgot about this post woops  ::) I'll have a play and see what works. Cheers.

GI-YO