Jump to content
Antman2o1o

Trying to get this script to work Any help appreciated Stuck

Recommended Posts

Hey folks I am working on a script below and I am not a very skilled coder especially working with arrays and subtracting locations from an array. The main goal would be to have the script trigger a nuke blast in a set time limit with various blast radiuses in a loop. Ideally, I would like to drop a map marker on the location of the blast that is removed after a certain amount of time but just trying to get this working with what I got now.

 

So here goes....At the end of the day, the script should select from a random location for the nuke blast defined by possible locations listed in the array named "nukeme"  then remove whatever location it used from the array list so it does not trigger in the same place twice. The triggered nuke blast script should run every 3000 seconds in random locations. So I have a basic understanding of what it does or needs to do not sure if my syntax is correct or even in the ballpark.

 

As always any help appreciated and I am in no way a skilled coder.

 

Script below

if ((!isServer) && (player != player)) then {waitUntil {player == player};};
while {true} do {
_location = selectrandom possiblelocations;
possiblelocations = [nukeme, nukeme1, nukeme2,nukeme3,nukeme4,nukeme5,nukeme6],-_location; /*to make sure one location is not used twice*/
[_location,nukeme,nukeme,nukeme1,nukeme2,nukeme3,nukeme4,nukeme5,nukeme6] execvm "Al_Nuke\alias_nuke.sqf";
place marker;
sleep 3000+random 1000;
}

 

Share this post


Link to post
Share on other sites

if locations are markers, don't forget the quote! If not, are your locations created locations?

It's easy to pick an element of an array and delete it in this array at the same time.

0 = [] spawn {

  possiblelocations = ["nukeme", "nukeme1", "nukeme2","nukeme3","nukeme4","nukeme5","nukeme6"];

  while {true} do {

     private _location = possibleLocations deleteAt (floor random count possibleLocations);

     ..... code with the   _location, i.e. :    _location execVM "some.Sqf"

     sleep 3000;

  };

};

 

Share this post


Link to post
Share on other sites

Pierre thank you for the response would the code look like this?  ..... Yes the ""nukeme"" are empty map markers named nukeme, nukeme1 etc... How would the blast size be defined?

Will this code work on a dedicated server for multiplayer?

 

0 = [] spawn {

  possiblelocations = ["nukeme", "nukeme1", "nukeme2","nukeme3","nukeme4","nukeme5","nukeme6"];

  while {true} do {

     private _location = possibleLocations deleteAt (floor random count possibleLocations);

    [_location,nukeme,nukeme,nukeme1,nukeme2,nukeme3,nukeme4,nukeme5,nukeme6] execvm "Al_Nuke\alias_nuke.sqf";

     sleep 3000;

  };

};

Share this post


Link to post
Share on other sites

The answer is on alias side... I guess that can't work at all as I don't understand your [_location,nukeme,nukeme,nukeme1,nukeme2,nukeme3,nukeme4,nukeme5,nukeme6] execvm "Al_Nuke\alias_nuke.sqf";

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

×