Jump to content
Sign in to follow this  
ChaIie

How to loop a script

Recommended Posts

Hello,

 

First of all, im a complete newbie to scripts so please understand that i can't write anything by my own.

 

My problem is, i got this script from another topic 

_null = this spawn {
Hunt_players_fnc = {
    _player = "";
    {
        if (isPlayer _x AND alive _x) then {_player = _x};
    } foreach (playableUnits + switchAbleUnits);
    _wp = _this addWaypoint [getPos _player, (50 + (floor(random 200)))];
    _wp setWaypointStatements ["true", "_null = (group this) spawn Hunt_players_fnc;"];
    _wp setWaypointType "SAD";
    _wp setWaypointCombatMode "RED";
    _wp setWaypointSpeed "FULL";
};

_null = (group _this) spawn Hunt_players_fnc;
};

When i put this into the init from a enemy, they start to go to my position, but only to the spawn position. Mean's when i walk away from my spawn, the enemy just sits on my spawn and doesn't follow me. Is it possible to somehow make the script loop itself so the enemy always gets a new waypoint? or are there any other tricks how to make a enemy (for instance 1 heli) follow/hunts me where ever i go?

 

I also saw some posts about stalker and reveal ( https://community.bistudio.com/wiki/BIS_fnc_stalk & https://community.bistudio.com/wiki/reveal )

but i really do not have any idea what to do here with them like the example says " _stalking = [BIS_grpStalkers, BIS_grpPlayer] spawn BIS_fnc_stalk;  " .. but i dont know what it what and how to make them work.

 

I can't script 😥

 

Thank's for any help.

 

Share this post


Link to post
Share on other sites

That script is kind of broken. Or at least it doesn't do what the original author thought it might.

 

https://community.bistudio.com/wiki/BIS_fnc_stalk is a native function that makes one group of AI stalk another group of units (AI or player). 

 

You would be better off just asking how to do what you want to do. So, what do you want to do, specifically?

 

 

  • Like 1

Share this post


Link to post
Share on other sites
8 hours ago, Harzach said:

That script is kind of broken. Or at least it doesn't do what the original author thought it might.

 

https://community.bistudio.com/wiki/BIS_fnc_stalk is a native function that makes one group of AI stalk another group of units (AI or player). 

 

You would be better off just asking how to do what you want to do. So, what do you want to do, specifically?

 

 

Thank you for the reply. 

I really think that  [BIS_fnc_stalk] is what i looking for but i have no idea how to script it correctly.

What i wanting to do is this scenario: A set of enemeys (Planes, Heli, tanks and infantery) starting on one side of an Island, they are also synced to a MGI ADVANCED MODULES system so they can respawn. And what i would like to have is that they start chasing me in combat mode (or Seek And Destroy) . But here is the problem, with the first script which doesnt want to work properly, they only go to my spawnposition and stay there. 

And now with the BIS_fnc_stalk , i have no idea how to make it work. when i use this 

_stalking = [BIS_grpStalkers, BIS_grpPlayer] spawn BIS_fnc_stalk;

into the init of the enemy, they dont do anything. What do i have to do else? 

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  

×