Jump to content
Sign in to follow this  
A-SUICIDAL

All units can build sandbag walls - problem

Recommended Posts

I threw this script together fast and added it to a trigger system that checks when each player is alive and then adds the ability for each player to build a small sandbag wall. It works great when I preview it, but I knew it was going to bug when I tested it online. My friend built a sandbag wall, but I could not see the sandbag walls that he built, and he couldn't see the walls that I built. So I searched around and could not find a fix for this, so I decided to ask for help.

Here's the script:

build_cover.sqf

_unit = _this select 0;
_id = _this select 2;

_unit removeAction _id;

_unit switchMove "AinvPknlMstpSlayWrflDnon_medic";
sleep 3;

_cover1 = "Land_BagFenceShort" createVehicleLocal [0,0,0];
_cover2 = "Land_BagFenceShort" createVehicleLocal [0,0,0];
_cover1 setDir ((direction _unit) -180);
_cover1 setPos (_unit modelToWorld [0,1.4,((position _unit) select 2)]);
_cover2 setDir ((direction _unit) -180);
_cover2 setPos (_unit modelToWorld [0,1.2,((position _unit) select 2) -0.6]);

sleep 1;

_unit addAction ["Build Cover", "cover_build.sqf","",1,false];

exit

I tested it a few different ways and couldn't get it fixed. But yeah, it sure is a fun script when I previewed it.

I tried this:

this addAction ["Build Cover", "cover_build.sqf","",1,false];

and i tried this:

if (local this) then {this addAction ["Build Cover", "cover_build.sqf","",1,false]};

But I'm no scripting god, so now I'm just lost.

It creates 2 sandbag walls stacked on top of each other, because when I tried building a wall on the side of a steep hill, the wall appeared hovering in mid air, so by creating a second wall below it that sinks into the ground, I was able to solve the hovering problem. Now I just need to make this script work so other players can see the wall online.

Edited by A-SUICIDAL

Share this post


Link to post
Share on other sites
I threw this script together fast and added it to a trigger system that checks when each player is alive and then adds the ability for each player to build a small sandbag wall. It works great when I preview it, but I knew it was going to bug when I tested it online. My friend built a sandbag wall, but I could not see the sandbag walls that he built, and he couldn't see the walls that I built. So I searched around and could not find a fix for this, so I decided to ask for help.

Here's the script:

build_cover.sqf

_unit = _this select 0;
_id = _this select 2;

_unit removeAction _id;

_unit switchMove "AinvPknlMstpSlayWrflDnon_medic";
sleep 3;

_cover1 = "Land_BagFenceShort" createVehicleLocal [0,0,0];
_cover2 = "Land_BagFenceShort" createVehicleLocal [0,0,0];
_cover1 setDir ((direction _unit) -180);
_cover1 setPos (_unit modelToWorld [0,1.4,((position _unit) select 2)]);
_cover2 setDir ((direction _unit) -180);
_cover2 setPos (_unit modelToWorld [0,1.2,((position _unit) select 2) -0.6]);

sleep 1;

_unit addAction ["Build Cover", "cover_build.sqf","",1,false];

exit

I tested it a few different ways and couldn't get it fixed. But yeah, it sure is a fun script when I previewed it.

I tried this:

this addAction ["Build Cover", "cover_build.sqf","",1,false];

and i tried this:

if (local this) then {this addAction ["Build Cover", "cover_build.sqf","",1,false]};

But I'm no scripting god, so now I'm just lost.

It creates 2 sandbag walls stacked on top of each other, because when I tried building a wall on the side of a steep hill, the wall appeared hovering in mid air, so by creating a second wall below it that sinks into the ground, I was able to solve the hovering problem. Now I just need to make this script work so other players can see the wall online.

I would like to use this script for a mission of mine. I added the sqf to my mission folder, when I boot up the editor and run it it says the script file cannot be found. I have 2 other scripts in the mission folder that are working but this one doesnt show up. Any help?

Again, I apologize for the necro post, but I like the simplicity of this script and would like to use it for my private coop mission. Thank you.

Share this post


Link to post
Share on other sites

is there a way to limmit a player so he can only build 1 or 2 , or ontill 1 is destoyed?

I can see somone spamminf a server with 200 walls :butbut:

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×