HOME ADDONS DEPOT EDITORS DEPOT MISSIONS DEPOT INTELLIGENCE DEPOT RECRUITMENT DEPOT FORUM

WELCOME GUEST!
REGISTER
LOGIN
QUICK SEARCH
Advanced Search
EDITORS DEPOT HQ
LATEST & GREATEST
ONLINE REFERENCES
TUTORIALS
SCRIPTS
EDITING TOOLS
MOD EDITING



Function Library Find function:

All  A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z

      

GetBank
GetBankPitch
GetOut
GetPitch
GetPos2
GetRelPos
GridCoord
groupdamage
grpForeach
Guard
Guard2

GetBank by dschulle

Category: Positions and Distance

Syntax: Object call GetBank

Returns: Number

Example: _Bank = _plane call GetBank, result is _Bank equals the bank angle of _plane in degrees

Description:

This function will return the bank angle of a vehicle in degrees.

Note: the following scripts/functions are required in your mission directory:

  • Init.sqs (containing <array of objects> exec "initBankPitch.sqs")
  • InitBankPitch.sqs
  • GetBankPitch/_CalcSLDist.sqf
  • GetBankPitch/_dropcenter.sqs
  • GetBankPitch/_dropfront.sqs
  • GetBankPitch/_dropright.sqs
  • GetBankPitch/_GetBankPitch.sqf
  • GetBankPitch/_initVehicle.sqs
  • GetBankPitch/_TestPoints.sqf

    All of these scripts are located in the snippet link below.

    This function is for OFP version 1.90, and is of intermediate difficulty to implement.

    Snippet:

    Click here to download the script snippet that will allow you to use this function.


    GetBankPitch by dschulle

    Category: Objects and Groups

    Syntax: Object call GetBankPitch

    Returns: Array

    Example: _BankPitch = _plane call GetBankPitch, result is _BankPitch equals [<Bank> in °, <Pitch> in °]

    Description:

    This function will return the bank and pitch angles of a vehicle in degrees.

    Note: the following scripts/functions are required in your mission directory:

  • Init.sqs (containing <array of objects> exec "initBankPitch.sqs")
  • InitBankPitch.sqs
  • GetBankPitch/_CalcSLDist.sqf
  • GetBankPitch/_dropcenter.sqs
  • GetBankPitch/_dropfront.sqs
  • GetBankPitch/_dropright.sqs
  • GetBankPitch/_GetBankPitch.sqf
  • GetBankPitch/_initVehicle.sqs
  • GetBankPitch/_TestPoints.sqf

    All of these scripts are located in the snippet link below.

    This function is for OFP version 1.90, and is of intermediate difficulty to implement.

    Snippet:

    Click here to download the script snippet that will allow you to use this function.


    GetOut by snYpir

    Category: Objects and Groups

    Syntax: Object call GetOut

    Returns: Boolean

    Example: player call GetOut, result is player forced to eject from vehicle

    Description:

    Forces a single unit get out of whatever vehicle they are in.

    Returns false if unit is not in a vehicle (and hence was unable to get out).

    This function is for OFP version 1.90, and is very simple to implement.

    Initialisation:

    Download getout.sqf to your mission's dir, and place the following in your mission's init.sqs file:

    GetOut = preprocessFile "getout.sqf"

    Download:

    Download getout.sqf (0.953 kb - 437 downloads).

    Download an example mission (2.234 kb - 112 downloads).


    GetPitch by dschulle

    Category: Objects and Groups

    Syntax: Object call GetPitch

    Returns: Number

    Example: _Pitch = _plane call GetPitch, result is _Pitch equals the pitch angle of _plane in degrees

    Description:

    This function will return the pitch angle of a vehicle in degrees.

    Note: the following scripts/functions are required in your mission directory:

  • Init.sqs (containing <array of objects> exec "initBankPitch.sqs")
  • InitBankPitch.sqs
  • GetBankPitch/_CalcSLDist.sqf
  • GetBankPitch/_dropcenter.sqs
  • GetBankPitch/_dropfront.sqs
  • GetBankPitch/_dropright.sqs
  • GetBankPitch/_GetBankPitch.sqf
  • GetBankPitch/_initVehicle.sqs
  • GetBankPitch/_TestPoints.sqf

    All of these scripts are located in the snippet link below.

    This function is for OFP version 1.90, and is of intermediate difficulty to implement.

    Snippet:

    Click here to download the script snippet that will allow you to use this function.


    GetPos2 by toadlife

    Category: Positions and Distance

    Syntax: Object call GetPos2

    Returns: Array

    Example: _realposition = unit5 call GetPos2, result is _realposition = [3421.343,2123.431,75.321]

    Description:

    This function will return the position of an object, with the altitude being above sea level instead of the groud.

    Example:chopper1 call GetPos2

    Example Result:[3421.343,2123.431,342.321]

    2003-05-21 - Function no longer requires a pre-placed trigger to work

    This function is for OFP version 1.90, and is simple to implement.

    Initialisation:

    Download getpos2.sqf to your mission's dir, and place the following in your mission's init.sqs file:

    GetPos2 = preprocessFile "getpos2.sqf"

    Download:

    Download getpos2.sqf (0.94 kb - 231 downloads).

    Download an example mission (1.723 kb - 100 downloads).

    Liquid_Silence January 27, 2003, 02:44
    This would mean you wouldn't need a pre-placed trigger:

    private ["_object","_pos"];
    _object = _this select 0;
    if (format ["%1", toadlifes_all_purpose_trigger] == "scalar bool array string 0xfcffffef") then {toadlifes_all_purpose_trigger = "emptyDetector" camCreate [0,0,0];};
    toadlifes_all_purpose_trigger setpos (getpos _object);
    _pos = [getpos _object select 0, getpos _object select 1, (getpos _object select 2) + (_object distance toadlifes_all_purpose_trigger)];
    _pos

    toadlife January 27, 2003, 07:06
    The first thing I tried was creating the trigger using camcreate, but somtimes it would not work, and sometimes it would.

    Why it wouldn't work sometimes is beyond me, so I figured a pre-placed trigger was the best way to do it.

    I read that createvehicle works for creating triggers.

    PS: i didn't know a trigger was called "emptydetector". Perhaps thats why I had trouble.
    Liquid_Silence January 28, 2003, 00:35
    I've only done a little bit of testing, but it seems to work with camCreate...
    toadlife May 22, 2003, 10:44
    I finally fixed it so it doesn't require a pre-placed trigger.


    GetRelPos by Igor Drukov

    Category: Arrays

    Syntax: Object,Object call GetRelPos

    Returns: Array

    Example: [john,chopper] call GetRelPos, result is [-0.0018,5.23568]

    Description:

    This function returns the relative position of an object to another. The returned coordinates depend on the direction the first object is facing.
    In the example above, the chopper is 5.23568 meters ahead of john, and 0.0018 meter on his left.
    If john makes a 90° turn on the right, the function will return [-5.23568,-0.0018], because the chopper will now be 5.23568 meters on his left, and 0.0018 meter behind him.

    This function is for OFP version 1.90, and is simple to implement.

    Initialisation:

    Download getrelpos.sqf to your mission's dir, and place the following in your mission's init.sqs file:

    GetRelPos = preprocessFile "getrelpos.sqf"

    Download:

    Download getrelpos.sqf (0.695 kb - 190 downloads).


    GridCoord by uiox

    Category: Strings

    Syntax: Array call GridCoord

    Returns: String

    Example: [getpos player] call GridCoord, result is "Aa12"

    Description:

    Return the position with the format "Aa81"

    This function is for OFP version 1.90, and is very simple to implement.

    Initialisation:

    Download gridcoord.sqf to your mission's dir, and place the following in your mission's init.sqs file:

    GridCoord = preprocessFile "gridcoord.sqf"

    Download:

    Download gridcoord.sqf (0.846 kb - 320 downloads).

    benreeper March 06, 2003, 20:30
    I put this in
    _Position = [getPos _leader] call Gridcoord
    and I get an error in generic expression
    uiox March 07, 2003, 03:26
    _leader or leader? or leader g1 don't remember correct syntax
    benreeper March 17, 2003, 17:38
    The arguments are a 2D array, correct?
    I still get a "generic error in expression " in the _result.  Has anyone gotten this to work?

    Ben
    Tubal May 31, 2003, 18:53
    Yes, it works perfectly.
    I made a radio trigger that ran "player groupChat format ["%1", [getPos player] call Gridcoord]" and it printed the correct coordinates.
    It is NOT a 2D array, that would be pretty useless since you can just use getPos for that. Instead it returns a string with map coordinates, like Gd65.
    benreeper June 04, 2003, 01:37
    I had dl'd a broken version.  I got the fixed version and it works fine.

    Ben
    General Barron October 09, 2003, 03:11
    I think this d/l is broken. I can't get the whole thing!
    uiox October 14, 2003, 19:58
    I have updated a new one, if it doesn't worked yet, the code:


    private ["_result","_GrandeLettre","_PetiteLettre","_Chiffre", "_Chiffrestring","_Pos","_ArrayMajuscForGrid","_ArrayMinusForGrid " ];

    _ArrayMajuscForGrid = ["A","B","C","D","E","F","G","H","I","J"];
    _ArrayMinusForGrid = ["a","b","c","d","e","f","g","h","i","j"];

    _Pos = _This select 0;
    _Chiffrestring ="";
    _result = "";
    _GrandeLettre = (((_Pos select 0) - ((_Pos select 0) Mod 1280))/1280);                           
    _PetiteLettre =((((_Pos select 0) Mod 1280)- (((_Pos select 0) Mod 1280)Mod 128))/128); 
    _Chiffre = (99 - ((_Pos select 1) - ((_Pos select 1) Mod 128))/128);       
    _Chiffrestring = Format["%1",_Chiffre];
    If (_Chiffre < 10) then  {_Chiffrestring = "0" + _Chiffrestring };
    _result = ((_ArrayMajuscForGrid select _GrandeLettre) + ( _ArrayMinusForGrid select _PetiteLettre) +_Chiffrestring);

    _result


    groupdamage by badblood

    Category: Objects and Groups

    Syntax: Group Name call groupdamage

    Returns: Array

    Example: _GroupDamageArray = [GroupName] Call groupdamage, result is _GroupDamageArray = [The total group damage, the number of members in the group ]

    Description:

    Purpose:
    Return a group's OVERALL damage and the number of LIVE members in a group.

    NOTE: Dead members do not remain in groups in OFP
       
    EG: 5 members in the group all with 0.5 damage each returns --> [2.5,5]

    The number of members is returned so the function can also be used to calculate AVERAGE damage.

    This function is for OFP version 1.90, and is simple to implement.

    Initialisation:

    Download groupdamage.sqf to your mission's dir, and place the following in your mission's init.sqs file:

    groupdamage = preprocessFile "groupdamage.sqf"

    Download:

    Download groupdamage.sqf (1.652 kb - 60 downloads).


    grpForeach by mud_spike

    Category: Objects and Groups

    Syntax: [Group,String,Array] call grpForeach

    Returns: Any Value

    Example: [w_grp_0, "_x doFollow leader w_grp_0", ["_leader=0"]] call grpForeach

    Description:

    Foreach function replacement operating on groups, with extendable conditions/options.
    The cmdstring works just like the standard forEach function.
    Options are:
    "_alive=0|1" and "_leader=0|1"

    This function is for OFP version 1.90, and is simple to implement.

    Initialisation:

    Download grpforeach.sqf to your mission's dir, and place the following in your mission's init.sqs file:

    grpForeach = preprocessFile "grpforeach.sqf"

    Download:

    Download grpforeach.sqf (0.68 kb - 28 downloads).

    General Barron August 16, 2004, 10:47
    I'm kinda unclear on what this function does exactly... could you explain it to me? How is it different from the "forEach" command?
    Mud_Spike August 16, 2004, 10:59
    It's like the foreach command, but operates on groups instead of arrays (might be a lapse),
    and allows you to filter out units based on common conditions.
    It came in real handy when I was doing some Base-Patrol script with a bunch of groups.
    And the two most common conditions I needed to check for in my loops was if the unit was alive, and if it was the leader or not. So I made a function for it which I thought could come in handy for others as well. Of course you could do this with the regular foreach function aswell, so its necessity might  be somewhat limited. It is really just a helper that maybe shouldnt be here.
    General Barron August 16, 2004, 11:37
    Oh, I understand now.
    Quote:
    It is really just a helper that maybe shouldnt be here.

    Hardly. If you found it useful, then other people might find it useful as well. Many functions are simple "helpers", but if it makes a script easier to read/understand/create, then it is doing its job.


    Guard by GeneralCoder

    Category: Misc

    Syntax: [Array,Array,Number] call Guard

    Returns: Boolean

    Example: alarm = [guard_array,enemy_array,2] call guardfunc, result is alarm = true

    Description:

    If somebody in first array spots somebody in second array the return value is true
    the third parameter is how 'much' guard needs to know about its target to make the alarm (0-4)

    This is new version containing the old guard1 and guard2 in one file and guard2 works correctly now.

    This function is for OFP version 1.90, and is of intermediate difficulty to implement.

    Initialisation:

    Download guard.sqf to your mission's dir, and place the following in your mission's init.sqs file:

    Guard = preprocessFile "guard.sqf"

    Download:

    Download guard.sqf (0.881 kb - 297 downloads).

    Download an example mission (2.34 kb - 33 downloads).


    Guard2 by GeneralCoder

    Category: Misc

    Syntax: [Array,Number] call Guard2

    Returns: Boolean

    Example: alarm = [guard_array,2] call guardfunc2, result is alarm = true/false

    Description:

    Doesn't work! How can I delete this?

    This function is for OFP version 1.90, and is simple to implement.

    Initialisation:

    Download guard2.sqf to your mission's dir, and place the following in your mission's init.sqs file:

    Guard2 = preprocessFile "guard2.sqf"

    Download:

    Download guard2.sqf (0.66 kb - 169 downloads).

    LCD January 17, 2003, 01:36
    it doesnt exactly work

    it will work if 1 of da guards was near da guy who dies wen he dies - but if he wasnt and he c da body lil late it doesnt work

    sry m8


    GeneralCoder February 02, 2003, 21:50
    Yes, thats why u need to make a loop, and call the guard function from there.
    like:
    #loop
    alarm = call Guard1
    goto"loop"

    Or was the problem something else?
    Maatz May 30, 2003, 14:55
    cant u add an example mission?
    i don't know how to implement it!!!
    Thx

  • Home...


    Use this information at your own risk!

    This site is not affiliated in anyway with BI Studios or Codemasters

    ©Copyright 2001 www.ofpec.com. All Rights Reserved.

    Donate to OFPEC