Jump to content

th3gingergamer

Member
  • Content Count

    14
  • Joined

  • Last visited

  • Medals

Everything posted by th3gingergamer

  1. 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.
  2. 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
  3. th3gingergamer

    Can't find missing semicolon

    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'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.
  5. th3gingergamer

    Can't find missing semicolon

    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.
  6. th3gingergamer

    Can't find missing semicolon

    Thanks for everyone who helped me with this. I finally fixed it. I changed _this to (_this select 0) and fixed that problem where _type was used instead of _this select 0.
  7. th3gingergamer

    Can't find missing semicolon

    I'm calling the script through an addaction on one of the bollards. I want to be able to just place a bollard anywhere on the map and add the addAction for it to just work. I'm not passing anything to the script for _this. It does still store info such as who called the script though.
  8. th3gingergamer

    Can't find missing semicolon

    I then get the error "Type Array expected object,location"
  9. th3gingergamer

    Can't find missing semicolon

    so what i've learned from that is _this doesn't actually contain the coordinates of the object that called the script... So can anyone tell me how to get the coordinates of the object calling the script?
  10. th3gingergamer

    Can't find missing semicolon

    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 "";
  11. th3gingergamer

    Removing group information from _this

    Yup taking out the splitString and putting in that fixed it. Thanks!
  12. 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.
  13. th3gingergamer

    Removing group information from _this

    The error I'm getting is that _caller is an object and not a string and splitString can only split a string. The result of _caller though is "B Alpha 1-1:1 (My Name)".
  14. th3gingergamer

    Removing group information from _this

    I now get "Error Generic error in expression" with no useful information
×