Jump to content

Recommended Posts

Hello, community.

- I want to create a task in the middle of a huge town. The type of the task is not important.

- We all know I can simply place enemy units... and even if I use waypoints, they will be very predictable and I will almost always know their possible location and position.

- For this reason and in the interest of the dynamic and immersive gameplay I am seeking, I wish to use some kind of a script that would randomly "choose" dynamicaly generated spots and positions and will spawn these groups somewhere around, let's say around the objective in a hidden marker area.

- In order to achieve this I could probably create and name the groups first and use their tags in the script that is going to spawn them in this area.

- The other possible way would be to include units' correct editor names (classifications) and spawn all of the included units, but this seems to be more difficult to accomplish.

So, what would you suggest?

As always, thank you in advance and cheers! 🙂

 

Share this post


Link to post
Share on other sites

@black_hawk_mw2_87,

You need the framework I'm getting ready to release.

The mission script would look like,

baseMARK3 call MMF_fnc_soldierEAST;
eastLead call MMF_fnc_randomWP;
player call MMF_fnc_wpTracker;

And that's about it.

Here's an example of a 3 wave base defense mission,

Spoiler

if (scene_Type==5) exitWith {

	if (scene_State==1) exitWith {

		currentMARK=baseMARK1;
		player call MMF_fnc_stripITEMS;
		playIntro=3;
		[]spawn MMF_fnc_intro;
		spawnState=0;
		spawnNUM=4;
		baseMARK1 call MMF_fnc_soldierWEST;
		baseMARK1 call MMF_fnc_coverTRAP;
		baseMARK2 call MMF_fnc_soldierEAST;
		baseAREA2 call MMF_fnc_soldierEAST;
		scene_state=2;
sleep 1;
		systemChat "Defend the Base!";
sleep 4;
		systemChat "WAVE 1 INCOMING";
		waveNUM=1;
		};

	if (scene_State==2) exitWith {
waveNUM=waveNUM+1;

if (waveNUM==2) exitWith {
		baseMARK2 call MMF_fnc_soldierEAST;
		baseAREA2 call MMF_fnc_soldierEAST;
		systemChat "Defend the Base!";
systemChat "WAVE 2 INCOMING";};

if (waveNUM==3) exitWith {
		baseAREA1 call MMF_fnc_soldierWEST;
		baseMARK1 call MMF_fnc_coverTRAP;
		baseMARK2 call MMF_fnc_soldierEAST;
		baseAREA2 call MMF_fnc_soldierEAST;
		systemChat "Reinforcements inbound!";
		systemChat "WAVE 3 INCOMING";

};

if (waveNUM==4) exitWith {"Success!" call BIS_fnc_endMission;};
	};

The mission above is contained within a function and can be spawned any time.

and a link for the V2 preview.

  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites
4 hours ago, black_hawk_mw2_87 said:

- We all know I can simply place enemy units... and even if I use waypoints, they will be very predictable and I will almost always know their possible location and position.

EDIT:  I just re-read the top post, and I don't think you were asking for a WAVE assault, so if that's true, you can totally ignore my suggestion below!  Haha.

 

To achieve all your goals, Wogz's code sounds great.

 

However, it is relatively simple to create a very randomized wave assault mission using editor placed groups, waypoints, and a time-release loop.  Like this:

  • Place 6 assault groups around the town and name the groups g1,g2,g3,g4,g5,g6.
  • Create series of waypoints for each group leading them to center of town (or wherever you want them to attack).
  • The first waypoint for each should be close to group's starting position and contain this code in the waypoint:  
this lockwp true;

lockwp true will force units to stop moving and wait until lockwp = false.

  • Make all the intermediate waypoints that move the assault groups to town center have a placement radius of 200 or 300.  This will guarantee their exact path differs each run.
  • To start the wave assault, run a script like the following.  It could be in your init.sqf or a trigger.
assaultGroups = [g1,g2,g3,g4,g5,g6] call BIS_fnc_arrayShuffle;   // randomize order of assault groups
sleep 30; // Sleep however long you want before starting first group moving
{
	_x lockwp false;   // start group moving through their waypoints
	sleep (100 + random 100);  // randomize delay time between starting each wave/group
} forEach  assaultGroups;

I created a mission with this approach where I had assault groups coming by sea to a beach landing, and multiple land groups (infantry, mechanized infantry, and armor).  It worked very well and was very re-playable and unpredictable, because :

  • Order in which groups/waves attack is randomized
  • Exact path each group follows is randomized by waypoint placement radius
  • Time between releasing each wave is randomized
  • When group's combat AI takes over, they are reacting to enemy presence and no longer following waypoints.

Hope that helps.  Good luck.

  • Like 3
  • Thanks 2

Share this post


Link to post
Share on other sites

when programmers try to dance,

call BIS_fnc_arrayShuffle;

Thanks @johnnyboy that's a useful function.

  • Like 3

Share this post


Link to post
Share on other sites

T H A N K   Y O U!!! This tutorial and the other idea are really helpful. I am thankful for your response, friends, and I appreciate your help and support. This is important to me and I am thinking to create a huge scenario of a city under siege or may be even a whole campaign on the Polish map Jaslo. It is an incredible map and it is worth it! 🙂 Cheers! 🙂

  • Like 3

Share this post


Link to post
Share on other sites

Finally just to be clear , your intention is to create a defend mission ?

Or just spawn some units on random in a marker ?

Share this post


Link to post
Share on other sites
2 minutes ago, GEORGE FLOROS GR said:

Finally just to be clear , your intention is to create a defend mission ?

Or just spawn some units on random in a marke

Thank you for joining the discussion. My intention is to achieve both goals - spawn enemy groups in different and dynamic (random) locations, for example when a trigger is fired, in order to place them on defensive positions. I need them to be at a different place in a marked area, for example within a marker area, but not knowing where they'd appear on my next approach to the objective. This would bring in immersion and different experience every time I play the scenario. 😉

  • Thanks 1

Share this post


Link to post
Share on other sites

This can be done with many ways and there are several spawn scripts about it.

Have you ever tried any ?

Share this post


Link to post
Share on other sites
3 minutes ago, black_hawk_mw2_87 said:

Thank you for joining the discussion. My intention is to achieve both goals - spawn enemy groups in different and dynamic (random) locations, for example when a trigger is fired, in order to place them on defensive positions. I need them to be at a different place in a marked area, for example within a marker area, but not knowing where they'd appear on my next approach to the objective. This would bring in immersion and different experience every time I play the scenario. 😉

And may be one more thing. I am not completely sure which way would be easier - set up different enemy groups with prepared waypoints moving in to the objective as a defensive task or simply use some kind of spawning trick. What would you say about this? 😉

  • Like 2

Share this post


Link to post
Share on other sites

The whole thing is what exacly you want to do , using the editor or using scripts.

  • Like 2

Share this post


Link to post
Share on other sites

Personally i don't use the 3editor at all.

I like to build missions that can be played automatically in any map.

  • Like 2

Share this post


Link to post
Share on other sites
4 minutes ago, GEORGE FLOROS GR said:

This can be done with many ways and there are several spawn scripts about it.

Have you ever tried any ?

To be honest - I think I haven't. I have tried different ideas, but not very successfully. I have a script where the first prepared group is completely wiped out and when this condition is checked, the same type of units (the exact same group) spawns on the same position and follows the already existing waypoints, but this location should be at least 200m away from the player, according to this concrete and specific script.

  • Like 1

Share this post


Link to post
Share on other sites
2 minutes ago, black_hawk_mw2_87 said:

according to this concrete and specific script.

 

You should add your script in a spoiler ( code ) to have a check.

I remember that wogz added a script about creating enemy zones , maybe i posted something as well.

I have also create some similar scripts , but to be honest i was about to tell you about EOS or Dac script or Pierre's MGI modules etc.

  • Like 3

Share this post


Link to post
Share on other sites
6 hours ago, GEORGE FLOROS GR said:

I found in my files the +GF_Zone_Spawner.Stratis.zip

if you want to have a check . [ SP/MP ]

Expires in: 29 days 21:56:16   |   Size: 19.7 KB   | 10.10.19

Thank you very much again! I will give it a shot, dude! 🙂 It seems to me I need to make a lot of changes as I intend to use these spawning forces for defense. I tested the scenario this morning and it looks quite intriguing. 🙂 Cheers! 🙂

  • Thanks 1

Share this post


Link to post
Share on other sites

@black_hawk_mw2_87,

Quote

spawning forces for defense


With the MMF framework you can create a friendly base with services like repair, heal and arsenal simply by placing the blue arrow named baseMARK1. From there you can call configurable groups for defense with waypoints, pin the units in place to hold a position, call configurable vehicles (including a patrol helicopter and tank) or even animate units with a single script line.

We shouldn't have to recreate the function of a "base" each time we sit down to make a new mission. Instead we'll write a shortcut (calling several functions at once with their variables defined) that makes the whole scene appear like magic because then we can just...

 

have fun!

  • Like 3

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

×