Home   Help Search Login Register  

Author Topic: Checking if unit in list has been injured?  (Read 5497 times)

0 Members and 1 Guest are viewing this topic.

Gameer_77

  • Guest
Re:Checking if unit in list has been injured?
« Reply #15 on: 07 Sep 2002, 17:58:55 »
The methods Bremmer and I are detailing need you to name each and every unit and add his name to the _unitname array.

Although I think you could make a trigger, and pass all the people on, then using the WEST command see if he is on the west side, if he is then add him to the array. Bremmer, any ideas as to how this could be executed?  :-\

 8)PEACE

Offline Messiah

  • Honourary OFPEC Patron & Drinking Buddy of Wolfsbane
  • Honoured Contributor
  • ***
  • OFPEC Veteran
    • Project UK Forces
Re:Checking if unit in list has been injured?
« Reply #16 on: 07 Sep 2002, 18:43:58 »
yes.... because i have something like 60 men on the battle field - not so good for arrays like that...
Proud Member of the Volunteer Commando Battalion

Bremmer

  • Guest
Re:Checking if unit in list has been injured?
« Reply #17 on: 07 Sep 2002, 19:44:38 »
The easiest method of getting your men into a list is using a west present trigger. Make its size big enough to cover all your men, leave the condition as this, and have on activation as [thislist] exec "injured.sqs".

In the script (injured.sqs) replace the line _unitarray= [sold1,sold2,sold3,sold4,sold5] with

_unitarray = _this select 0

everything else can be left exactly as written before, but you might want to add the lines

? (vehicle _unit != _unit) : goto "cycle"
? ("man" CountType [_unit] == 0) : goto "cycle"

directly after the line that selects the _unit (_unit = _unitarray select _tmp).
These check that the unit is actually a soldier on foot, and will stop your tanks crying out in pain when you shoot them  ;)

If your still having trouble I could make up a sample mission for you. Just let me know.

Good luck



Gameer_77

  • Guest
Re:Checking if unit in list has been injured?
« Reply #18 on: 07 Sep 2002, 20:56:36 »
So you only need to use a 'west present' trigger?  :-\

Ooh, did'nt realise it was that easy.  :)

Ah well...

 8)PEACE

Offline Messiah

  • Honourary OFPEC Patron & Drinking Buddy of Wolfsbane
  • Honoured Contributor
  • ***
  • OFPEC Veteran
    • Project UK Forces
Re:Checking if unit in list has been injured?
« Reply #19 on: 08 Sep 2002, 01:16:12 »
aaah, great stuff.... cheers.

:thumbsup:

p.s. i'll be back to solve it - dont worry - just gonna looksie a bit  ;)
Proud Member of the Volunteer Commando Battalion

Gameer_77

  • Guest
Re:Checking if unit in list has been injured?
« Reply #20 on: 08 Sep 2002, 14:30:48 »
So is that you almost done with your mission the Messiah?  :)

 8)PEACE

SEAL84

  • Guest
Re:Checking if unit in list has been injured?
« Reply #21 on: 09 Sep 2002, 00:09:50 »
I have a question for you guys...

I took this script here because I figured I could really use this thing for a little project of mine.  Now, once this script runs though, what's the setup for the next one?

We've determined who's activating the script, how do you pass that info on to make that guy now do something?  (this is different from Mezzy's idea...I now want the injured guys to be assigned into a dustoff chopper.)

Gameer_77

  • Guest
Re:Checking if unit in list has been injured?
« Reply #22 on: 09 Sep 2002, 00:23:51 »
? getdammage _unit > 0:[_unit] exec "somescript.sqs"; _hurt = _hurt + [_unit]


In the above bit of code taken from the script, change the [_unit] exec "somescript.sqs" to whatever you want. The injured unit is contained inside the _unit variable.

 8)PEACE

SEAL84

  • Guest
Re:Checking if unit in list has been injured?
« Reply #23 on: 09 Sep 2002, 00:30:22 »
Okay, I got that part...guess I worded it badly...

So if in the next script I want the injured guy to do something, I just need to call him _unit?

Offline Chris Death

  • Former Staff
  • ****
  • Finally Death's gonna get ya
    • OFPEC
Re:Checking if unit in list has been injured?
« Reply #24 on: 09 Sep 2002, 01:26:45 »
You have to handle the guy in the next script, like
you would do, if you would exec the script out of the
game.

*hint: _this or _this select 0*

~S~ CD
Dont argue with idiots....they will bring you down to their level and beat you there with experience.

How to use Waypoint type Scripted

Gameer_77

  • Guest
Re:Checking if unit in list has been injured?
« Reply #25 on: 09 Sep 2002, 11:25:10 »
Yeh, so basically, just put _unit= _this select 0 at the top, then use _unit.

 8)PEACE

Offline Messiah

  • Honourary OFPEC Patron & Drinking Buddy of Wolfsbane
  • Honoured Contributor
  • ***
  • OFPEC Veteran
    • Project UK Forces
Re:Checking if unit in list has been injured?
« Reply #26 on: 15 Sep 2002, 22:22:31 »
hmmmm

been working on the mission and just tried the script (been playing mafia)

well, this error pops up when some1 gets injured:

'_unit = _unitarray select _tmp |#|': Error Zero Divisor

any clues?
« Last Edit: 15 Sep 2002, 22:23:41 by Messiah »
Proud Member of the Volunteer Commando Battalion

Gameer_77

  • Guest
Re:Checking if unit in list has been injured?
« Reply #27 on: 15 Sep 2002, 22:29:45 »
Lol, yet another oversight. When one of the units is injured, it is removed from the array so the number in the variable _count is less than the value of _tmp. Make sense?  :-\

Because Bremmer made the script, i don't know if this would work, but try doing this:

In the line that says this:

? getdammage _unit > 0:[_unit] exec "somescript.sqs"; _hurt = _hurt + [_unit]

Add this onto the end:

_tmp= _tmp - 1

So it should look like this:

? getdammage _unit > 0:[_unit] exec "somescript.sqs"; _hurt = _hurt + [_unit];_tmp= _tmp - 1

I dunno if this'll work. You may also need to do the same at the bottom with the:

? getdammage _unit == 0: _hurt = _hurt - [_unit]

 :-\

 8)PEACE

Offline Messiah

  • Honourary OFPEC Patron & Drinking Buddy of Wolfsbane
  • Honoured Contributor
  • ***
  • OFPEC Veteran
    • Project UK Forces
Re:Checking if unit in list has been injured?
« Reply #28 on: 15 Sep 2002, 22:53:47 »
ok - that solved that - but.... i feel like im playing 'spot all ofp errors' game  ;)

heres a new error line - god i wish i knew what the damn thing meant....

Randomnum = random (_this select 0) |#|: type object, expected number

now, i think this is from this script below, so its my mistake but what?

Code: [Select]
Randomnum = random (_this select 0)
_pain = _this select 1


? Randomnum <1 : goto "say1"
? Randomnum <2 : goto "say2"
? Randomnum <3 : goto "say3"
? Randomnum <4 : goto "say4"
? Randomnum <5 : goto "say5"
? Randomnum <6 : goto "say6"
? Randomnum <7 : goto "say7"
? Randomnum <8 : goto "say8"

#say1

_pain say "eng22"

goto "exit"

#say2

_pain say "eng23"

goto "exit"

#say3

_pain say "eng29"

goto "exit"

#say4

_pain say "eng30"

goto "exit"

#say5

_pain say "eng31"

goto "exit"

#say6

_pain say "eng32"

goto "exit"

#say7

_pain say "eng33"

goto "exit"

#say8

_pain say "eng34"

goto "exit"

#exit

exit

cheers - oh and gammer - the mission is a while off yet - its actually gonna be a mini campaign (3 missions)
Proud Member of the Volunteer Commando Battalion

Offline Messiah

  • Honourary OFPEC Patron & Drinking Buddy of Wolfsbane
  • Honoured Contributor
  • ***
  • OFPEC Veteran
    • Project UK Forces
Re:Checking if unit in list has been injured?
« Reply #29 on: 15 Sep 2002, 23:00:10 »
ok - ive spotted the mistake here

now, thats the script that the other script activates, and i think i know the rpoblem....

let me check  ;)


------------------------------------------------------------

ok, checked - now there is no error now BUT i dont hear the man who gets injured say the editor sounds...

ummmm

is it because they are not loud enuff or is it my fault again?
Proud Member of the Volunteer Commando Battalion