jetplane_pete 0 Posted December 11, 2005 Guys hi Putting together a mission, using ECP (current version). I've used Blanco's Ai cover script to anchor loons behind cover without problem. However when adding Fox2 High Dispersion conversion script (for JAM to HD JAM) the cover script starts having problems. Most of the loons who should be kneeling, weapon up now stand and shoulder arms. Any idea what the conflict is or where it might be ? thanks Pete Share this post Link to post Share on other sites
AgentFox2 0 Posted December 12, 2005 Heya, Jetplane. Do you get any errors with this? If so, what do they say? Or does the AI cover script just stop working? There is one function in the init.sqs for the HD conversion script called "FindIndex". Make sure there's not multiples. The only other thing I can think of is that the HDConvAI.sqs script in the HD conversion script adds a killed eventhandler, but I don't think that should be a problem. I can't seem to find Blanco's script, can you show me where I can download it? Share this post Link to post Share on other sites
jetplane_pete 0 Posted December 12, 2005 Fox hi Couldn't find it either so Quote[/b] ]; TRENCH2.0 by Blanco;run the appropriate script section goto (_this select 0) ;Put all units in the group in a crouch position and ungroup each one of them.  ;==================================================================================================== #init _unit = _this select 1 _trig = _this select 2 _grp = group _unit _units = units _grp "_x setbehaviour ""SAFE""" foreach units _grp _c = count _units _i = 0 #cycle _unit = _Units select _i _dir = getdir _unit [_unit] join grpnull ["crouch",_unit,_trig,_dir] exec "AIcover2.sqs" _i = _i + 1 ?_i < _c : goto "cycle" exit ; makes the unit crouch. He will stand when he has to turn. Code is based on Zayfod's AI_cover script. ;===================================================================================================== #crouch _unit = _this select 1 _trigname = _this select 2 _dir = _this select 3 ["scan",_unit,_trigname,_dir] exec "AIcover2.sqs" #crouchloop ?(!someammo _unit) OR (alive _unit && (not canstand _unit OR handshit _unit > 0)):["rmove",_unit] exec "AIcover2.sqs";exit dostop _unit ? not(alive _unit): exit _unit setbehaviour "combat" _unit setcombatmode "yellow" dostop _unit ~1 #getdown ~1 _unit setbehaviour "combat" ~0.1 _unit setunitpos "up" ~2 _unit playmove "combattocrouch" _unit playmove "" ~ (random 5) + 5 goto "crouchloop" ; The unit watches the "mostknown" target in his "targetlist". Priority : knowsabout value. ; When the target is closer the 50m, priority : distance. ;=========================================================================================================================== #scan _unit = _this select 1 _trigname = _this select 2 _dis = 150 _range = 450 _delay = 3 #begin ?(!someammo _unit) OR (alive _unit && (not canstand _unit OR handshit _unit > 0)): exit _dir = _this select 3 _targets = [] _AllLoons = [] {{if (alive _x) then {_AllLoons = _AllLoons + [_x]}} forEach crew _x} forEach list _TrigName _livingloons = [] ~0.5 {if (alive _x) then {_livingloons = _livingloons + [_x]}} forEach _AllLoons _upos = getpos _unit _cposx = _upos select 0 _cposy = _upos select 1 _unit doWatch [_cposx + ((sin _dir) * _dis), _cposy + ((cos _dir) * _dis), 5] {if (_unit knowsabout _x > 0.105) then { _targets = _targets + [_x]}} foreach _livingloons ?count _targets > 0 :  goto "inrange" ~_delay goto "begin" #inrange ?count _targets == 0 : goto "begin" _closetargets = [] {if (_unit distance _x < 50) then { _closetargets = _closetargets + [_x]}} foreach _targets if (count _closetargets > 0) then  {goto "close"} else {goto "known"} #close _close = 0 _y = 0 _closest = 0 #closest _closetarget = _closetargets select _y _d = _unit distance _target ?_d > _close : _close = _d;_closest = _y _y = _y + 1 ?_y < count _closetargets : goto "closest" _pritarget = _closetargets select _closest _unit reveal _pritarget _unit dowatch _pritarget _unit dotarget _pritarget goto "attack" #known _maxkn = 0 _i = 0 _mostknown = 0 #mostknown _target = _targets select _i _kn = _unit knowsabout _target ?_kn > _maxkn : _maxkn = _kn;_mostknown = _i _i = _i + 1 ?_i < count _targets : goto "mostknown" _Pritarget = _targets select _mostknown _unit reveal _pritarget _unit dowatch _pritarget _unit dotarget _pritarget #attack _Cnt = 0 #Attacking _kn = _unit knowsabout _pritarget _dis = _unit distance _pritarget ?!alive _pritarget OR ((_dis > (_range)) AND (_kn < 0.11)) : goto "begin"  ~1 _cnt = _cnt + 1 ?_cnt < 4 : goto "attacking" goto "begin" ;simple script to make the unit move in a random position in a 100m radius ;Executed in the crouch part when the unit got hurt, he will leave his position. ;=============================================================================== #rmove _unit = _this select 1 _unit setunitpos "auto" #moveloop _posx = getpos _unit select 0 _posy = getpos _unit select 1 _unit domove [(_posx) + 50 - random 100,(_posy) + 50 - random 100,0] #moveloop2 ?!alive _unit : exit ?unitready _unit : goto "moveloop" ~5 goto "moveloop2" ;=========================================================================== here's the read me Quote[/b] ]AI_COVER version 2.0By Blanco This script puts units in a defensive crouch position behind windows or obstacles. To execute the script: 1. Set up east/west/resistance present triggers to specify enemy units with the following conditions:- East/West/Resistance present (whichever side is to be considered the enemy of the side using the AIcover script) Once Name : whatever you like. Size and shape to cover the entire mission area Condition : this On Activation : 2. -      Place a group or individual unit on the map (you don’t have to name it) -      Put every unit in the desired position and direction. -      Every unit MUST have “None†in the special menu! 3. Run the script by following parameters : [“initâ€,this, name of the trigger of the enemies] exec “Aicover2.sqs†Example : [“initâ€,this, eastunits] exec “Aicover2.sqs†any help appreciated. As an after thought I'm running JAM3 is this compatable with your HDconvert script ? as this might be the problem. Pete Share this post Link to post Share on other sites
AgentFox2 0 Posted December 12, 2005 Okay, I think I found the problem. All the conversion script does is check the magazines in the unit against one array and switch them out for other magazines from another array. It does this all within a temporary array, and then it sends that array to a final script which removes all the unit's magazines and adds in the new ones. Check out these lines from the cover script: Quote[/b] ]#crouchloop?(!someammo _unit) OR (alive _unit && (not canstand _unit OR handshit _unit > 0)):["rmove",_unit] exec "AIcover2.sqs";exit Quote[/b] ]#begin?(!someammo _unit) OR (alive _unit && (not canstand _unit OR handshit _unit > 0)): exit What must be happening; the conversion script kicks in at the same time as Blanco's, so there's a moment where each unit has no ammo, exiting the cover script. Try adding a delay to the start of Blanco's script, like 2-4 seconds. That will give the conversion script more than enough time to go through all the units and be done before Blanco's script starts. Alternatively, if you execute this from a trigger, you could add a countdown delay in the countdown boxes. Quote[/b] ]As an after thought I'm running JAM3 is this compatable with your HDconvert script ? as this might be the problem. That shouldn't be a problem, JAM3 uses the same classnames as JAM2. Thanks for reminding me that the conversion script needs an update, though. I'll have to get on that. Hope this is the solution to your problem. Share this post Link to post Share on other sites
jetplane_pete 0 Posted December 15, 2005 Fox hi thanks for that, however delaying the AI Cover script means the loons have moved from their set position. I've therefore tried to delay the HD switch by a few seconds. I normally use the following line in a loon init line to convert the entire group. Quote[/b] ]{[_x] exec "FOX2_HDConvAI.sqs"} foreach units rc1 However the syntex does not work when placed in a trigger, or WP. My scripting skills are low so I wondered if you have any idea. Otherwise I'll just have to manually rework the ammo for each unit in the AI cover group. Pete Share this post Link to post Share on other sites
AgentFox2 0 Posted December 15, 2005 The problem with delaying the start of the HD script is that Blanco's ammo check is in a loop, so if you start the HD script at any point after the cover script's initialization, there is a chance that it will exit the cover script. To set up a trigger for the HD conversion script, just make a trigger as big as the town/region your units are in, set it to Anybody (or East/West, depending on who you want to limit the script to) Present, One time execution, and then put this line in the activation box: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">{[_x] exec "FOX2_HDConvAI.sqs"} foreach (units thisList) You can also make another, similar trigger with this activation code to get the cover script guys to stop for a few seconds before executing the script: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">{doStop _x} foreach (units thisList) Hope this helps. Share this post Link to post Share on other sites