IRONFRONT FANS FORUM
Register Latest Topics
 
 
 


Reply
  Author   Comment  
BRS

Captain
Registered:
Posts: 197
Reply with quote  #1 
I was in need to place Land_BagFenceShort's around my AI mortar.
So I wrote this script as part of my BSIF44AIMortar script package.
But you can use it 'stand alone' for your mortar units too.
Usage is very simple:
Place the create_round_defence_wall.sqf script into your mission folder and
inside your mortar unit init line write:
nul = [this] execvm "create_round_defence_wall.sqf";
I added two links so you can see how it will looks like.
Keep in mind that this script will handle the defend wall only.

Code:
//===================================================================================================================
//     Script to place a defend wall around a mortar unit
//    by BS 2014
//
//    Usage: nul = [object] execvm "create_round_defence_wall.sqf";
//    example : nul = [this] execvm "create_round_defence_wall.sqf";
//   
//    place this line into your mortar init line
//
//     Note:  You may use this script as it is or change it at your convenience.
//    Would be nice seeing a credit note if you'll use this script for your missions.
//
//======================================================================================================================


if (!isServer) exitWith {};

private ["_unit","_pos","_wall_count","_wall","_dist","_angle","_x","_y","_dir","_debug"];

_debug = false;

_unit = _this select 0;
if (isnull (_unit)) exitWith {  if (_debug) then { hintsilent "Set round defence wall: no Unit found";}; };

_wall_count = 9;
//_dx = sizeOf "Land_BagFenceShort";
_dx = 1.1;
_dist = 2.45;
_angle = 360 / _wall_count;

_pos = _unit getVariable ["Saved_Pos", getposATL (_unit)];
if ((count _pos) == 0) then
{
    _pos = getposATL (_unit);
};

_dir = getdir(_unit);

for "_j" from 0 to ( _wall_count -1) do
{
    if (_j != ( floor(_wall_count*0.5)) ) then
    {
        _x = ( _pos select 0) +  (sin ( _dir + ( _angle * _j) )) * _dist;
        _y = ( _pos select 1) +  (cos ( _dir + ( _angle * _j) )) * _dist;

        _wall = createVehicle ["Land_BagFenceShort", [ _x, _y, 0 ], [], 0, "CAN_COLLIDE"];
        _wall setDir ( _dir + ( _angle * _j));
        _wall setPosATL [ _x, _y, 0 ];
        _wall setVectorUp (surfaceNormal getPosATL (_wall) );
    };
};


https://www.dropbox.com/s/hv9nfle2ekj90ko/rus_mortar_wall.png
https://www.dropbox.com/s/82m8ph9pak3lx8g/ger_mortar_wall.png

0
Foxsch

Avatar / Picture

Colonel
Registered:
Posts: 454
Reply with quote  #2 
That's brilliant BS ~ Really useful!
I have often enough decided to create a rounded sand bag area around munitions, and getting each section to sit in a neat circle is tiresome tstl ~ Cheers : -)

__________________
Mission Repository - http://www.missionrepository.com

0
Foxsch

Avatar / Picture

Colonel
Registered:
Posts: 454
Reply with quote  #3 
Just an idea ~ Is there a way I could edit the .sqf so that I could lower the bags nearer the ground, and maybe also one (central) section was slightly lower than the rest? My thinking is using the script for mg posts ~ 
__________________
Mission Repository - http://www.missionrepository.com

0
Santa Six

Avatar / Picture

Colonel
Registered:
Posts: 360
Reply with quote  #4 
Yes you can. The simplest way is to add the desired height in the z axis.

Example:
_wall setPosATL [ _x, _y,-0.3];


0
BRS

Captain
Registered:
Posts: 197
Reply with quote  #5 
Yes, I would use the same way as Santa discribed it.

BTW, I would like to own some good (detailed) pictures of the Mortar bombs which were used for GrWr34 and BM37.
Could someone possible direct me to link(s) for this?
0
Foxsch

Avatar / Picture

Colonel
Registered:
Posts: 454
Reply with quote  #6 
That's perfect thx : -) As for the ammo - there didn't seem to be a lot according to the great-god Google, but I did come up with a couple of things which might help:

For the GrWr34:  http://www.digplanet.com/wiki/8_cm_Granatwerfer_34 (check the 'you tube' tab)

and for the BM37: http://player.mashpedia.com/player.php?q=frnO7mTNETE

  Hope these help!

__________________
Mission Repository - http://www.missionrepository.com

0
BRS

Captain
Registered:
Posts: 197
Reply with quote  #7 
Thx Foxsch!
The idea was to replace the used bomb in my BSIF44AIMortar script pack with a custom mortar shell. And this for the vanilla game.
I played around for some days now, but I don't think it's possible to replace or insert any custom thing into IF44 as it can be done with the sounds.
I would like to exchange the "bomb" object with my own p3d. If someone could help me ahead with the -how to-,  I would give it a next try.
0
Foxsch

Avatar / Picture

Colonel
Registered:
Posts: 454
Reply with quote  #8 
np ~ that sounds a bit out of what I can manage back-end of IF44 unfortunately, so I can't help there but good luck if it does go ahead!
__________________
Mission Repository - http://www.missionrepository.com

0
Joarius

Avatar / Picture

IFR Team
Registered:
Posts: 290
Reply with quote  #9 
Hi, [smile]
I want to thank BS for this little script ; little but very sympatisch. [smile] Thank's ! [smile]


As Shrck has given me taste for TvTs [smile], i have said to me that it would be good to have the possibility to remove the Defence Wall around the mortar, in order to erase the traces of the passage of players, if necessary.
But as i'm not a great scipter (very not great... [biggrin] even a "baby" [rolleyes]), i have used a part of the Reploy script for the Respawn Mobile in the Norrin Revive.
So it gives these :
Code:

/*
//======================================================================================================================
//    Script to Reploy a Defence Wall aRound a Mortar unit
//    par Joarius
//
//    Usage :
//    this addaction ["Remove sandbags around the mortar","scripts\Defence_Wall_Round_Mortar_-_Reploy.sqf"];
//   
//    Place this line into your mortar init line
//
//======================================================================================================================
*/

_mortar = _this select 0;

//    Repli des sacs de sac
_shed = nearestObject [_mortar, "Land_BagFenceShort"];
deleteVehicle _shed;

if (true) exitWith {};

You can see that it's not a great script... [rolleyes] But it works, so i'm happy... [biggrin]
Achtung ! You must use the mouse in order to erase each sandbag, so it's necessary to use the mouse wheel 8 times.
In the beginning, i was desapointed to see that not all the sandbags were erased in the same time, but quickly, i thought that it was more realistic in TvT : you can't erase real sandbags as a wizard... it asks some delay... [wink]


So, in the same idea, i have asked me : and if the Wall Defence aRound Mortar was constructible, in a realistic way ?
This is the solution : you use the command this addaction ["Place sandbags around the mortar","scripts\Defence_Wall_Round_Mortar_-_Deploy_3s.sqf"];
.
You place this command in the initialization of the mortar unit, and you will see the Defence Wall which will be build bag after bag, with a delay approximatly of 3s between each sandbag.
The little modification that i've made is simply to add the line sleep 3; in the bottom of the script of BS as shown below :
Code:

/*
//======================================================================================================================
//    Script to place a Defence Wall aRound a Mortar unit 
//    by BS 2014
//    Modifié par Joarius (2014)
//
//    Usage :
//    this addaction ["Place sandbags around the mortar","scripts\Defence_Wall_Round_Mortar_-_Deploy_3s.sqf"];
//    
//    Place this line into your mortar init line
//
//    Note :  You may use this script as it is or change it at your convenience. 
//    Would be nice seeing a credit note if you'll use this script for your missions.
//
//======================================================================================================================
*/

if (!isServer) exitWith {};
private ["_unit","_pos","_wall_count","_wall","_dist","_angle","_x","_y","_dir","_debug"];
_debug = false;
_unit = _this select 0;
if (isnull (_unit)) exitWith { if (_debug) then {hintsilent "Set round defence wall : no Unit found";}; };
_wall_count = 9;
//  _dx = sizeOf "Land_BagFenceShort";
_dx = 1.1;
_dist = 2.45;
_angle = 360/_wall_count;
_pos = _unit getVariable ["Saved_Pos", getposATL (_unit)];
if ((count _pos) == 0)
then {
  _pos = getposATL (_unit);
};
_dir = getdir(_unit);
for "_j" from 0 to (_wall_count -1)
do {
  if (_j != ( floor(_wall_count*0.5)) )
  then {
    _x = ( _pos select 0) +  (sin ( _dir + ( _angle * _j) )) * _dist;
    _y = ( _pos select 1) +  (cos ( _dir + ( _angle * _j) )) * _dist;
    _wall = createVehicle ["Land_BagFenceShort", [ _x, _y, 0 ], [], 0, "CAN_COLLIDE"];
    _wall setDir ( _dir + ( _angle * _j));
    _wall setPosATL [ _x, _y, 0 ];
    _wall setVectorUp (surfaceNormal getPosATL (_wall) );
    sleep 3;
  };
};

Now, you have a "realistic" possibility of Defence Wall aRound Mortar : you can begin the mission with the wall around the mortar, you can remove it, disassemble the mortar, go elsewhere and rebuild the Wall Defence. [wink]
This is the initialization for the mortar unit : nul = [this] execvm "scripts\Defence_Wall_Round_Mortar_-_Deploy.sqf"; this addaction ["Mettre des sacs autour du mortier","scripts\Defence_Wall_Round_Mortar_-_Deploy_3s.sqf"]; this addaction ["Enlever les sacs autour du mortier","scripts\Defence_Wall_Round_Mortar_-_Reploy.sqf"];
Thefirst script is the original script of BS ; the second script is the Reploy script ; the last script incorporate the delay of 3s.



Danke schön nochamol, BS !
again thank you BS ! [smile]

__________________
0
BRS

Captain
Registered:
Posts: 197
Reply with quote  #10 
As ever, À votre service Joarius!

Beside the nice 'slow build the wall feature' you build in,
I understood you in this way that you wanted a way to go out of the mortar wall?
It should be there at the rear side of the ring wall already. This line here:
Code:
 if (_j != ( floor(_wall_count*0.5)) )
should do that trick. This would be the oposite side of the dir you give the mortar while placing it on the map.

BTW: it seems that you are really active so I'm thinking that you would be a good 'victime' for some more scripts of mine to play around with and test them out this way [wink]
If there would be -vèritable- interesst by your side, let me know.
 
0
Joarius

Avatar / Picture

IFR Team
Registered:
Posts: 290
Reply with quote  #11 
I have tried the script on our team server, but the script to construct sandbaghs doesn't work... :\ It works in the editor, but not on the dedied server...

@BS :
I wanted to "erase" all the sandbags ; so, if necessary, you move the mortar, but you don't let any traces of your presence.
No, i'm less active than before, because Iron Front is less played in our Team, and even more the TvT games... :\ There is not a lot of people in our team who like play TvT, while i think that it's the best way to play : you don't have to play against stupid but overskilled IAs, but against Humans, who are generally not stupid, and not overskilled... [smile] I think that it's sad, but so is it...

Now, if i need script, why not ask you ? [smile]

__________________
0
BRS

Captain
Registered:
Posts: 197
Reply with quote  #12 
I just play SP missions for my own,
so it's I can't say if my scripts will work inside MP. Until I'm not able to test the scripts online,
I have less knowledge about creating my scripts correct for MP online fights [frown]
That's why I asked for victims... [smile]

Ok, try this step first:
Inside your mission ini.sqf add the following line:
Code:
compile preprocessFileLineNumbers "create_round_defence_wall.sqf";

and test-play again.

if this will not work, have a look to the below code line inside the script:
Code:
if (!isServer) exitWith {};
maybe it should be changed to:
Code:
if ( !isServer || !isDedicated) exitWith {};

One last idea for now is to comment out that line like:
Code:
//if (!isServer || !isDedicated) exitWith {};

I really don't know if one of these solutions may help, it's all just a try.

0
Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Easily create a Forum Website with Website Toolbox.