Announcement

Collapse
No announcement yet.

Python's Scripts of Pure Evil

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Python's Scripts of Pure Evil

    So far I've got two scripts in the works. One punishes players for leaving vehicles undefended and the other allows the AI to hear players talking with ACRE and responds to it. These scripts are a current work in progress. Right now, I have tested the AI Hearing script on Utes with two people including myself on a client-side server and it has worked. The Vehicle Sabotage script has proven troublesome. I need to do a lot more debugging on it, but so far, the script runs once on a client server and then continues running through it, but does not produce results. I have a feeling it is not resetting a variable somewhere down the line. Issue is, that it has worked in the editor for multiple successful run-through's.

    Keep the Keys (KeepTheKeys.sqf, Vehicle Sabotage)
    Code:
    /*
    Keep the Keys script by Blackpython of TacticalGamer.com
    ##############
    Execution Line:
    nul=[_veh,_range,_side,_prob,_time]execVM "KeepTheKeys.sqf";
    _VEH is the vehicle you want the script to watch. Assign "this" if the script is applied on a vehicle.
    _RANGE is the distance from the vehicle that the assigned side can be before the script performs its mischief. Default 50m
    _SIDE is the side that you want to be able to defend the vehicle. Default: West (BLUFOR)
    _PROB is the chance of an action occuring. A number from 0 to 1. Defualt: .25 (25%)
    _TIME is the time between each instance of the script running. Defualt: 300 Seconds (5 Minutes)
    #############
    */
    
    
    private ["_dis","_veh","_range","_prob","_time","_distArray","_TFArray","_desert","_chance","_ranNum","_num2","_fuelTotal","_fuel","_caseTire","_vehPos","_ied","_iedDir","_side"];
    
    
    _veh = _this select 0;
    _range = if (count _this > 1)  then {_this select 1} else {50};
    _side = if (count _this > 2) then {_this select 2} else {west};
    _prob = if (count _this > 3)  then {_this select 3} else {.25};
    _time = if (count _this > 4)  then {_this select 4} else {300};
    _distArray = [];
    _TFArray = [];
    
    while {true} do
    {
        if (!isServer) exitWith {};
        sleep _time;
        {if (side _x == _side) then {_dis = _x distance _veh}; _distArray = _distArray + [_dis];} forEach allUnits;
        {if (_x > _range) then {_TFArray = _TFArray + [0]} else {_TFArray = _TFArray + [1]};} forEach _distArray;
        if (!(1 in _TFArray)) then {_desert = true} else {_desert = false};
        _ranNum = random 1;
        if (_ranNum <= _prob) then {_chance = true} else {_chance = false};
        if (_desert && _chance) then 
        {
            _num2 = floor(random 3);
            switch (_num2) do
            {
                case 0: //Fuel Alteration Result
                {
                    _fuelTotal = fuel _veh;
                    if (_fuelTotal >= .1) then
                    {
                        _fuel = (_fuelTotal * .20);
                        _veh setFuel _fuel;
                    };
                };
                case 1: //Flat Tire Result
                {
                    _caseTire = floor(random 4);
                    switch (_caseTire) do
                    {
                        case 0:
                        {
                            _veh setHit ["wheel_1_1_steering", .9];
                        };
                        case 1:
                        {
                            _veh setHit ["wheel_1_2_steering", .9];
                        };
                        case 2:
                        {
                            _veh setHit ["wheel_2_1_steering", .9];
                        };
                        case 3:
                        {
                            _veh setHit ["wheel_2_2_steering", .9];
                        };
                    };
                };
                case 2: //IED result
                {
                    _vehPos = getpos _veh;
                    _iedDir = random 360;
                    _ied = "Land_IED_v1_PMC" createVehicle _vehPos;
                    _ied setVariable ["direction", _iedDir]; // Set tripwire direction
                    _ied setVariable ["length", 3]; // Set tripwire length
                };            
    	};
            _distArray = [];
            _TFArray = [];
        };
    };
    I Hear You! (IHearYou.sqf, AI ACRE Hearing)
    Code:
    //IHearYou.sqf
    //Requires CBA
    //[-1, {nul=[*radius*,*hostile side*]execVM "IHearYou.sqf";}] call CBA_fnc_globalExecute;
    private ["_AIAry","_ret","_rad","_wpNew","_side"];
    _rad = _this select 0;
    _side = _this select 1;
    _AIAry = [];
    while {true} do
    {
        {if ((_x != player) && (side _x == _side)) then {_AIAry = _AIAry + [_x]}} forEach allUnits;
        {if (_x in _AIAry) then {_AIAry = _AIAry - [_x]}} forEach allDead;
        {
            if ((_x distance player) <= _rad) then 
            {
                {if (_x != player) then {_AIAry = _AIAry + [_x]}} forEach allUnits;        
                {if (_x in _AIAry) then {_AIAry = _AIAry - [_x]}} forEach allDead;        
                _ret = [player] call acre_api_fnc_isSpeaking;
                if (_ret) then
                {
                    _x setBehaviour "AWARE";
                    _wpNew = (group _x) addWaypoint [position player, 0];
                    _wpNew setWaypointType "MOVE";
                    (group _x) setCurrentWaypoint _wpNew;
                }
            }
        }  forEach _AIAry;
        sleep 0.1;
    }
    Each of these scripts are copyrighted under the Create Commons Copyright. See following for details.


    Python's Evil Scripts by Casey Brownell, aka Blackpython is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
    Blackpython / ZephyrDark
    Former 31st RECCE Member


  • #2
    Re: Python's Scripts of Pure Evil

    Mother of god. If the AI can hear us that would be an entirely new element to consider in some of our spec ops missions. I really like the vehicle one too. Would go great with missions like domi and others. Great work! Can't wait to play around with these.

    [unit][squadl][command2]

    KnyghtMare ~You could always tell the person holding the gun to your head you would like to play on a different server...

    Comment


    • #3
      Re: Python's Scripts of Pure Evil

      I love this. Well done Python.

      Current ARMA Development Project: No Current Project

      "An infantryman needs a leader to be the standard against which he can judge all soldiers."

      Friend of |TG| Chief

      Comment


      • #4
        Re: Python's Scripts of Pure Evil

        They're still a very work in progress. So if you do use them, they may not work as intended. I need to get some dedicated server testing done, as well as some refinement of the scripts/
        Blackpython / ZephyrDark
        Former 31st RECCE Member

        Comment


        • #5
          Re: Python's Scripts of Pure Evil

          nice work!

          Comment


          • #6
            Re: Python's Scripts of Pure Evil

            When I'm on i can run a dedicated server and play at the same time so it would be easier to test and I can do any script modifications needed and run it w/o having to deal with up/down loading a pbo



            Fate whispers to the warrior "You will not survive the storm."
            The warrior whispers back, "I AM the storm."

            Comment


            • #7
              Re: Python's Scripts of Pure Evil

              I'm loving the "I hear you" script. Has it been tested yet?

              Would love to use it in the upcoming mission in the pipeline.

              TGU Instructor TG Pathfinder

              Former TGU Dean Former ARMA Admin Former Irregulars Officer

              "Do not seek death. Death will find you. But seek the road which makes death a fulfillment." - Dag Hammarskjold

              Comment


              • #8
                Re: Python's Scripts of Pure Evil

                Okay! So a few questions from me.


                1. Do they only detect the beginning of PTT, i.e. when you press the button down? If so, would you be able to 'get around' them hearing if pressed before entering the radius of hearing, and be able to talk right up to them without them knowing?
                2. Do they detect radio PTT?
                3. Can you use it to lure enemies around, MGS/Splinter Cell style? "What was that noise?"

                Pepper

                "If you find yourself in a fair fight, you didn't plan your mission properly." David Hackworth

                Comment


                • #9
                  Re: Python's Scripts of Pure Evil

                  I haven't thoroughly tested every little detail, personally, I'll leave that up to the mission makers. Since I did not write the API I can't edit the way it works exactly. Also, it checks if a player "is speaking" which I'm guessing just means using teamspeak out-right. Also, these scripts I believe I have edited a bit since I posted this. Done some more testing and bug-fixing. I still need to test these on a dedicated server once I get the chance.
                  Blackpython / ZephyrDark
                  Former 31st RECCE Member

                  Comment


                  • #10
                    Re: Python's Scripts of Pure Evil

                    Dear lord, I hope the IHearYou script gets implemented in the server.
                    Really good job man.
                    "War is not about what's right, It's about what's left"
                    "There is no flag large enough to cover the shame of killing Innocent people"
                    "If we don't end war, War will end us"

                    Comment


                    • #11
                      Re: Python's Scripts of Pure Evil

                      Just let us know when you are ready to test them.

                      TGU Instructor TG Pathfinder

                      Former TGU Dean Former ARMA Admin Former Irregulars Officer

                      "Do not seek death. Death will find you. But seek the road which makes death a fulfillment." - Dag Hammarskjold

                      Comment


                      • #12
                        Re: Python's Scripts of Pure Evil

                        Originally posted by Athanasa View Post
                        3. Can you use it to lure enemies around, MGS/Splinter Cell style? "What was that noise?"
                        Legend!
                        Want now!


                        [Spartan 9]

                        Comment


                        • #13
                          Re: Python's Scripts of Pure Evil

                          Originally posted by Balfa View Post
                          Legend!
                          Want now!
                          Should we run around in ammo boxes too?

                          Pepper

                          "If you find yourself in a fair fight, you didn't plan your mission properly." David Hackworth

                          Comment


                          • #14
                            Re: Python's Scripts of Pure Evil

                            Newest Versions of the Scripts:
                            Tested Local
                            Tested Client Server
                            Tested Dedicated Server

                            KeepTheKeys.sqf
                            Code:
                            /*
                            Keep the Keys script by Blackpython of TacticalGamer.com
                            ##############
                            Execution Line:
                            nul=[_veh,_range,_side,_prob,_time]execVM "KeepTheKeys.sqf";
                            _VEH is the vehicle you want the script to watch. Assign "this" if the script is applied on a vehicle.
                            _RANGE is the distance from the vehicle that the assigned side can be before the script performs its mischief. Default 50m
                            _SIDE is the side that you want to be able to defend the vehicle. Default: West (BLUFOR)
                            _PROB is the chance of an action occuring. A number from 0 to 1. Defualt: .25 (25%)
                            _TIME is the time between each instance of the script running. Defualt: 300 Seconds (5 Minutes)
                            #############
                            */
                            
                            
                            private ["_dis","_veh","_range","_prob","_time","_distArray","_TFArray","_desert","_chance","_ranNum","_num2","_fuelTotal","_fuel","_caseTire","_vehPos","_ied","_iedDir","_side"];
                            
                            hint "script started";
                            _veh = _this select 0;
                            _range = if (count _this > 1)  then {_this select 1} else {50};
                            _side = if (count _this > 2) then {_this select 2} else {west};
                            _prob = if (count _this > 3)  then {_this select 3} else {.25};
                            _time = if (count _this > 4)  then {_this select 4} else {300};
                            _distArray = [];
                            _TFArray = [];
                            sleep 1;
                            
                            while {true} do
                            {
                                if (!isServer) exitWith {};
                                _distArray = nil;
                                _TFArray = nil;
                                _distArray = [];
                                _TFArray = [];
                                hint str(_distArray);
                                sleep 1;
                                hint str(_TFArray);
                                sleep 1;
                                hint "waiting time";
                                sleep _time;
                                {if (side _x == _side) then {_dis = _x distance _veh}; _distArray = _distArray + [_dis];} forEach allUnits;
                                {if (_x > _range) then {_TFArray = _TFArray + [0]} else {_TFArray = _TFArray + [1]};} forEach _distArray;
                                if (!(1 in _TFArray)) then {_desert = true} else {_desert = false};
                                _ranNum = random 1;
                                hint str(_distArray);
                                sleep 1;
                                hint str(_TFArray);
                                sleep 1;
                                if (_ranNum <= _prob) then {_chance = true} else {_chance = false};
                                if (_desert && _chance) then 
                                {
                                    _num2 = floor(random 3);
                                    switch (_num2) do
                                    {
                                        case 0: //Fuel Alteration Result
                                        {
                                            hint "fuel altered";
                            		sleep 1;
                                            _fuelTotal = fuel _veh;
                                            if (_fuelTotal >= .1) then
                                            {
                                                _fuel = (_fuelTotal * .20);
                                                _veh setFuel _fuel;
                                            };
                                        };
                                        case 1: //Flat Tire Result
                                        {
                                            hint "tire altered";
                            		sleep 1;
                                            _caseTire = floor(random 4);
                                            switch (_caseTire) do
                                            {
                                                case 0:
                                                {
                                                    _veh setHit ["wheel_1_1_steering", .9];
                                                };
                                                case 1:
                                                {
                                                    _veh setHit ["wheel_1_2_steering", .9];
                                                };
                                                case 2:
                                                {
                                                    _veh setHit ["wheel_2_1_steering", .9];
                                                };
                                                case 3:
                                                {
                                                    _veh setHit ["wheel_2_2_steering", .9];
                                                };
                                            };
                                        };
                                        case 2: //IED result
                                        {
                                            hint "ied set";
                            		sleep 1;
                                            _vehPos = getpos _veh;
                                            _iedDir = random 360;
                                            _ied = "Land_IED_v1_PMC" createVehicle _vehPos;
                                            _ied setVariable ["direction", _iedDir]; // Set tripwire direction
                                            _ied setVariable ["length", 3]; // Set tripwire length
                                        };            
                                    };
                                    _distArray = nil;
                                    _TFArray = nil;
                                    _distArray = [];
                                    _TFArray = [];
                                };
                            };
                            IHearYou.sqf
                            Code:
                            /*
                            I Hear You! Script by Blackpython of TacticalGamer.com
                            ##########################################
                            ***Requires CBA***
                            
                            Script Call Line:
                            [-1, {nul=[*radius*,*hostile side*]execVM "IHearYou.sqf";}] call CBA_fnc_globalExecute;
                            
                            *radius* = Radius Enemies can hear players
                            *hostile side* = WEST , EAST, RESISTANCE , CIVILIAN. Depending on the side that can hear you and react.
                            
                            */
                            
                            private ["_AIAry","_ret","_rad","_wpNew","_side","_pos","_posPlay"];
                            _rad = _this select 0;
                            _side = _this select 1;
                            _AIAry = [];
                            while {true} do
                            {
                                if (isServer) exitWith {};
                                {if (side _x == _side) then {_AIAry = _AIAry + [_x]}} forEach allUnits;
                                {if (_x in _AIAry) then {_AIAry = _AIAry - [_x]}} forEach allDead;
                                {
                                    if ((_x distance player) <= _rad) then 
                                    {
                                        {if (_x != player) then {_AIAry = _AIAry + [_x]}} forEach allUnits;
                                        {if (_x in _AIAry) then {_AIAry = _AIAry - [_x]}} forEach allDead;
                                        _ret = [player] call acre_api_fnc_isSpeaking;
                                        if (_ret) then
                                        {
                                            _x setBehaviour "AWARE";
                                            _pos = getpos player;
                                            _posPlay = [(_pos select 0) + round(random 15),(_pos select 1) - round(random 15)];
                                            _wpNew = (group _x) addWaypoint [_posPlay, 0];
                                            _wpNew setWaypointType "MOVE";
                                            (group _x) setCurrentWaypoint _wpNew;
                                        }
                                    }
                                }  forEach _AIAry;
                                sleep 0.1;
                            }
                            Blackpython / ZephyrDark
                            Former 31st RECCE Member

                            Comment


                            • #15
                              Re: Python's Scripts of Pure Evil

                              I command thee to put "IHearYou.sqf" on the bravo server after testing it.
                              "War is not about what's right, It's about what's left"
                              "There is no flag large enough to cover the shame of killing Innocent people"
                              "If we don't end war, War will end us"

                              Comment

                              Connect

                              Collapse

                              TeamSpeak 3 Server

                              Collapse

                              Advertisement

                              Collapse

                              Twitter Feed

                              Collapse

                              Working...
                              X