Home   Help Search Login Register  

Author Topic: What does....  (Read 940 times)

0 Members and 1 Guest are viewing this topic.

DaRkmAn

  • Guest
What does....
« on: 26 Oct 2002, 05:27:22 »
what does it mean when i see:

select 0
select 1
select 2.... i see its used in lots of scripts but i dont know what its used for.

Gameer_77

  • Guest
Re:What does....
« Reply #1 on: 26 Oct 2002, 13:12:19 »
To select a part of an array. Say you had an array like this:

Bobsarray= [man1,man2,man3]

If you were to do:

Bobsarray select 1

Then the result would be "man2"

So:

(Bobsarray select 1) setdammage 1

Would kill "man2".

Note: It goes from 0,1,2,3 NOT 1,2,3,4

 8)PEACE

DaRkmAn

  • Guest
Re:What does....
« Reply #2 on: 26 Oct 2002, 23:51:45 »
thanks, now i can start to use it.

The_Milky_Bar_Kid

  • Guest
Re:What does....
« Reply #3 on: 27 Oct 2002, 22:23:10 »
Okay, say you wanted to check a unit had a weapon in a script. To execute the script you would need an array like:

["M16",Bill] exec "Script.sqs"

The script start would look like this, if you wanted the weapon to be called _weapon and the unit name would be _unit for use in the script:

_weapon = _this select 0
_unit = _this select 1

#start
? (_unit hasWeapon _weapon): goto "end"
goto "start"

#end
_unit setdammage 1.0
exit


That script would check if the specified unit has the specified gun, if he does it will kill the unit if not then it will go back to the start.

Hope that helps.
« Last Edit: 27 Oct 2002, 22:24:42 by The_Milky_Bar_Kid »

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:What does....
« Reply #4 on: 27 Oct 2002, 22:37:05 »
@ Milky - in script like u do u wil get ur comp fucked up, it should b

Code: [Select]
_weapon = _this select 0
_unit = _this select 1

#start
? (_unit hasWeapon _weapon): goto "end"
~0.1 <-----important
goto "start"

#end
_unit setdammage 1.0
exit

u need da time delay or da comp wil give al his rescources 2 da loop

Quote
That script would check if the specified unit has the specified gun, if he does it will kill the unit if not then it will go back to the start.

i think u beter say it - That script would check if the specified unit has the specified gun,  if he does it will kill the unit if not then it will continue checking.  ;)  ;D

LCD OUT
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

The_Milky_Bar_Kid

  • Guest
Re:What does....
« Reply #5 on: 27 Oct 2002, 22:50:27 »
Doing that has never screwed up my comp.  Thanks for that anyways, I will bare that in mind.  Also, I'm sorry I didn't phrase it correctly.

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:What does....
« Reply #6 on: 27 Oct 2002, 23:50:05 »
doesnt realy matter ;) ;D

bout dat delay - try doin it wen da man dont have a M16 ;D

LCD OUT
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta