Jump to content
SS-310

Random structure selection

Recommended Posts

Im trying to make a mission where each playthrough will have a different set of structures in different locations. Im not quite sure how to go about doing that.

 

For instance, I have a camp that can have 2 possible locations to spawn in. I figure simply despawning the one that wasnt selected would be best, but I dont know how to do that without having to give every single piece a variable name and a deleteVehicle command, and I dont really want to do that lol.

 

Another thing I want to do is select say 2 objectives from a pool, and only spawn those two without choosing the same one twice. I dont know where to even begin with that one. Any help would be greatly appreciated, thanks

Share this post


Link to post
Share on other sites

You can delete or hide objects in an area (radius from a marker, a trigger, a location or even coordinates)

finding edited houses, trees but not the native map ones.
{_x hideObject TRUE} forEach (nearestObjects [thisTrigger, ["house","building","trees"],500] - nearestTerrainObjects [thisTrigger, ["house","building","trees"],500]);

 

You can also:

{_x hideObject TRUE} forEach (allMissionObjects "house" select {_x inArea thisTrigger});

or delete them...

 

selecting 2 different (anything) among multiple:
 

data = ["aa","bb","cc","dd","ee","ff","gg"];
pick2 = [];
for "_i" from 0 to 1 do {pick2 pushBack  (data deleteAt floor random count data)};

 

  • Like 1

Share this post


Link to post
Share on other sites
19 hours ago, pierremgi said:


 


data = ["aa","bb","cc","dd","ee","ff","gg"];
pick2 = [];
for "_i" from 0 to 1 do {pick2 pushBack  (data deleteAt floor random count data)};

 

I can choose 2 and im using hint to see what it chose, but now im not sure how to make the variables inside the pick2 array true. I want to use that hideObject command to hide the chosen variables. When I try pick2= true; nothing happens. Ideas?

Share this post


Link to post
Share on other sites
2 hours ago, SS-310 said:

 im not sure how to make the variables inside the pick2 array true. I want to use that hideObject command to hide the chosen variables.

Not sure to understand what you mean. Variables are objects (you can hide) or boolean TRUE FALSE,  not both.

So, if "objectives" (I don't know what you are referring (tasks?)) are linked to objects you need to hide or show, you can make an array of arrays like :

data = [[task1, trig1],[task2,trig2],...];

then obtain two of them  say

pick2 = [[task6,trig6],[task3,trig3]];

then:

enable task6  (pick2 select 0 select 0)

enable task3 (pick2 select 1 select 0)

hideObject (false or true) from trigger6 (pick2 select 0 select 1) and from trigger 3 (pick2 select 1 select 1)

 

If I guess what you want.

 

Share this post


Link to post
Share on other sites
17 minutes ago, pierremgi said:

Not sure to understand what you mean. Variables are objects (you can hide) or boolean TRUE FALSE,  not both.

So, if "objectives" (I don't know what you are referring (tasks?))

I can try and elaborate.

 

I have triggers named say trig1 - 5 with this in their activation: {_x hideObject TRUE} forEach (allMissionObjects "all" select {_x inArea thisTrigger});

 

then I have data = [trig1...trig 5];

 

pick2 = [ ];

 

for "_i" from 0 to 1 do {pick2 pushback (data deleteAt floor random count data)};

 

What I want to do is activate the 2 triggers that were selected.

17 minutes ago, pierremgi said:

 

 

Share this post


Link to post
Share on other sites
27 minutes ago, SS-310 said:

I can try and elaborate.

 

I have triggers named say trig1 - 5 with this in their activation: {_x hideObject TRUE} forEach (allMissionObjects "all" select {_x inArea thisTrigger});

 

What I want to do is activate the 2 triggers that were selected.

 

 

So, just:

data = [trig1...trig 5];
say pick2 = [trig 5, trig3];

condition for each trigger (add other conditions if needed):

thisTrigger in pick2

on act:

{_x hideObject TRUE} forEach (allMissionObjects "all" select {_x inArea thisTrigger});

 

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

×