OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Franksie86 on 14 Jun 2005, 15:34:50

Title: Higher Score for Higher Rank
Post by: Franksie86 on 14 Jun 2005, 15:34:50
Ok this is what I want to do...

I've made a sniper misson using the new Lib 1941 pack and I want to make the player's score higher according to what rank the officer was that he killed.

Eg. A Lieutenant - 100 points
      A Major - 300 points
     A colonel - 500 points etc.

How do i do this?
Title: Re:Higher Score for Higher Rank
Post by: Blanco on 15 Jun 2005, 00:22:57
There is no command that returns a unit rank, The only thing you can do is to name every enemyunit and put them in an array, like

_majors = [m1,m2,m3,m4]
_colonels = [c1,c2,c3,c4]
etc...

Then give each of them a killed EH and check the arrays :

Code: [Select]
_killer = _this select 0
_casualty = _this select 1

_killer = _casualty : exit
?_casualty in _majors : _killer addrating 300
?_casualty in _colonels : _killer addrating 500

exit

Not tested.
Title: Re:Higher Score for Higher Rank
Post by: UNN on 15 Jun 2005, 00:56:21
HateR_Kint came up with this method:

GetRank.sqf:

Code: [Select]
private ["_unit","_rank","_result"];

_Unit=_This Select 0;

_Rank=Rating _Unit;
_Result="PRIVATE";

If (_Rank>=7500) Then
   {
   _Result="COLONEL";
   }
   Else
   {
   If (_Rank>=5000) Then
      {
      _Result="MAJOR";
      }
      Else
      {
      If (_Rank>=3500) Then
         {
         _Result="CAPTAIN";
         }
         Else
         {
         If (_Rank>=2500) Then
            {
            _Result="LIEUTENANT";
            }
            Else
            {
            If (_Rank>=1500) Then
               {
               _Result="SERGEANT";
               }
               Else
               {
               If (_Rank>=500) Then
                  {
                  _Result="CORPORAL";
                  }
                  Else
                  {
                  If (_Rank>=0) Then
                     {
                     _Result="PRIVATE";
                     };
                  };
               };
            };
         };
      };
   };


_Result
Title: Re:Higher Score for Higher Rank
Post by: h- on 15 Jun 2005, 08:30:34
::)
Ah yes, that old bugger...

Of course, do note that it will give faulty rank if the unit has done some killing since the rating goes up with the kills performed...

Oh, and the usage would be:

init.sqs
Code: [Select]
getRank=preprocessFile "getRank.sqf"And in some trigger or in a script
Code: [Select]
[unit] call getRank
Title: Re:Higher Score for Higher Rank
Post by: Grendel on 16 Jun 2005, 01:49:27
Or you could combine Blanco and HateR_Kint's methods!

Use the .sqf to assign the units to an array either on init or as they are spawned.

That way, if their rating goes up it doesn't matter as they are already assigned a 'rank'.  

-Grendel
Title: Re:Higher Score for Higher Rank
Post by: UNN on 16 Jun 2005, 02:29:55
Quote
Of course, do note that it will give faulty rank if the unit has done some killing since the rating goes

I did not think that would be a problem? After all if you do take out an effective AI, you deserve a reward just for finding one :)
Title: Re:Higher Score for Higher Rank
Post by: Blanco on 16 Jun 2005, 04:46:27
Yeah...Only one thing I'm not sure about...
Will the unit still be in the array when it got killed?
Is the unit removed from array when it got killed?


 


 
Title: Re:Higher Score for Higher Rank
Post by: Dubieman on 17 Jun 2005, 04:36:04
Depending on how many officers are in your mission, why don't you just assign values to each of the ones that are going to be shot. Like have a trigger or something for each so when he dies the player recieves  x amount of points. And then when he kills a big wig he gets y amount of points via trigger/code. I don't see why you need the rank thing unless you have a lot of officers.  :P

edit: oh, by points I meant addrating... ::) :)
Title: Re:Higher Score for Higher Rank
Post by: qqqqqq on 18 Jun 2005, 01:41:24
How will the player be able to tell the rank of his target?   (If he can't tell, it's a bit pointless - the score will effectively be random as far as he is concerned.)

Also, this is OFP not an arcade game.   Does anybody actually care about score?   If they (or you) do, good for them, but be aware that a lot of people don't.
Title: Re:Higher Score for Higher Rank
Post by: Dubieman on 19 Jun 2005, 03:33:31
I agree with qqqqqq regaurding points in the end. I never pay attention to them much, I'm more concerned with my expierence in the mission and whether we succeeded or not.

My 2 cents....
Well 1 cent stolen from qqqqqq so
My 1 cent.

 ;)