Jump to content

th3gingergamer

Member
  • Content Count

    14
  • Joined

  • Last visited

  • Medals

Posts posted by th3gingergamer


  1. Sorry I'm really ill and dozy right now.

    _type =  "Land_Bollard_01_F";
    _playerCalling = vehicle player;
    _bollards = (getPos (_this select 0)) nearObjects [_type, 15];
    _height = 0;
    for [{_i=0}, {_i<50}, {_i=_i+1}] do
    {
        {_x setPos[getpos(_x) select 0, getpos (_x) select 1, _height - 0.02];} forEach _bollards;
    	sleep 0.05;
    	_height = _height - 0.02;
    };
    hintSilent "Bollards Opened";
    sleep 10;
    for [{_i=0}, {_i<50}, {_i=_i+1}] do
    {
        {_x setPos[getpos(_x) select 0, getpos (_x) select 1, _height + 0.02];} forEach _bollards;
    	sleep 0.05;
    	_height = _height + 0.02;
    };
    hintSilent "Bollards Closed";

    Here's the full code

    • Like 1

  2. So I created a tiny script where a user could lower bollards with an addACtion on one of them. The script detects bollards within a certain distance and then lowers them all simultaneously. After about 10 seconds the bollards begin raising back up and return to their original position. Once the bollards raise back up they seem to lose all collisions with vehicles. All the bollards have simulation disabled and damage disabled via the init code on them. The bollard with the addAction also just seems to lose the addAction if you tap it with a vehicle, even before it's been moved.


  3. Okay so i changed the script to use setPos instead. Every bollard has allowDamage false applied to it. After activating the script it seems like the bollards no longer have collisions. Anyone know what's going on? It also seems like the bollard with the addAction loses this addAction after it collides with a vehicle. This means if a car bumps into it then they become useless.


  4. I'm using near commands for it since I'm quite new to scripting and I want it to work anywhere a group of bollards are placed. The script is just for fun mainly but also for a server I help with which is why I made it a script which is run from the addaction on one of the bollards. I've changed it from setDamage to setPos since it looks better and setDamage made them fall random directions. I'm currently going to modify the script so that it works on any object the addaction is put onto.


  5. Thankyou that seemed to have fixed the first problem but after reworking the code I realised I didn't need the loops(hopefully). I removed them and now I am getting an error with

    _bollards = _this nearObjects [_type, 15];

    I already removed the double underscore but now I am getting the error: "4 elements provided, 3 expected"

    I tried wrapping from _this to the ned of the line with curly brackets but this cased an error with the forEach later in the code...

    (I was getting this error before removing the loops)

     

    Here is the edited code in case it would help:

    _type =  ["Land_Bollard_01_F"];
    _playerCalling = vehicle player;
    		_bollards = _this nearObjects [_type, 15];
    		{_x setDamage 1;} forEach _bollards;
    hintSilent "Barrier Opened";
    waitUntil {_playerCalling distance _type > 10};
    		{_x setDamage 0;} forEach _bollards;
    hintSilent "Barrier Closed";
    sleep 5;
    hint "";

     


  6. I've created a small script for lowering bollards and then raising them again but when I use the action on the bollard I receive the error that line 6 is missing a semicolon.

    _type =  ["Land_Bollard_01_F"];
    _playerCalling = vehicle player;
    for [{_i=0},{_i < (count _bollards)},{_i=_i+1}] do
    	{
    		__bollards = _this nearObjects [_type select _i, 15];
    		{setDamage 1;} forEach _bollards;
    	};
    hintSilent "Barrier Opened";
    waitUntil {_playerCalling distance _type > 10};
    for [{_i=0},{_i < (count _bollards)},{_i=_i+1}] do
    	{
    		__bollards = _this nearObjects [_type select _i, 15];
    		sleep 1;
    		{setDamage 0;} forEach _bollards;
    	};
    hintSilent "Barrier Closed";
    sleep 5;
    hint "";
    

    I've tried to figure out what the problem is for an hour now but I can't work it out. Any help at all is appreciated.

    • Like 1

  7. I have been trying to remove the group information from the caller part of '_this ' e.g. "B Alpha 1-1:1".

    I am trying to use splitString to split the string when it gets to a bracket as the whole string returned is "B Alpha 1-1:1 (Username)"

    The code I have so far is

    _caller = (_this select 1);
    _caller splitString "(";
    Hint format["%1  is an absolute idiot!",_caller select 1]; 

    The error I get is about splitString expecting a string but receiving an object.

    I tried looking up a way to change an object to a string but had no luck.

    I'm extremely new to SQF (I started learning today) and any help with this would be appreciated.

     

×