addRating: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "<h3 style="display:none">Bottom Section</h3> " to "")
m (Some wiki formatting)
(28 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Command
{{RV|type=command


| ofp
|game1= ofp
|version1= 1.00


|1.00
|game2= ofpe
|version2= 1.00
 
|game3= arma1
|version3= 1.00
 
|game4= arma2
|version4= 1.00
 
|game5= arma2oa
|version5= 1.50
 
|game6= tkoh
|version6= 1.00
 
|game7= arma3
|version7= 0.50


|arg= local
|arg= local
Line 11: Line 28:
|gr1= Object Manipulation
|gr1= Object Manipulation


| Add a number to the [[rating]] of a unit - negative values can be used to reduce the rating.
|descr= Add a number to the [[rating]] of a unit - negative values can be used to reduce the rating.
<br>This command is usually used to reward for completed mission objectives. The rating is given at the end of the mission and is automatically adjusted when killing enemies or friendlies.  
<br>This command is usually used to reward for completed mission objectives. The rating is given at the end of the mission and is automatically adjusted when killing enemies or friendlies.  


Line 18: Line 35:
<br><br>See also: [[Arma_3:_Event_Handlers#HandleRating]]
<br><br>See also: [[Arma_3:_Event_Handlers#HandleRating]]


| unitName '''addRating''' rating
|s1= unitName [[addRating]] rating


|p1= unitName: [[Object]]
|p1= unitName: [[Object]]
Line 24: Line 41:
|p2= rating: [[Number]]
|p2= rating: [[Number]]


| [[Nothing]]
|r1= [[Nothing]]
 
|x1= <code>[[player]] [[addRating]] 2000;</code>


| [[Side relations]], [[ArmA: Rating Values|Rating Values]], [[rating]], [[rank]], [[setUnitRank]], [[sideEnemy]]
|x1= <sqf>player addRating 2000;</sqf>


|seealso= [[Side relations]] [[ArmA: Rating Values|Rating Values]] [[rating]] [[rank]] [[setUnitRank]] [[sideEnemy]]
}}
}}


{{Note
|user= Benargee
|timestamp= 20141116191100
|text= Since there is no '''setRating''' command, its expected behaviour can scripted as such:
<sqf>
BNRG_fnc_setRating = {
  params ["_wantedRating", "_unit"];
  private _currentRating = rating _unit;
  private _difference = _wantedRating - _currentRating;
  _unit addRating _difference;
};


[[Category:Scripting Commands|ADDRATING]]
[1000, player] call BNRG_fnc_setRating; // set player rating 1000
[[Category:Scripting Commands OFP 1.99|ADDRATING]]
</sqf>
[[Category:Scripting Commands OFP 1.96|ADDRATING]]
[[Category:Scripting Commands OFP 1.46|ADDRATING]]
{{GameCategory|arma1|Scripting Commands}}
{{GameCategory|arma2|Scripting Commands}}
{{GameCategory|arma3|Scripting Commands}}
{{GameCategory|tkoh|Scripting Commands}}
 
<!-- CONTINUE Notes -->
<dl class="command_description">
<dd class="notedate">Posted on November 16, 2014 - 19:11 (UTC)</dd>
<dt class="note">[[User:Benargee|Benargee]]</dt>
<dd class="note">
Since there is no '''setRating''' command, its expected behaviour can scripted as such:
<code>BNRG_fnc_setRating = {
  _setRating = _this select 0;
  _unit = _this select 1;
  _getRating = rating _unit;
  _addVal = _setRating - _getRating;
  _unit addRating _addVal;
};


[1000,player] call BNRG_fnc_setRating//set player rating 1000</code>
Using this example, no matter what the units rating was before, it will always set its rating to 1000.
Using this example, no matter what the units rating was before, it will always set its rating to 1000.
</dd>
}}
</dl>
<!-- DISCONTINUE Notes -->

Revision as of 15:13, 12 May 2022

Hover & click on the images for description

Description

Description:
Add a number to the rating of a unit - negative values can be used to reduce the rating.
This command is usually used to reward for completed mission objectives. The rating is given at the end of the mission and is automatically adjusted when killing enemies or friendlies.
When the rating gets below -2000, the unit's side switches to "ENEMY" (sideEnemy) and the unit is attacked by everyone.(see Rating Values)

See also: Arma_3:_Event_Handlers#HandleRating
Groups:
Object Manipulation

Syntax

Syntax:
unitName addRating rating
Parameters:
unitName: Object
rating: Number
Return Value:
Nothing

Examples

Example 1:
player addRating 2000;

Additional Information

See also:
Side relations Rating Values rating rank setUnitRank sideEnemy

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
Benargee - c
Posted on Nov 16, 2014 - 19:11 (UTC)
Since there is no setRating command, its expected behaviour can scripted as such:
BNRG_fnc_setRating = { params ["_wantedRating", "_unit"]; private _currentRating = rating _unit; private _difference = _wantedRating - _currentRating; _unit addRating _difference; }; [1000, player] call BNRG_fnc_setRating; // set player rating 1000
Using this example, no matter what the units rating was before, it will always set its rating to 1000.