Difference between revisions of "ScriptCore3.obj2weap"

From Soldat Community Wiki
Jump to: navigation, search
 
(3 intermediate revisions by the same user not shown)
Line 4: Line 4:
  
 
==Description==
 
==Description==
Translates the position of the weapon in the Style property of a Map Object([[TMapObject.Style]]) to the corresponding position of WType property of a Weapon Object([[TWeapon.WType]]).
+
Translates the position of the weapon in the Style property of a Map Object - lying weapon ([[TMapObject.Style]]) to the corresponding position of the WType property of a Weapon Object - weapon in player's hands ([[TWeapon.WType]]).
  
 +
==Examples==
 +
<source lang="pascal">
 +
begin
 +
    WriteLn('obj2weap: '+inttostr(obj2weap(5))); //1
 +
    WriteLn('obj2weap: '+inttostr(obj2weap(26))); //13
 +
    WriteLn('obj2weap: '+inttostr(obj2weap(27))); //Exception: Invalid object style (There's a reason why it's called Stationary Gun)
 +
end.
 +
</source>
  
 
[[Category:Functions]]
 
[[Category:Functions]]

Latest revision as of 17:21, 1 May 2018

function obj2weap(Style: Byte): Byte
 Style: Position(Style) of the weapon in the TMapObject.Style
 Result: Position(Style) of the weapon in the TWeapon.WType

Description

Translates the position of the weapon in the Style property of a Map Object - lying weapon (TMapObject.Style) to the corresponding position of the WType property of a Weapon Object - weapon in player's hands (TWeapon.WType).

Examples

begin
    WriteLn('obj2weap: '+inttostr(obj2weap(5))); //1
    WriteLn('obj2weap: '+inttostr(obj2weap(26))); //13
    WriteLn('obj2weap: '+inttostr(obj2weap(27))); //Exception: Invalid object style (There's a reason why it's called Stationary Gun)
end.