Jump to content
Cryonic.

Rally point scripting help needed.

Recommended Posts

I'm trying to create a rally point system that is similar to Squad's, where only the squad leader can place down a rally point if they have at least one squad member in their vicinity and there are no enemies within 50m.

So far, I have it that the squad leader (wsl1) can only place down a rally (wsquadRP1) if they have more than 0 players in their vicinity.

I'd like to limit the nearEntities within 15m to only players in the same group as the squad leader and I think I can use that same method but for detecting if enemies are within 50m, but I'm not sure how.

All assistance is greatly appreciated.

waitUntil {!isNull player};

_unit = _this select 0;

if (wsl1 == _unit) then {_unit addAction ["Deploy Rally Point","_num = player nearEntities ['Man',15];
 if(count _num >0) then {wsquadRP1 SetPos (player modeltoworld [0,3,0])} 
  else {hint 'You need at least one squad member nearby to deploy a Rally Point'}","",1.5,false,true,"","_this == _target"];};

 

Share this post


Link to post
Share on other sites

in initPlayerLocal.sqf

 

player addAction ["Deploy Rally Point", { wsquadRP1 SetPos (player modeltoworld [0,3,0])}
  ,"",1.5,false,true,"","_this == leader group _this && ((units group _this) findIf {_x distance _this < 15}) > -1 "];

 

Nothing more.

Share this post


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

in initPlayerLocal.sqf

 

player addAction ["Deploy Rally Point", { wsquadRP1 SetPos (player modeltoworld [0,3,0])}
  ,"",1.5,false,true,"","_this == leader group _this && ((units group _this) findIf {_x distance _this < 15}) > -1 "];

 

 Nothing more.

Thanks for the reply! Do you know how I could prohibit it from working if an enemy is within 50m?

Share this post


Link to post
Share on other sites

"_this ==leader group _this && {((units group _this) findIf {_x distance _this < 15}) > -1} && { allUnits findIf {side _x getFriend side _this <0.6 && _x distance _this < 50} == -1}"

 

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

×