Home   Help Search Login Register  

Author Topic: Script error  (Read 702 times)

0 Members and 1 Guest are viewing this topic.

Offline greg147

  • Contributing Member
  • **
    • Royal Air Assault Battalion
Script error
« on: 28 Jul 2005, 10:44:51 »
Hi all,

I've got this script I'm using to attach sandbags to the side of a tank, and keep them there, but i'm getting an error.

Code: [Select]
'_armor8 = "MAP_Sandbag_W22NFG" createvehicle [_x,(_y + 8), 0]|#|' Error Type Array, Expected Number
Heres the part of the script affected:

Code: [Select]
_tank = _this select 0
_type = _this select 1
_tankpos = getpos _tank
_x = _tankpos select 0
_y = _tankpos select 1
_armor1 = "MAP_Sandbag_W22NFG" createvehicle [_x,(_y + 1),0]
_armor2 = "MAP_Sandbag_W22NFG" createvehicle [_x,(_y + 2),0]
_armor3 = "MAP_Sandbag_W22NFG" createvehicle [_x,(_y + 3),0]
_armor4 = "MAP_Sandbag_W22NFG" createvehicle [_x,(_y + 4),0]
_armor5 = "MAP_Sandbag_W22NFG" createvehicle [_x,(_y + 5),0]
_armor6 = "MAP_Sandbag_W22NFG" createvehicle [_x,(_y + 6),0]
_armor7 = "MAP_Sandbag_W22NFG" createvehicle [_x,(_y + 7),0]
_armor8 = "MAP_Sandbag_W22NFG" createvehicle [_x,(_y + 8),0]

"MAP_Sandbag_W22NFG" is the sandbag i'm using.

Anyway, anyone know where i've gone wrong? The script works fine, its just the error is there  :P

Thanks  ;)
Royal Air Assault Battalion - [L/Cpl] Greg
RAAB

Offline 456820

  • Contributing Member
  • **
Re:Script error
« Reply #1 on: 28 Jul 2005, 10:52:34 »
hang on since you dont need to name it could you just create it
like this
Code: [Select]
_tank = _this select 0
_type = _this select 1
_tankpos = getpos _tank
_x = _tankpos select 0
_y = _tankpos select 1
"MAP_Sandbag_W22NFG" createvehicle [_x,(_y + 1),0]
"MAP_Sandbag_W22NFG" createvehicle [_x,(_y + 2),0]
"MAP_Sandbag_W22NFG" createvehicle [_x,(_y + 3),0]
"MAP_Sandbag_W22NFG" createvehicle [_x,(_y + 4),0]
"MAP_Sandbag_W22NFG" createvehicle [_x,(_y + 5),0]
"MAP_Sandbag_W22NFG" createvehicle [_x,(_y + 6),0]
"MAP_Sandbag_W22NFG" createvehicle [_x,(_y + 7),0]
"MAP_Sandbag_W22NFG" createvehicle [_x,(_y + 8),0]

ijust thought of that it fixed my problem with cam creating things but my error was slightly different

Offline greg147

  • Contributing Member
  • **
    • Royal Air Assault Battalion
Re:Script error
« Reply #2 on: 28 Jul 2005, 11:04:35 »
I think I need the names, because later on in the script, there this:

Code: [Select]
_armor1 setpos [_posx + (sin(_dir-(_ang1))*((_hyp1)^(0.5))),_posy + (cos(_dir-(_ang1))*((_hyp1)^(0.5))),_posz+1]
_armor1 setdir _dir
_armor2 setpos [_posx + (sin(_dir-(_ang2))*((_hyp2)^(0.5))),_posy + (cos(_dir-(_ang2))*((_hyp2)^(0.5))),_posz+1]
_armor2 setdir _dir
_armor3 setpos [_posx + (sin(_dir-(_ang3))*((_hyp3)^(0.5))),_posy + (cos(_dir-(_ang3))*((_hyp3)^(0.5))),_posz+1]
_armor3 setdir _dir
_armor4 setpos [_posx + (sin(_dir-(_ang4))*((_hyp4)^(0.5))),_posy + (cos(_dir-(_ang4))*((_hyp4)^(0.5))),_posz+1]
_armor4 setdir (_dir+90)
_armor5 setpos [_posx + (sin(_dir+(_ang4))*((_hyp4)^(0.5))),_posy + (cos(_dir+(_ang4))*((_hyp4)^(0.5))),_posz+1]
_armor5 setdir (_dir+90)
_armor6 setpos [_posx + (sin(_dir+(_ang3))*((_hyp3)^(0.5))),_posy + (cos(_dir+(_ang3))*((_hyp3)^(0.5))),_posz+1]
_armor6 setdir _dir
_armor7 setpos [_posx + (sin(_dir+(_ang2))*((_hyp2)^(0.5))),_posy + (cos(_dir+(_ang2))*((_hyp2)^(0.5))),_posz+1]
_armor7 setdir _dir
_armor8 setpos [_posx + (sin(_dir+(_ang1))*((_hyp1)^(0.5))),_posy + (cos(_dir+(_ang1))*((_hyp1)^(0.5))),_posz+1]
_armor8 setdir _dir

But i'm not sure.  :P
Royal Air Assault Battalion - [L/Cpl] Greg
RAAB

Offline 456820

  • Contributing Member
  • **
Re:Script error
« Reply #3 on: 28 Jul 2005, 12:44:32 »
well then yes you need names

Offline Artak

  • The old beanbag shaker
  • Former Staff
  • ****
  • You want to talk about it, yes?
    • OFP Team Finlanders
Re:Script error
« Reply #4 on: 28 Jul 2005, 14:18:21 »
Here's a similar script found from OFPTF.net. Maybe you'd want to have a look at it.
http://www.ofptf.net/fullitem.php?id=2&titlecat=edit&tsufx=editing

Anyway, I don't seen anything wrong with the syntax in that line. How about try changing
_armor8 = "MAP_Sandbag_W22NFG" createvehicle [_x,(_y + 8),0]
to
_armor8 = "MAP_Sandbag_W22NFG" createvehicle [getpos _tank select 0,(getpos _tank select 1) + 8,0]
or to
_armor8 = "MAP_Sandbag_W22NFG" createvehicle [_x,(_y) + 8,0]

Don't ask me why but the last one seems the most probable solution.  ???

Not all is lost.

Offline greg147

  • Contributing Member
  • **
    • Royal Air Assault Battalion
Re:Script error
« Reply #5 on: 28 Jul 2005, 15:41:55 »
Thanks, i'll try that

Here's a similar script found from OFPTF.net. Maybe you'd want to have a look at it.
http://www.ofptf.net/fullitem.php?id=2&titlecat=edit&tsufx=editing

Its more than simular, its the same.  ;)
I downloaded Sentinals one, and changed it so it used more realistic looking sandbags, and changed the positons so they actually touch the tank.
Royal Air Assault Battalion - [L/Cpl] Greg
RAAB