Jump to content
kronzky

Urban Patrol Script

Recommended Posts

@Josche

you will find the line in the UPS.sqf:

Line 450: _lead setVehicleInit _initstr;

Line 465: _newunit setVehicleInit _initstr;

Share this post


Link to post
Share on other sites

The code part with the now illegal calls is this bit from ups.sqf (calls in green text):

         _lead setSpeedMode _orgSpeed;
       _lead setSkill skill _npc;
       [color=#00ff00]_lead setVehicleInit _initstr;[/color]
       [_lead] join _grp;
       _grp selectLeader _lead;
       // copy team members (skip the leader)
       _c=0;
       {
           _c=_c+1;
           if (_c>1) then {
               _newunit = _grp createUnit [typeof _x, getpos _x, [],0,"form"];
               KRON_cloneindex = KRON_cloneindex+1;
               _newunit setVehicleVarName format["%1%2",_nameprefix,KRON_cloneindex];
               call compile format["%1%2=_newunit",_nameprefix,KRON_cloneindex];
               _newunit setBehaviour _orgMode;
               _newunit setSpeedMode _orgSpeed;
               _newunit setSkill skill _x;
               [color=#00ff00]_newunit setVehicleInit _initstr;[/color]
               [_newunit] join _grp;
           };
       } foreach _members;

Removing these statements will make the script not yield errors. Although not really sure if removing them may destroy the functionality?

Could someone offer some replacement syntax with the new suggested syntax, until Kronzky fixes the script ?

-OP

Edited by Old_Painless

Share this post


Link to post
Share on other sites

a general question on this (fantastic) script. it seems that the patrol would engage you no matter what. would it be possible that patrol would disengage if, for example, only a few of attackers were left, or (ideally) if it took many casualties in a short period of time?

has someone thought about this?

Share this post


Link to post
Share on other sites
a general question on this (fantastic) script. it seems that the patrol would engage you no matter what. would it be possible that patrol would disengage if, for example, only a few of attackers were left, or (ideally) if it took many casualties in a short period of time?

has someone thought about this?

sure enough this was implemented in upsmon

http://forums.bistudio.com/showthread.php?147808-UPSMON-for-arma3

Share this post


Link to post
Share on other sites

Thanks for the great script! I tested it but it seems that you need to be in a group with at least one of the AI for them to consider you friendly. Is this because of the "brute force" method you meant in the script itself? Any suggestions to remedy? Perhaps one can declare "players" friendly if they are on the same faction as the AI instead?

Edited by Hubrisza

Share this post


Link to post
Share on other sites

its an incredible script! I love it

it seems, however that the AI attack the player on a hap-hazard, 1 soldier will break off and engage (I know thats a specific command the AI squad leader does)

is it any way possible to split the group into fireteams (yet remain coherent with the squad leader) and they attack as a whole, (ie: 4 men assault a position, by moving very closely together, like a genuine CQB tactics)

secondly what does the "randomup" optional command do? I believe it places soldiers in buildings, (on the roof), but I've yet to see the AI placed there. can anyone direct me as to what I should do?

otherwise, its an incredible script!

Share this post


Link to post
Share on other sites
it seems, however that the AI attack the player on a hap-hazard, 1 soldier will break off and engage (I know thats a specific command the AI squad leader does)

is it any way possible to split the group into fireteams (yet remain coherent with the squad leader) and they attack as a whole, (ie: 4 men assault a position, by moving very closely together, like a genuine CQB tactics)

Any attacks and formation behavior are controlled the engine — my script doesn't intervene there at all. (Those behaviors might still be work-in-progress, considering that A3 is still in Beta).

secondly what does the "randomup" optional command do? I believe it places soldiers in buildings, (on the roof), but I've yet to see the AI placed there. can anyone direct me as to what I should do?

Yes, it will place some units on roofs, but only if they can be reached via ladders. So if there are no accessible rooftops around, then they will all stay on the ground.

As far as the error is concerned, that was reported above — looks like BI removed the setVehicleInit command. My script was using that to process INIT strings, so I've removed that capability for now. I might re-add it at some later point, once I find a workaround, but for now it's disabled, to avoid the error popup.

New version is here: http://kronzky.info/ups

Share this post


Link to post
Share on other sites

Hi Kronzky

I've been using this wonderful script in A3 for a few weeks and it works very well. Unfortunately the latest beta dev build has broken this script (and quite a few others I might add).

If I have an area set up to patrol, called "areaname", then the following error is thrown:

'KRON_Trgflag = |#|Kron_Trg_WEST_areaname'

Error undefined variable in expression: kron_trg_west_areaname

Hope this helps

EDIT:

These single quotes (in red) seem to have fixed it:

Line 488: call compile format["KRON_TRGFlag='%1'",_trgname];

Edited by tpw

Share this post


Link to post
Share on other sites
Hi Kronzky

I've been using this wonderful script in A3 for a few weeks and it works very well. Unfortunately the latest beta dev build has broken this script (and quite a few others I might add).

If I have an area set up to patrol, called "areaname", then the following error is thrown:

'KRON_Trgflag = |#|Kron_Trg_WEST_areaname'

Error undefined variable in expression: kron_trg_west_areaname

Hope this helps

EDIT:

These single quotes (in red) seem to have fixed it:

Line 488: call compile format["KRON_TRGFlag='%1'",_trgname];

Thanks!

Share this post


Link to post
Share on other sites
Hi Kronzky

I've been using this wonderful script in A3 for a few weeks and it works very well. Unfortunately the latest beta dev build has broken this script (and quite a few others I might add).

If I have an area set up to patrol, called "areaname", then the following error is thrown:

'KRON_Trgflag = |#|Kron_Trg_WEST_areaname'

Error undefined variable in expression: kron_trg_west_areaname

Hope this helps

EDIT:

These single quotes (in red) seem to have fixed it:

Line 488: call compile format["KRON_TRGFlag='%1'",_trgname];

What you did removed the error. Good temporary fix. But the variable KRON_TRGFlag is meant to hold a Trigger (Sensor) not a string containing the name of the trigger's variable.

try this instead starting around line 485

...
   // has the trigger been created already?
   KRON_TRGFlag=-1;
   call compile format["%1=false",_flgname];
   call compile format["if (isNil {%1}) then {KRON_TRGFlag=-1;} else {KRON_TRGFlag=%1};",_trgname];
   if (typeName KRON_TRGFlag == "SCALAR" && {KRON_TRGFlag == -1}) then {
       // trigger doesn't exist yet, so create one (make it a bit bigger than the marker, to catch path finding 'excursions' and flanking moves)
       call compile format["%1=createTrigger['EmptyDetector',[_centerX,_centerY]];",_trgname];
...

Let me know if I'm going the wrong way...

regards,

Holo.

Edit1: looking at my code again, I tend to make things complicated... but it does work. If someone else want to simplify?

Edited by holo89
not sure

Share this post


Link to post
Share on other sites
What you did removed the error. Good temporary fix. But the variable KRON_TRGFlag is meant to hold a Trigger (Sensor) not a string containing the name of the trigger's variable.

try this instead starting around line 485

...
   // has the trigger been created already?
   KRON_TRGFlag=-1;
   call compile format["%1=false",_flgname];
   call compile format["if (isNil {%1}) then {KRON_TRGFlag=-1;} else {KRON_TRGFlag=%1};",_trgname];
   if (typeName KRON_TRGFlag == "SCALAR" && {KRON_TRGFlag == -1}) then {
       // trigger doesn't exist yet, so create one (make it a bit bigger than the marker, to catch path finding 'excursions' and flanking moves)
       call compile format["%1=createTrigger['EmptyDetector',[_centerX,_centerY]];",_trgname];
...

Let me know if I'm going the wrong way...

regards,

Holo.

Edit1: looking at my code again, I tend to make things complicated... but it does work. If someone else want to simplify?

Cool, I'm glad someone has their thinking cap on! I didn't give much more thought because the errors went away and the script seemed to function, so I'm glad you've delved deeper.

Share this post


Link to post
Share on other sites

holo89 thanks for that. Seems to work with no errors showing. One thing, noticed they appear to be stuck in combat mode?

Share this post


Link to post
Share on other sites

on my side I had to remove UPS, they were not shooting at all. I use BIS scripts meanwhile, I have so much to fix, it keeps spamming the log and screen. When I have more time, if Kronzky did not find before me, I'll take a deeper look.

regards,

Holo.

ps: right now, I'm taking more sun, and looking at my code with my iPad outdoor. That's real life! :-)

Share this post


Link to post
Share on other sites

Hello, I went back to UPS from UPSMON since i only need the patrol part and it seems to work better =)

but i get the following error:

Error in expression <KRON_TRGFlag=KRON_Trig_EAST_kamino>
 Error position: <KRON_Trig_EAST_kamino>
 Error Undefined variable in expression: kron_trig_east_kamino

I have a few units set to patrol the marker "kamino" using: nul=[this,"kamino","nowait"] execVM "ups.sqf"

Share this post


Link to post
Share on other sites
Hello, I went back to UPS from UPSMON since i only need the patrol part and it seems to work better =)

but i get the following error:

Error in expression <KRON_TRGFlag=KRON_Trig_EAST_kamino>
 Error position: <KRON_Trig_EAST_kamino>
 Error Undefined variable in expression: kron_trig_east_kamino

I have a few units set to patrol the marker "kamino" using: nul=[this,"kamino","nowait"] execVM "ups.sqf"

Come on man, it is on the previous page...

What you did removed the error. Good temporary fix. But the variable KRON_TRGFlag is meant to hold a Trigger (Sensor) not a string containing the name of the trigger's variable.

try this instead starting around line 485

...
   // has the trigger been created already?
   KRON_TRGFlag=-1;
   call compile format["%1=false",_flgname];
   call compile format["if (isNil {%1}) then {KRON_TRGFlag=-1;} else {KRON_TRGFlag=%1};",_trgname];
   if (typeName KRON_TRGFlag == "SCALAR" && {KRON_TRGFlag == -1}) then {
       // trigger doesn't exist yet, so create one (make it a bit bigger than the marker, to catch path finding 'excursions' and flanking moves)
       call compile format["%1=createTrigger['EmptyDetector',[_centerX,_centerY]];",_trgname];
...

Let me know if I'm going the wrong way...

regards,

Holo.

Edit1: looking at my code again, I tend to make things complicated... but it does work. If someone else want to simplify?

Share this post


Link to post
Share on other sites

Tried the script now, and it works alright.

biggest issue is that they are stuck in combat mode (as others already reported).

apart from that I have only seen that helis dosn't seem to respond to the "nowait" command, but maybe those are related.

Share this post


Link to post
Share on other sites

Read somewhere that you have to link each group to a different marker to avoid being stuck in combat mode. Didnt test it, but its worth a try?

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

×