Home   Help Search Login Register  

Author Topic: How to make a script to give me the result of a specific fight?  (Read 1805 times)

0 Members and 1 Guest are viewing this topic.

Offline Undeceived

  • Members
  • *
    • My missions and campaigns
How can I make a script to give me the result of only a second fight, not of all fights in advance?  ???

I hope, I can explain this better... :)


-> My group has a number of 7 guys in it + me as leader (total -> 8 men).

I want the script to give me the result of this very second fight. A trigger is to be activated if the group now has less than 8 guys (HQ will be notified: "We had losses in the second battle...").

But lets say that I did NOT loose anyone in this second fight, but I lost 2 men in another fight 30 minutes ago. So what will happen? The script will count the units in my group after the second fight and will see "Oh, there are less that 8 men in the group!" ---> "HQ... We had losses..." But in this case I did not have any loss in this battle, so the trigger should not have been activated.


Do you know what I mean? / Can you help?


THX!!
« Last Edit: 14 Apr 2008, 16:26:32 by Undeceived »
Current project: Black Lands (Arma 3)

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Do you know what I mean?

No, what second fight are you talking about, which criteria is available to discriminate between fight number n and fight number m? Area on the map? Time?

Offline paritybit

  • Members
  • *
You might try saving a global variable after every encounter which contains the number of men.  That way, you can see if there were losses during any particular encounter.

For example, at the start of the mission, save a variable called "TotalMenNumber" which contains the total number of men in your group (8, right?).  Then at the first radio check-in to report casualties, check if the total in the group is less than the "TotalMenNumber".  If it is -- let's assume there were two losses -- report the losses, and save the new number of men in your group into "TotalMenNumber"; now this variable contains the number 6.  Assume there are no losses during the next skirmish, so you still have 6 in your group.  When you go to report in, the number in your group (6) will match the "TotalMenNumber" variable and you will report no losses.

Does that makes sense?
Heroes don't die -- they just respawn.

Offline Undeceived

  • Members
  • *
    • My missions and campaigns
Does that makes sense?

Yes, that makes sense!! I think this is the solution.

Expressed in other words: If I save this variable of "TotalMenNumber" before certain skirmish, this will then be the measure to tell afterwards, if there were losses or not? Regardless if there were losses in advance (other fight) or not?


Can you help me to save this global variable? And how to check, if the number of men in my group matches "TotalMenNumber"? I have no idea how to make this...


Quote
No, what second fight are you talking about, which criteria is available to discriminate between fight number n and fight number m? Area on the map? Time?

Hi Mandoble

With "second fight" I meant that the situation is not at the beginning of the mission and it is likely that there were losses in advance.
I'm sorry for being unclear. I will try to explain it with the content of my mission:

At the beginning of the mission my group (total 8 members) has to clear a village. Lets say, that there I loose 2 of my men. So my group will consist of 6 persons. Now HQ gives me the next objective, to attack a camp of a enemy special unit. We attack, but as if by a miracle, no one of my group dies. Now I want to report the status of the group to HQ. Therefore I made scripts for two possibilities

1) If no one died -> "HQ, we had no losses clearing the camp!!!"
2) If someone died -> "HQ... We had losses clearing the camp..."

Now it is important to know how I wrote these scripts. In my helplessness I made it this way, when I was building up the mission some weeks ago:

1) group = 8 units -> "HQ, no losses!"                                   ---> 8, because at the beginning of the mission there were 8 men in the group.
2) number of units in group is smaller than 8 -> "HQ... Losses..."

Then I repared that for this script I never can take the number of units that are in the group at the beginning of the mission, because I don't know, how many of them will die before this fight.

Without this global variable, Paritybit talked about, there would be activated the report 2) "We had losses", even if the group had no losses clearing the camp.
Because of this I think that this variable should be the answer, because it "saves" the number of units in group before clearing the camp, if I understood it right.


« Last Edit: 14 Apr 2008, 19:46:01 by Undeceived »
Current project: Black Lands (Arma 3)

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Then all you need is to take the reference number when your HQ gives you the next objetive. This number is the number of alive group members at that time.
So your steps are:
1 - When HQ gives second objetive, get a global with current number of alive units:
Code: [Select]
reference = {alive _x} count units mygroup2 - When objetive 2 is completed:
Code: [Select]
if (({alive _x} count units mygroup) == reference) then
{
   player sideChat "HQ, we had no losses clearing the camp!!!";
}
else
{
   player sideChat "HQ... Losses...";
};

Offline paritybit

  • Members
  • *
Yeah, what he said.  :whistle:  Basically the same thing that I said, but with concrete code examples.
Heroes don't die -- they just respawn.

Offline Undeceived

  • Members
  • *
    • My missions and campaigns
Hi guys.

After some time without building on the mission I implemented the steps you gave me. And it worked fine!

Thank you very much, paritybit and Mando for this solution!
Hail to OFPEC Forums! :-)
Current project: Black Lands (Arma 3)