Jump to content

TappT

Member
  • Content Count

    4
  • Joined

  • Last visited

  • Medals

Posts posted by TappT


  1. Back in the day i did a teleport script where it teleports you to where you shoot (or where the bullet lands). Someone might find it useful

    //Init.sqf
    
    _unitwep = player;
    bulletinair = false;
    bulletinairpos = [];
    
    _unitwep addeventhandler ["Fired",   
    { 
     _this spawn  {
    	_unit = player;
    	if (!bulletinair) then {
    	bulletinair = true;
    	_bullet = _this select 6; 
    	_pos = getPosATL _bullet;
    	while {alive _bullet} do {_pos = getPosATL _bullet; bulletinairpos = getposATL _bullet};
    	_roundpos = [(round (_pos select 0)),(round (_pos select 1)),(round (getposATL _bullet select 2))];
    	_null = (_pos select 0) + (_pos select 1) + (_pos select 2);
    	if (_null == 0) then {hint format ["Error: pos = %1",_pos]} else {_unit setpos [_pos select 0, _pos select 1,0.5]; hint format ["Teleported to: %1",_roundpos]};
    	waitUntil {!alive _bullet};
    	bulletinair = false;
    	bulletinairpos = [];
    	} else {hint format ["Wait for bullet to hit the ground, its %1M from the ground",(round (bulletinairpos select 2))]};
     }; 
    }];
    
    • Like 1

  2. I'm trying to make my own CTF mode where i want to find the nearest unit within 5 meters of the flag where that unit is _unit. i have been searching around in different forums but cannot find anything that i can use that works. I am quite new to scripting and trying to learn as much as i can.

     

    This is what i have so far:

    //the init of the flag
    [[blueflag,["Pickup","blueflag.sqf"]],"addAction",true] call BIS_fnc_MP;
    //blueflag.sqf
    _unit playActionNow "MedicOther";
    sleep 6;
    blueflag attachto [_unit, [0, 0.4, 5] ];
    scopeName "loop";
    while {alive _unit} do {
    if (!alive _unit) then {detach blueflag; blueflag setpos getpos _unit; breakTo "loop2"} else {breakTo "loop"};
    
    scopeName "loop2";
    if (!alive _unit) then {[[blueflag,["Pickup","blueflag.sqf"]],"addAction",true] call BIS_fnc_MP; breakTo "loop";} else {breakTo "loop2"};

    this code works when i make _unit = player. But if the player dies and someone else picks up the flag i want _unit to change to the unit which picked up the flag.

×