Home   Help Search Login Register  

Author Topic: Groups detecting bodies  (Read 2259 times)

0 Members and 1 Guest are viewing this topic.

Offline Gruntage

  • Missions Depot
  • Administrator
  • *****
  • How do I get outta this chickensh*t outfit?
Groups detecting bodies
« on: 25 Jan 2012, 13:10:41 »
Ello folks

Been having some problems trying to have groups from an array detect any bodies not hidden by the player. I've been using a script like this:

Code: [Select]
_DetectdistMan = 15
_DetectdistTank = 25

@ (not (alive eg4leader)) and (not (alive eg4sub1))

@ ( (leader hgrp2 distance eg4leader) < _DetectdistMan) or ((leader hgrp1 distance eg4leader) < _Detectdistman)

if ((getpos eg4leader select 2) < -0.1) then {exit}

~5

{_x setbehaviour "COMBAT"} foreach units hgrp2
{_x setbehaviour "COMBAT"} foreach units hgrp1


;[true] exec "alarmrisen.sqs"

exit

It's a slight variation of snypir's isbodyhidden script. The only problem is that this script is used for individual units, rather than whole groups. That means that I have to make conditions for each member within a group, which is simply impossible in some cases (like for when a group is created randomly)

So what I need is a script that allows groups from an array (I have one set up already) to detect non-hidden bodies from groups within the same array (I imagine I'll need two).

I've tried searching around but the results that come up are for the script that I already have.

Any ideas?

Thanks in advance

Gruntage
"But one thing I can tell you from not just OFP but life in general:  criticism is directly proportional to quality. The more criticism a mission receives, the better the outcome" - macguba

Re: Groups detecting bodies
« Reply #1 on: 25 Jan 2012, 15:45:06 »
Hey pal!
   Not sure about what you want to achieve but, if you just want a script that makes any member of a group to detect unhidden corpses of any other member who belongs to same group, then you can take a look at attachment!
   You may want to comfortably execute same script, in your init.sqs file, multiple times for any group you want (e.g. group1, group2, group3, group4 etc.) by bearing in mind that any unit who belong to certain group can detect only dead bodies who belong to that group. Is that what you were looking for or you were looking for unit from a group to detect dead bodies from other group?
? (this == thinkable) : this = scriptable

Offline Gruntage

  • Missions Depot
  • Administrator
  • *****
  • How do I get outta this chickensh*t outfit?
Re: Groups detecting bodies
« Reply #2 on: 25 Jan 2012, 16:00:11 »
That's precisely what I'm looking for. Any unit from any group, detecting any unit from any other group. That's pretty much what I need.

I've come up with a temporary solution but it's far from perfect. It means having to use a lot of 'if's, and a lot of '(not(alive unitname)'s.

I'll have a look at that attachment soon.

Thanks for the response

Gruntage
"But one thing I can tell you from not just OFP but life in general:  criticism is directly proportional to quality. The more criticism a mission receives, the better the outcome" - macguba

Re: Groups detecting bodies
« Reply #3 on: 25 Jan 2012, 18:30:40 »
Quote
That's precisely what I'm looking for. Any unit from any group, detecting any unit from any other group. That's pretty much what I need.
What about using nearestObject command? Assuming we are talking about groups which belong to same side (e.g. Russian), you may want to write "detect_body.sqs" script like this:

Code: [Select]
_deadBody = _this
_aliveUnit = nearestObject [_deadBody, "SoldierEB"]

@not bodyFound
@not (alive _deadBody)
@_aliveUnit distance _deadBody < 15
? getpos _deadBody select 2 < -0.1 : exit
~3
? not (alive _aliveUnit) : exit
bodyFound = true
titleText ["BODY FOUND!", "plain down"]
exit

You exec this script by making a trigger as large as you want and activated by russians and by putting the following line in the init field:

Code: [Select]
{_x exec "detect_body.sqs"} forEach thisList
This script checks if any alive unit, who belongs to same side and is nearby dead body, can raise alarm when detecting dead body. Player is given 3 seconds to kill alive unit before it raises alarm and, once alive unit finds dead body (and alarm is raised), "bodyFound" condition will switch "true" and it prevents any other alive units to raise alarm when seeing any other dead body.

The only negative note is that this trick works only for standard soldiers (the one who refers to "SoldierEB" class if you understand what i mean...). You can work around this limit by replacing standard weapon with SVD, PK etc. instead of putting russian sniper unit, russian machine gunner unit etc.

I put new attachment with a group of russian soldier coming to church (we call it Alpha group). If you kill soldiers who patrols the church before the Alpha group get closer to them, Alpha group will detect any dead body it can find. And of course you can make Bravo group running to church and detecting dead body as well as Charlie, Delta, Echo etc. groups; if you want also to make Alpha, Bravo, Charlie, Delta etc. group members detectable when they become dead bodies, you just need to increase the trigger's size!

If we talk about NATO groups, just change "SoldierEB" in "SoldierWB".
If we talk about RESISTANCE groups just change "SoldierEB" in "SoldierGB".

I hope now this is what you were looking for, pal! ;)
« Last Edit: 25 Jan 2012, 21:20:49 by Doktor Headshot »
? (this == thinkable) : this = scriptable

Offline Gruntage

  • Missions Depot
  • Administrator
  • *****
  • How do I get outta this chickensh*t outfit?
Re: Groups detecting bodies
« Reply #4 on: 25 Jan 2012, 22:45:05 »
Thanks a lot for the test mission Doktor  :D

I have come up with a temporary solution, which so far seems fairly reliable and effective. If this solution proves to be ineffective (like groups not detecting bodies whilst detecting others) then I will consider implementing your solution into my mission. I suppose this problem has been solved (to a degree  :D).

Thanks again  :)

Gruntage
"But one thing I can tell you from not just OFP but life in general:  criticism is directly proportional to quality. The more criticism a mission receives, the better the outcome" - macguba

Re: Groups detecting bodies
« Reply #5 on: 25 Jan 2012, 23:02:07 »
You're welcome, buddy! :D
? (this == thinkable) : this = scriptable

Offline Aldo15

  • OFP-addict
  • Former Staff
  • ****
    • My OFP missions
Re: Groups detecting bodies
« Reply #6 on: 26 Jan 2012, 02:23:57 »
but 'SoldierEB' is a basic soldier. My question: How to make it, with differents units, For examplew with, MG oldiers, AAsoldiers RPG-LAW Soldiers, but all them in same mission.
My OFP stuff
FMF Project by Aldo15. Coming soon.
If in the high school or university, Teachers add a new subject about how to make scripts, missions, for ofp. I'd be number one of my classroom

Re: Groups detecting bodies
« Reply #7 on: 26 Jan 2012, 09:42:12 »
Hey Aldo15!
   If you accept the limit that this script works only with all groups you want but only on condition that they must be made of SAME KIND of soldiers, then you can make it applicable for every kind of units you want (for all officers, for all snipers, for all pilots, for all machine gunners etc.). To do this you just need to replace only "SoldierEB" in script with any of following:

  • SoldierEMedic = Medic unit
  • SoldierECrew = Crew unit
  • SoldierEPilot = Pilot unit
  • SoldierEMG = Machine gunner unit
  • SoldierELAW = LAW/RPG unit
  • SoldierEAT = AT unit
  • SoldierEAA = AA unit
  • OfficerE = Officer unit
  • SoldierESniper = Sniper unit
  • SoldierESaboteur = Spetznatz

   These are all Russian units; to make them American units just change "SoldierE" part to "SoldierW" or to make them Resistance units just change "SoldierE" to"SoldierG".
   If you can't find here the unit you are looking for (eg. Spetznatz, Hunter etc.), then you can find them in OFP CfgVehicles and scroll down a bit or, if they came from unofficial addons you have to look at their own "config.cpp" file. I put here only units that are shared among the three sides.
« Last Edit: 26 Jan 2012, 09:46:10 by Doktor Headshot »
? (this == thinkable) : this = scriptable

Offline Aldo15

  • OFP-addict
  • Former Staff
  • ****
    • My OFP missions
Re: Groups detecting bodies
« Reply #8 on: 26 Jan 2012, 18:01:34 »
I know that, but what I want to say is: How to add all those units in the same script.
Thanks
My OFP stuff
FMF Project by Aldo15. Coming soon.
If in the high school or university, Teachers add a new subject about how to make scripts, missions, for ofp. I'd be number one of my classroom

Offline Gruntage

  • Missions Depot
  • Administrator
  • *****
  • How do I get outta this chickensh*t outfit?
Re: Groups detecting bodies
« Reply #9 on: 26 Jan 2012, 18:07:25 »
Quote
How to add all those units in the same script.

I was wondering that myself. I came to the conclusion that the best way to do so would be to cover all possible unit types (that are used within a mission) within one script (one section per unit type for example)

Another method would be to set up multiple scripts that give your basic soldier specific weapons. For example, you could make a script that equips a standard soldier with an MG. The result is that the unit type is still a 'SoldierE' (for example), but he would have the same gear as a 'SoldierEMG'.

In either case, a lot of work is required. Unless I'm missing something  :P
"But one thing I can tell you from not just OFP but life in general:  criticism is directly proportional to quality. The more criticism a mission receives, the better the outcome" - macguba

Offline Aldo15

  • OFP-addict
  • Former Staff
  • ****
    • My OFP missions
Re: Groups detecting bodies
« Reply #10 on: 26 Jan 2012, 18:14:25 »
Off course, but I think we will need much script, for each unit from west and east
My OFP stuff
FMF Project by Aldo15. Coming soon.
If in the high school or university, Teachers add a new subject about how to make scripts, missions, for ofp. I'd be number one of my classroom

Re: Groups detecting bodies
« Reply #11 on: 26 Jan 2012, 18:16:18 »
Another method would be to set up multiple scripts that give your basic soldier specific weapons. For example, you could make a script that equips a standard soldier with an MG. The result is that the unit type is still a 'SoldierE' (for example), but he would have the same gear as a 'SoldierEMG'.

Yes, this is the work-around I suggested before :good:
? (this == thinkable) : this = scriptable