OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started 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?
-
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 :
_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.
-
HateR_Kint came up with this method:
GetRank.sqf:
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
-
::)
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
getRank=preprocessFile "getRank.sqf"And in some trigger or in a script
[unit] call getRank
-
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
-
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 :)
-
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?
-
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... ::) :)
-
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.
-
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.
;)