Jump to content

Spriterfight

Member
  • Content Count

    171
  • Joined

  • Last visited

  • Medals

Posts posted by Spriterfight


  1. func_PredictIntrecept = {
    _target = _this select 0;
    _aircraft = _this select 1;
    
    _targetPos = getPos _target;
    
    
        // Get the velocity of the target
        _targetVel = velocity _target;
    
        // Get the current position of the aircraft
        _aircraftPos = getPos _aircraft;
    
        // Calculate the time it will take to reach the target
        _timeToTarget = (_aircraftPos distance _targetPos) / (speed _aircraft / 3.6);
    
        // Calculate the future position of the target
        _futureTargetPos = _targetPos vectorAdd (_targetVel vectorMultiply _timeToTarget);
    
        // Calculate the direction to the future target position
        _directionToFutureTarget = _aircraftPos vectorFromTo _futureTargetPos;
    
        // Calculate the interception point
        _intersectionPoint = _futureTargetPos vectorAdd (_directionToFutureTarget vectorMultiply _timeToTarget);
    
        // Create a marker at the interception point (for debugging purposes)
        _markerStr = createMarker ["markername", _intersectionPoint];
        _markerStr setMarkerShape "RECTANGLE";
        _markerStr setMarkerSize [100, 100];
    
        // Display a hint for debugging
        hint "OK";
    
        _intersectionPoint;
    };

    This is my code which predicts intrecept position of a target, i fixed it by simplifying the formula(it has an object attached to it and wanted a relase position where the plane relases it to hit target, nevermind it is complicated and arma has strange physics).The problem was it seemed to be a delay and the plane moved behind the target.It needs to be updated every second.It seems to be work, but i want to be sure that it executes instantly and there are no delay since accurate position is crucial


  2. So can someone help me to make ai pilots fire accurately or use the plane properly it is so frustrating seeing ww 2 fighters geting shot by biplanes and the problem is that the fighters are fleeing from the bipalnes and they arent using the full potential of their speed also everytime they let the biplanes in their backs so they can shot them.I know arma isnt made for flight sim but want to make a ai vs ai dogfight that is random and dont wanna chees it with scripts,maybe if i can make them more accurate would be better since these planes dont have heat missiles


  3. 34 minutes ago, opusfmspol said:

    unitReady page doesn't reflect its locality, but be aware it should be run where the unit being checked is local.

     

    My own testing in the past showed the unitReady command only gave an accurate return on the machine where the unit was local.  When the command was run on a machine where the unit was not local, it always returned true, regardless whether the unit was ready or not ready.  And that caused scripts and fsm's which were relying on it to jump the gun, advancing instead of waiting.

    When does ready fires actually?When a unit is at his position?


  4. So i have a waypoint and i want to set a timer for if a certain time passes the waypoint deletes itself so i thoguht the setWaypointTimeout is for this .Any ide?The reason for this is simple,I want a dynamic ai co op exeprience and if certain waypoint dosent seems to fit the role i want to cahnge it thats why i would set a timer for it so if the ai didnt comepletes the waypoint then the waypoint will delete itself and will be replaced with another one with different role, like move---> sek and destroy


  5. _bomberplane = createVehicle [_planetype, _posspawn, [], 0, 'FLY'];
    [_bomberplane, 600, _posspawn, "ASL"] call BIS_fnc_setHeight;
    
    _dir = _bomberplane getDir _caller;
    _bomberplane setDir _dir;
    
    _crewbomber = createVehicleCrew _bomberplane;
    
    
    _wp1 = _crewbomber addWaypoint [_targetpos,1];
    _wp1 setWaypointType "MOVE";
    _wp1 setWaypointSpeed "Full";
    _wp1 setWaypointBehaviour "Aware";
    _wp1 setWaypointStatements ["true", "deleteVehicle this"];

    It is sabs secret weapon planes i want the plane to face the direction of caller 


  6. 11 hours ago, Joe98 said:

    Place 3 triggers on the map covering the area required.  The three triggers need to be nearly the same size, not exactly the same size, so you can edit the triggers easily.

     

    Name your 3 leaders:
    lead01  
    lead02
    lead03

     

    Now place 3 boxes on the map.  On the side in an out of the way place. Name the boxes
    box01
    box02
    box03

     

    For trigger 1, you write a command so that when lead01 enters the trigger area, box01 is deleted:   deletevehicle  box01

    For trigger 2, you write a command so that when lead02 enters the trigger area, box02 is deleted:   deletevehicle  box02

    For trigger 3, you write a command so that when lead03 enters the trigger area, box03 is deleted:   deletevehicle  box03

     

    Now place a 4th trigger on the map. Somewhere in an out of the way place.  This trigger will fire when all 3 boxes are deleted:
    (!alive box01) && (!alive box02) && (!alive box03)


    The exclamation mark, just means  - not alive.

     

    So, the three leaders enter the area, the 3 boxes are deleted and this causes your trigger to fire.

    .

     

    I solved it with 

    
     	leader grp1 inArea thisTrigger &&
     	leader grp2 inArea thisTrigger &&
    	leader grp3 inArea thisTrigger &&
    	leader grp4 inArea thisTrigger &&
    	leader grp5 inArea thisTrigger

     


  7. 32 minutes ago, bong oh said:

    umm. I don't know how to show repo...for instance, announce sqf in mission folder?

     

    init.sqf

    
    YOU_fnc_account =
    {	params [["_caller", objNull, [objNull]], ["_amount", 0, [0]]];
    			
    	private	_account = _caller getvariable "YOU_account";
    	
    	_caller setvariable ["YOU_account", _account + _amount];
    if (_amount < 0) then {
    			systemChat format ["%1 POINT 사용!", _amount] 
    		} else {
    			if (_amount > 0) then {
    			systemChat format ["%1 POINT 획득!", _amount]
    			};
    		};
    	systemChat format ["Balance $%1", _account+ _amount];
    };
    
    _unit = _this select 0; 
    [_unit, [_unit, "SavedInventory"]] call BIS_fnc_saveInventory;
    
    
    //all trait unlock
    player setUnitTrait ["engineer",true];
    player setUnitTrait ["medic",true];

    initPlayerLocal.sqf

    
    
    ["InitializePlayer",[player,true]]call BIS_fnc_dynamicGroups;
    
    // When killed, bring _unit,_killer to Server
    {
    	_x addEventHandler["Killed",
    	{
    		_unit = (_this select 0);
    		_killer = (_this select 1);
    		pKilled = [_unit, _killer];		
    		publicVariableServer "pKilled";
    	}];
    }forEach allUnits;

    initServer.sqf

    
    //calculate Distance bonus and increase _killer's account
    ["Initialize"] call BIS_fnc_dynamicGroups;
    
    "pKilled" addPublicVariableEventhandler
    {
    	private ["_data"];
    	private _bonus =0;
    
    	_data = (_this select 1);
    	_unit = (_data select 0);
    	_killer = (_data select 1);
    	_cID = owner _killer;
    	_distance = _unit distance _killer;
    	if(side _killer == side _unit) then{
    	[_killer,-100] call You_fnc_account;
    	};
    //	hint str _distance;
    	if(_distance<100) then
    	{
    		_bonus=0;
    	};
    // each kill range over 100m bouns will increase 10
    	if(_distance>=100) then{
    		_bonus=(_distance/100)*10;
    		_bonus=[_bonus,0] call BIS_fnc_cutDecimals;
    		hint format ["+거리 보너스 : %1", _bonus];
    	};
    	_bonus=_bonus+100;
    	[_killer,_bonus] call You_fnc_account;
    //	pClient = bonus;
    //	_cID publicVariableClient "pClient";
    };

    onPlayerRespawn.sqf

    
    _unit = _this select 0;
    [_unit, [_unit, "SavedInventory"]] call BIS_fnc_loadInventory;

    onPlayerOut.sqf

    
    _unit = _this select 0;
    [_unit, [_unit, "assignedItem"]] call BIS_fnc_saveInventory;

     

    umm that is all sqf in my mission folder

     

     

     

     

     

     

    You pack the mission in a zip and upload to a drive.This will help us reproduce the error

    Do you use any mod?

     

    Thank you!


  8. 5 minutes ago, bong oh said:

    Now.. this is work.. I can't understand this code is same above that but work.. I found red dot in code  when I put here.

    then I remove that dot and copy, that code work correctly . wtf is that... any way yup... work

    
    this addAction ["Buy truck", "if (((_this select 1) getVariable ""YOU_account"")>1500) then    
     {systemChat ""you bought truck!"";    
     [_this select 1, -1500] call YOU_fnc_account,;    
    _spawnedvehicle = createVehicle[""rhsusf_m1078A1P2_B_D_fmtv_usarmy"",getMarkerPos ""Truck"",[], 0, ""NONE""];
    clearWeaponCargoGlobal _spawnedvehicle;
    clearMagazineCargoGlobal _spawnedvehicle;
    clearItemCargoGlobal _spawnedvehicle;
     }   
     else {systemChat ""Not Enough Money""};"];   

     

    Without error?Any unnecsesary element in  syntax can cause error.

×