Modifying deploy bike - Wall glitching

Discussion in 'Scripting Discussions' started by Brave Sir Robin, Jan 4, 2015.

  1. Brave Sir Robin

    Brave Sir Robin Valued Member!

    Joined:
    Jun 7, 2014
    Messages:
    270
    Likes Received:
    66
    I have an issue with some of the players building the bike on the other side of the wall and then selecting the driver(rider) seat and porting across to the other side. The antiwall doesn't prevent this.
    I have modified the code to check for a plotpole within a certain distance and then cancel if ==1. Can someone check this out for me please?
    Code:
    private ["_nearbase"];
    _nearbase = player nearEntities [["Plastic_Pole_EP1_DZ"],50]///distance to a base
    
    if (dayz_combat == 1) then {
        cutText [format["You are in Combat and cannot build a bike."], "PLAIN DOWN"];
    if (_nearbase == 1) then {
        cutText [format["You are too near a base and cannot build a bike."], "PLAIN DOWN"];
    } else {
        player removeAction s_player_deploybike;
        player playActionNow "Medic";
        r_interrupt = false;
        player removeWeapon "ItemToolbox";
        _dis=10;
        _sfx = "repair";
        [player,_sfx,0,false,_dis] call dayz_zombieSpeak;
        [player,_dis,true,(getPos player)] spawn player_alertZombies;
    
        sleep 6;
    
        _object = "Old_bike_TK_CIV_EP1" createVehicle (position player);
        _object setVariable ["ObjectID", "1", true];
        _object setVariable ["ObjectUID", "1", true];
    
        _object attachto [player,[0.0,3.0,0.5]];
        sleep 3;
        detach _object;
        player reveal _object;
    
        cutText [format["You've used your toolbox to build a bike."], "PLAIN DOWN"];
    
        r_interrupt = false;
        player switchMove "";
        player playActionNow "stop";
    
        sleep 10;
    
        cutText [format["Warning: Spawned Bikes DO NOT SAVE after server restart!"], "PLAIN DOWN"];
    
    };
    //bike deploy script by Player2 - OpenDayz Release Coming Soon!
    
    oh and an ups to Player2 erm too...

    Granted this doesn't allow the plot owner to deploy a bike within the same radius, however, I think players won;t mind it. I could do a plotowner check but thats just getting too complicated for a simple script.
     
  2. Brave Sir Robin

    Brave Sir Robin Valued Member!

    Joined:
    Jun 7, 2014
    Messages:
    270
    Likes Received:
    66
    Further development of this. But still no luck, anyone?
    Code:
    private ["_nearbase"];
    _nearbase = (count(nearestObjects [_position,["Plastic_Pole_EP1_DZ"],50]) > 0);///distance to a base
    
    if (dayz_combat == 1) then { 
        cutText [format["You are in Combat and cannot build a bike."], "PLAIN DOWN"];
    if (_nearbase ) then { 
        cutText [format["You are too near a base and cannot build a bike."], "PLAIN DOWN"];
    };
    } else {
        player removeAction s_player_deploybike;
        player playActionNow "Medic";
        r_interrupt = false;
        player removeWeapon "ItemToolbox";
        _dis=10;
        _sfx = "repair";
        [player,_sfx,0,false,_dis] call dayz_zombieSpeak;
        [player,_dis,true,(getPos player)] spawn player_alertZombies;
       
        sleep 6;
       
        _object = "Old_bike_TK_CIV_EP1" createVehicle (position player);
        _object setVariable ["ObjectID", "1", true];
        _object setVariable ["ObjectUID", "1", true];
       
        _object attachto [player,[0.0,3.0,0.5]];
        sleep 3;
        detach _object;
        player reveal _object;
    
        cutText [format["You've used your toolbox to build a bike."], "PLAIN DOWN"];
       
        r_interrupt = false;
        player switchMove "";
        player playActionNow "stop";
       
        sleep 10;
       
        cutText [format["Warning: Spawned Bikes DO NOT SAVE after server restart!"], "PLAIN DOWN"];
       
    };
    //bike deploy script by Player2 - OpenDayz Release Coming Soon![code]
     
  3. SchwEde

    SchwEde OpenDayZ Rockstar!

    Joined:
    Jul 11, 2013
    Messages:
    989
    Likes Received:
    177
    I had d me similar problems with the towing script. In the end the whole script is gone now but I had some fixes for the same problems, maybe this can help you or at least give you some more ideas:
    Code:
    _isWall =["Land_DZE_LargeWoodDoorLocked","WoodLargeWallDoor_DZ","WoodLargeWallWin_DZ","WoodLargeWall_DZ","Land_DZE_WoodDoorLocked","WoodSmallWallDoor_DZ","WoodSmallWallWin_DZ","Land_DZE_GarageWoodDoor","Land_DZE_GarageWoodDoorLocked","WoodSmallWall_DZ","WoodSmallWallThird_DZ","CinderWallHalf_DZ","CinderWall_DZ","CinderWallDoorway_DZ","Land_DZE_LargeWoodDoor","CinderWallDoorSmallLocked_DZ","CinderWallSmallDoorway_DZ","CinderWallDoor_DZ"];
    _nearWall = nearestObjects [player,_isWall, 5];
    if (count _nearWall > 0) exitWith {cutText [format["Cannot untow! A Wall is within 5 Meters!"], "PLAIN DOWN"];};
     
  4. ebay

    ebay OpenDayZ Guru!

    Joined:
    Jan 9, 2013
    Messages:
    828
    Likes Received:
    296
    I've been using this for a while. It is similar to @SchwEde's but includes all buildables and regular houses too:

    Code:
    _nearWalls = nearestObjects [player, ["House","ModularItems","DZE_Housebase","BuiltItems","DZE_Base_Object"], 30];
    if (count _nearWalls > 0) exitWith {cutText [format["\n\nYou are too close to a building or object!"], "PLAIN DOWN"];};
     
    SchwEde likes this.

Share This Page