OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: bardosy on 17 Sep 2007, 08:52:17
-
At weekend I tried to make a building script:
The player have to buld a roadblock with "sandbag" (WoodFence).
I get the position of player and add 1m to X coordinate and create a woodfence...
I know it's not the perfect solution, but in my situation, the player is watch for North, and it could be works, but didn't, because the sandbag created in random places... :( Once 2m behind the player and next time 3m left from player...etc.
Could anybody help me to create a general building script:
Parameters are the "vehicle" what the script build (eg: WoodFence) and the distance in meter from the player and the degree how the new object's direction will be...
And when script activated: the new object is created front of player (where player watch).
Please help me!
-
["obj",distance,degree] execVM "LCD_buildobj.sqf"
private ["_objType","_pos","_dir"];
_objType = _this select 0;
_pos = player modeltoworld [0,_this select 1,0];
_dir = _this select 2;
_obj = _objType createvehicle _pos;
_obj setdir _dir;
if (true) exitwith {};
exec it like i wrote above it :D
LCD OUT
-
Thanks, I will check it!
-
LCD: Unfortunately, your script didn't work. (Nothing happened). But from your idea (modelToWorld) I made a working script. My script use the player direction too:
;Build script by bardosy
;thanks to LCD
;usage: ["classname",distance,degree] exec "buildscript.sqs"
;example: ["FenceWood",1.5,90] exec "buildscript.sqs"
_class = _this select 0
_distance = _this select 1
_degree = _this select 2
_pos = player modeltoworld [0,_distance,0]
_rb = _class createVehicle getPos player
_degr = getDir player
?(_degr>=180) : _degr = _degr - 180
_ndeg = _degr + _degree
_rb setDir _ndeg
_rb setPos _pos
-
actualy... i had just 2 typos in da script (i forgot da underscore in two variables name... ::)) shud work fine now if u still wana try my 1 :D
nd ur script seems 2 b fine 2 ;) :D
LCD OUT