Home   Help Search Login Register  

Author Topic: Enable AI + Trench pack  (Read 7489 times)

0 Members and 1 Guest are viewing this topic.

bdfy1

  • Guest
Re:Enable AI + Trench pack
« Reply #15 on: 28 Jul 2005, 22:29:44 »
Quote
I wouldn't mind if they just rearm without moving first...
Some kind of cheat ? :) Simple addmagazine ?
OK, the only thing I'm still worried about is extra unit spawning bug. I think it's fixed.As soon as you  confirm this - I'll upload it all to the ed. depot.

Offline Blanco

  • Former Staff
  • ****
Re:Enable AI + Trench pack
« Reply #16 on: 28 Jul 2005, 23:17:26 »
No, not via addmagazine...
They will rearm when you give them the rearm action, but they won't move to the ammobox. It's like the "hidebody" action from a SpecialOps, when you use it on a body miles away it still sinks into the ground. Actually a nice way to remove bodies...   :P

Maybe you can force him to run back to his position by a switchmove command that makes him run forward, you just have to find the compasheading between ammobox an unit and after he rearmed between unit and trenchposition (with dirtoobj.sqf)
Then slew him in the right direction. (I never tried it before)
I think they did something like that with the rappelscript, the officer  rappels down, moves forward via switchmove, chrouches and all the other lay down in a perimeter around the chopper.
But it all depends how far the ammobox is from the unit...
How many switchmoves are needed before the unit is in the right place?
 
 Otherwise, it won't be cheating, when the missionmaker don't put a ammobox on his map, there is simply no ammo support. Maybe you can make the ammobox param optional?

Anyway...
Code: [Select]
_unit = _this select 0
_mag = _this select 1

_unit action ["take magazine",ammobox,0,0,_mag]
~1
_unit action ["take magazine",ammobox,0,0,_mag]
exit

This works, I tried it. But he will take his magazines from where he's standing.
That's the most reliable way imo and you don't have to use enableAI.sqf.
Quote
OK, the only thing I'm still worried about is extra unit spawning bug. I think it's fixed.As soon as you  confirm this - I'll upload it all to the ed. depot.

AFAIK you and I are the only guys betatesting this baby here, so I would wait a while, maybe other bugs show up.
« Last Edit: 29 Jul 2005, 01:45:39 by Blanco »
Search or search or search before you ask.

Offline Blanco

  • Former Staff
  • ****
Re:Enable AI + Trench pack
« Reply #17 on: 29 Jul 2005, 07:35:08 »
Hey mate I've found a bug that ruins it all...

Simply save your game and you will see....everybody's doing his own thing again...  >:(

This is what I do :

:gunman: SAVEGAME

It's not the first time I'm running in this shit.
And know the cause...

put :

this disableAI "move"

...in a unit's init, save the game and look  
he's running again :)
An easier way to enableAI no?
I'm gonna play cards again...or wait for OFP AA

« Last Edit: 29 Jul 2005, 07:42:07 by Blanco »
Search or search or search before you ask.

bdfy1

  • Guest
Re:Enable AI + Trench pack
« Reply #18 on: 29 Jul 2005, 12:23:33 »
Hm... bad news. But also interesting feature :)
The only solution I see is not to use standart savegame or console command ( I wonder how to force player not to use them...)- instead script through radio menu :

savegame
"_x disableAI ""move""" foreach [array of units]

 

Offline Blanco

  • Former Staff
  • ****
Re:Enable AI + Trench pack
« Reply #19 on: 29 Jul 2005, 13:25:35 »
Yup, I guess that's the only thing you can do about it.
It's not completely safe because when a unit is selected to be the new M2 gunner and he's on his way during a savegame, DisableAI "move" will make him stop doing that.
So you'll need an array with only trenched units, not from those who are somewhere else.
That array can't be just the living units in the group because some of them are not the original you've started with.
Or is the new created unit returned correctly with enable.sqf?

An idea...
Maybe you could unjoin the selected M2 gunner?
And when he boards the M2gun join him again to the trenchgroup.
Maybe he will man the gun quicker , because during that time he's alone and he can't receive targeting orders from his groupleader



 
« Last Edit: 29 Jul 2005, 13:34:59 by Blanco »
Search or search or search before you ask.

bdfy1

  • Guest
Re:Enable AI + Trench pack
« Reply #20 on: 29 Jul 2005, 14:15:17 »
Quote
Or is the new created unit returned correctly with enable.sqf?
Yes, it is. You will only loose special name if you give one ( smth like unit1 etc ) - function returns smth like "Alpha Black 1"  - the same name like before Ai enabled.
Quote
Maybe you could unjoin the selected M2 gunner?
seems to be a piece of good idea..
I'll try it.



bdfy1

  • Guest
Re:Enable AI + Trench pack
« Reply #21 on: 29 Jul 2005, 14:46:00 »
Quote
SAVEGAME
fixed :D
Am I good, am I good ...:)
I just had to loop disableAI command. And all stuff works corretly cause
enableAI.sqf replaces unit.
 




Offline Blanco

  • Former Staff
  • ****
Re:Enable AI + Trench pack
« Reply #22 on: 31 Jul 2005, 08:39:39 »
No problems found so far.

What's the purpose of all those captive scripts and the findunits.sqf ?
It looks like you are trying to add some other features :)

You should disgroup the gunner before he enters the M2, I tried it and he's doing his job much quicker.
He just turns a round a bit when he aproaches the entrance of the bunker, but that's not the scripts fault. That just bad AI pathfinding.

At the end of MGman.sqs

Code: [Select]
...
#Bottom
_gunnertemp = _units select _closestUnitN
?(_gunnertemp==player):goto "top"
;player groupchat format ["_gunner %1",_gunnertemp]
_gunnertemp setunitpos "up"
~1
_gunner = [_gunnertemp] call enableAI
_grp = group _gunner
~0.5
[_gunner] join grpnull
_gunner assignAsGunner _gun
[_gunner] orderGetIn TRUE

#lifecheck1
?gunner _gun == _gunner : goto "join"
?(!alive _gunner):goto "top"
~1
goto "lifecheck1"

#join
[_gunner] join _grp

#lifecheck2
?(!alive _gunner):goto "top"
~1
goto "lifecheck2"

..and he's doing what he has to do, no questions asked. :)
Last test was 64 74 88 dead yankees, my M2 ran out of ammo :p

Oh, how are gonna get that ammobox variable in the reammoscript? You can't initialise variables in a EH script...  :-\

 
 

« Last Edit: 31 Jul 2005, 15:46:28 by Blanco »
Search or search or search before you ask.

Offline Blanco

  • Former Staff
  • ****
Re:Enable AI + Trench pack
« Reply #23 on: 31 Jul 2005, 15:39:40 »
Code: [Select]
Not fully tested but I think there could be a problem with the reammo script.

It's a bit complex... lets say _mag is "m16"
When a unit runs out of ammo (no mags anymore for his primaryweapon) and you debug for his magazines you will see there's still an m16 mag in the first position of his magazines array.
Thats kind of weird because he shouldn't have any magazines anymore. I've tested this without any scripts running and it seems to be normal.  :P

When he rearms, the remaining m16 mag is removed from his first position and all the new m16 mags will fill the array at the end.
Now when he rearms a first time there is no problem, because :

Code: [Select]
_mag = _magazines select 0
...is still "m16", but the second time he rearms _mag will be "handgrenade" and he will only take nades from the crate.

I wish there was something like :

Code: [Select]
_mag = magazine (primaryweapon _unit) :P+

*edit*

Oh, yes baby!
Fixed! , I never thought this would work but it does!

Code: [Select]
_unit = _this select 0
_mag = _this select 1
_unit setunitpos "up"
_magazines = magazines _unit

~2
_unit = [_unit] call enableAI
[_unit,1,1] exec "AI\captive.sqs"
_pos = getpos  _unit
_unit domove (getpos ammobox)
@unitReady _unit
_unit action ["take magazine",ammobox,0,0,_mag]
~4
_magazines set [0,_mag]
_unit action ["take magazine",ammobox,0,0,_mag]
~4
_magazines set [1,_mag]
_unit action ["take magazine",ammobox,0,0,_mag]
~4
_magazines set [2,_mag]

hint format ["%1",_magazines]
_unit domove _pos
@unitReady _unit
["cover",_unit,"crouch"] exec "AI\AIcover.sqs"  
exit

Ghaaaa, the set command...




« Last Edit: 31 Jul 2005, 16:01:57 by Blanco »
Search or search or search before you ask.

bdfy1

  • Guest
Re:Enable AI + Trench pack
« Reply #24 on: 01 Aug 2005, 10:12:47 »
10x for feedback :beer:
I implemented  your ideas. works great.
 
Quote
What's the purpose of all those captive scripts
there're not so many AI scripts  - I just want  to make them all worky with AIcover3. It's easy just enableAi in suitable place:)
Quote
how are gonna get that ammobox variable in the reammoscript?
I'm pretty sure it's possible. Look for "Using format to pass additional info to event handler" by GB.
http://www.ofpec.com/yabbse/index.php?board=8;action=display;threadid=17724
But I only managed to pass ammobox as string :(
See attachment.  

Offline Blanco

  • Former Staff
  • ****
Re:Enable AI + Trench pack
« Reply #25 on: 01 Aug 2005, 12:47:41 »
OK, I'll try it when I'm back home.

I've found a tiny glitch in the enableAI.sqf
Code: [Select]
...
"_unitN addweapon _x" foreach _weapons;
"_unitN addMagazine _x" foreach _ammo;

You should add the ammo first or the unit has to reload first... :)


« Last Edit: 01 Aug 2005, 12:48:31 by Blanco »
Search or search or search before you ask.

Offline Blanco

  • Former Staff
  • ****
Re:Enable AI + Trench pack
« Reply #26 on: 03 Aug 2005, 01:06:57 »
I did a 2man MPCoop test on a non dedi server, but I can't say much because it was just a quick test...

We were both on the east side in the trenches. When the battle started the men fought normal, but my client saw the M2 on the ground instead of 2 m high.
He saw 2 dead soldiers in the bunker so I suppose the mgman script worked, but when I tried it alone in MP the mgman script didn't work.  :(
Someone was ordered to man the M2, but nobody did.
As I say, it was a very quick test, it needs lots of more MPtesting.

Also I've made a sandbag addon (BIS woodfence but with modifed config) that doesn't crumple when destroyed, so you don't have to use the fence script anymore.
http://users.telenet.be/blanco/BL_sandbag.pbo


 
 



« Last Edit: 03 Aug 2005, 01:19:49 by Blanco »
Search or search or search before you ask.

bdfy1

  • Guest
Re:Enable AI + Trench pack
« Reply #27 on: 03 Aug 2005, 01:49:22 »
2Blanco
Quote
Also I've made a sandbag addon
OK, then I will expand it with several more stable anims ( I need just a few for the script ) from ICP or Sanctuary pack.

Offline Blanco

  • Former Staff
  • ****
Re:Enable AI + Trench pack
« Reply #28 on: 03 Aug 2005, 09:32:23 »
I won't use those from ICP.
They look great but with ICPanims the unit is stuck in the animation and he can't use his grenades anymore. Grenadiers will never use their grendelauncher,, LAW / RPG soldiers will never fire one rocket...

There is also  sandbag in a corner in the objects menu, can you add that one too?
 
 
Search or search or search before you ask.

UNN

  • Guest
Re:Enable AI + Trench pack
« Reply #29 on: 03 Aug 2005, 12:09:39 »
Quote
They look great but with ICPanims the unit is stuck in the animation and he can't use his grenades anymore.

I was wondering about these locked animations, if you dont add:

Code: [Select]
interpolateTo[]={CrouchDying,0.1};
To the anim, the guy will not collapse when he's killed. I wondered if you could add the grenade anim:

Code: [Select]
interpolateTo[]={CrouchDying,0.1,CombatThrowGrenadeStart,0.1};
Then he would throw a grenade when told to by the engine?

Well just a guess, not had chance to test it yet.