Home   Help Search Login Register  

Author Topic: Strange bug (nOOb)  (Read 553 times)

0 Members and 1 Guest are viewing this topic.

PicVert

  • Guest
Strange bug (nOOb)
« on: 04 Aug 2003, 18:04:23 »
I have just put a line as usual like :

_weapon = _this select 1

and the game return an error like this :

'_weapon = _this select 1¦#¦': Error select : Type Object, expected Array


I don't see anything wrong ?? some one could help me the script is lauched by an Acction in CPP in the soldier class.

Offline Artak

  • The old beanbag shaker
  • Former Staff
  • ****
  • You want to talk about it, yes?
    • OFP Team Finlanders
Re:Strange bug (nOOb)
« Reply #1 on: 04 Aug 2003, 18:22:28 »
When you 'select' you select from an array. if you have a variable, object or what ever one piece thingy you can't 'select' it because there's nothing to select from. As for an array the case is opposite. An example

you want a script to select _weapon from an array you'll first have to define the array
m16 is not an array
[m16] is an array

if I'm reading you right you're executing a script or something? Passing info to the script when executing it must be done inside an array, so you could have

dude,m16 exec "myscript.sqs"
_myguy = _this select 0
_weapon = _this select 1
     That wouldn't work
[dude,m16] exec "myscript.sqs"
_myguy = _this select 0
_weapon = _this select 1
     Would work because the passed info is inside an array where the selection can be made  ;)
Not all is lost.

PicVert

  • Guest
Re:Strange bug (nOOb)
« Reply #2 on: 04 Aug 2003, 19:13:32 »
thank you. I'll be a little stronger than yesterday :P

your idea is nice but it seam to be spoted in mission editor... what I want is the script is lauched without editing :) But with your helpfull response I foud (maybe an other way to start it I would use the Fire eventhandler)

humm an other question can I add an action by script (sqs) to a soldier ? thank you.

Offline Artak

  • The old beanbag shaker
  • Former Staff
  • ****
  • You want to talk about it, yes?
    • OFP Team Finlanders
Re:Strange bug (nOOb)
« Reply #3 on: 04 Aug 2003, 19:44:36 »
You can.

actionid = unitname addaction ["drop m16","thescript.sqs"]

'drop m16' is what will read in the action menu and 'thescript.sqs' is the script the action will execute.
Not all is lost.

PicVert

  • Guest
Re:Strange bug (nOOb)
« Reply #4 on: 04 Aug 2003, 20:05:40 »
Thank you a lot for answers :)