Home   Help Search Login Register  

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

0 Members and 1 Guest are viewing this topic.

bdfy1

  • Guest
Enable AI + Trench pack
« on: 26 Jul 2005, 21:36:37 »
In my Liberation mod mission I wanted to use aicover and manMG scripts.
But I had to modify them to achieve better results.
Instead of disgrouping units in cover script I used disableAI (this is not the only change :))  
It wors perfectly , but of course  troubkes  appeare with manMG :)
I see to ways:
1.Anyway (for othe purposes)  I need "enableAI"  script :) I made function: simply delete unit and then create the same ( the same type, group,weapons, ammo ( to magazine )),created unit is returned. The problem is that units are a bit dull - their way to MG is a bit strange... ingame pathfinding:(
Another problem is how to return new unit. The way I used ( give temp name trow init )  faults when several scripts running :(
2. Move unit iwth playmove command , but then I need at least some kind of pathfinding alorithm...
See attached demo mission ( no addons needed )
Suggestions , proposals ?
« Last Edit: 26 Jul 2005, 23:04:32 by bdfy1 »

bdfy1

  • Guest
Re:Enable AI + Trench pack
« Reply #1 on: 26 Jul 2005, 23:05:14 »
lokk for newer links in the topic
« Last Edit: 27 Jul 2005, 22:41:23 by bdfy1 »

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:Enable AI + Trench pack
« Reply #2 on: 27 Jul 2005, 01:32:59 »
Quote
Another problem is how to return new unit
when you createunit the new one, put:
_unit_variable = this
in its "init" field of the createunit array
obviously you would change the variable to whatever you want

Offline Blanco

  • Former Staff
  • ****
Re:Enable AI + Trench pack
« Reply #3 on: 27 Jul 2005, 01:53:22 »
Code: [Select]
1.Anyway (for othe purposes)  I need "enableAI"  script I made function: simply delete unit and then create the same ( the same type, group,weapons, ammo ( to magazine )),created unit is returned. The problem is that units are a bit dull - their way to MG is a bit strange... ingame pathfinding:
How would you react when they suddenly put you down somewhere in the middle of a fight? ;D

Nice way to get around a problem   :)
I remember there was a script for pathfinding but I can't find it back. Have you tried reveal MG?
Quote
I wanted to use aicover and manMG scripts.
But I had to modify them to achieve better results.
Instead of disgrouping units in cover script I used disableAI (this is not the only change
 

Thanks for using Aicover2.0, but you have used it in a wrong way.
The script needs a trigger to run, the crouching part does work without the trigger, but not the scanning part. The units will change their targets depending on a certain distance and knowsabout value. When a unit comes close (+-50m) and a  trenched unit has spotted him (kniowsabout) , he will change his target to that unit. If there are more, he will target the mostknown. I did it because single units are not so alert then units in group, Infoshare from GB was also a good way to solve this.



Anyway, it's a very nice idea,
- The coverscript will work without ungrouping them, you can play as the commander assigning targets to the trenched units .I did it on the Cat_afganistan map in one of those towns with lots of climbable roofs and it was big fun but hard. After some time I've noticed that the units will leave their positions in some situations , so I decided to ungroup them from the beginning.
They will stay in position as long as you don't give them the order to attack (LMB), giving them target orders (RMB) is no problem.

You have combined it with manmg from GB which is great, I never thought of that :D  
-I saw you've changed a line in the crouch part... they are lying down now instead a popup kneel. It's harder to hit them now, but easier to approach.
In the example mission the  location of your gunnest was perfect,I think it was the good choice to make them go prone.

- An idea I tried was ; putting  some ammocrates behind the trenches, and when they run out of ammo they leave their position , reammo and move back behind the trench.
Problem was that he left his position , rearmed, but he didn't use his magazines, he just stood there.
I dunno why.

*edit*
I just gave it a try, really great work, I had a great fight in ECP with it, I doubled the amount of troops on both sides and played with WEST, while one group keeps them busy from a distance, the other group tries to flank them.
To make the flanking manouvre more difficult I place a BMP on hold in the open field, left from the gunnest.
 

I saw a bug too, when I reached the hill the only one left was the M2 machinegunner, when I killed him a new unit was created behind the sandbags...

In your example the units are still in group,it's a lot better now.  :)
Also the scanscript is not needed anymore because the men can share info about the enemy and best of all, when you play as an officer you can simply assign targets with your binoc and your men will stay in position.
I just had to change a few lines in the init part :

Code: [Select]
#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
?_unit == player : goto "skip"
_dir = getdir _unit

_unit disableAI "move"

;_unit disableAI "Target"
;[_unit] join grpnull
["crouch",_unit,_trig,_dir] exec "AIcover2.sqs"
#skip
_i = _i + 1
?_i < _c : goto "cycle"
exit


Just in case you are the player, the crouch script doesn't have to run on you.





 

« Last Edit: 27 Jul 2005, 05:44:48 by Blanco »
Search or search or search before you ask.

bdfy1

  • Guest
Re:Enable AI + Trench pack
« Reply #4 on: 27 Jul 2005, 09:25:18 »
2Blanco
Quote
Thanks for using Aicover2.0, but you have used it in a wrong way.
The script needs a trigger to run
I have a trigger in the main mission (on Nogova) - I just forgot to put it in this demo :)
Anyway I can even simplify your script - the entire group will share info and assign targets without additional script lines ;)
ther're even more advantages in using disableAI:
While in group and with AI enabled  units constatntly trying ti return into formation - dostop not always helps.
Speed - disabling AI will increase game speed.
Quote
I saw you've changed a line in the crouch part...
Yes, your script IIRC correctly was made for city battles - it looks fun when unit is behind window - he fires while standing then hiding falling at knees.
In field,with low fences,  it looks stupid - that's why I made units lie - then rise at knees. I don't know the reason, but it only works with AI move disabled - in other ways units stands just for a second ( while anim is played ) and lies down again.
Quote
Problem was that he left his position , rearmed, but he didn't use his magazines, he just stood there.
What do you use ? domove to previous position ?
PS anyway thanks again for your scrpt - it inspired me :)
« Last Edit: 27 Jul 2005, 09:26:06 by bdfy1 »

Offline Blanco

  • Former Staff
  • ****
Re:Enable AI + Trench pack
« Reply #5 on: 27 Jul 2005, 17:15:31 »
Quote
Yes, your script IIRC correctly was made for city battles

True, most windows in the BIS buildings are too high
Maybe you could add a variable (a local bolean, there's only 1 script anyway) so the missionmaker can choose between a prone-crouch or crouch-stand animation,  this way the script can be used in both situations.

["init",this, true] exec "AIcover.sqs"

to make them prone-crouch...

["init",this, false] exec "AIcover.sqs"

for crouch-stand.

Also...you got this line in the crouch part :

Quote
?(!someammo _unit) OR (alive _unit && (not canstand _unit OR handshit _unit > 0)):["rmove",_unit] exec "AIcover2.sqs";exit

It executes that randommove script when the unit got hit or run out of ammo.
When you use disableAI "move" in the beginning, the unit can't move anymore and the randommove script become useless.

Quote
What do you use ? domove to previous position ?

Yes, he ran back to his previous position,this could take a while in the middle of a fight,  but the main problem was that he didn't defend himself because he refused to reload his weapon. He had the right mags for sure.

I did some tests with medics.
When you put a medic team with a support waypoint behind the defence lines, they will automatically heal an injured unit in the trenches. The trenched unit will stay in position and the medic will run towards him.  :)

Btw, I saw something I never saw before
Law-soldiers who attack infantry with rockets ???  





« Last Edit: 27 Jul 2005, 18:00:18 by Blanco »
Search or search or search before you ask.

bdfy1

  • Guest
Re:Enable AI + Trench pack
« Reply #6 on: 27 Jul 2005, 22:40:34 »
Here's the current version. Let it be AIcover3.0 :)
See how powerfull a few  bots can be:)
There're third parameter for crouch/stand cover.
Quote
the only one left was the M2 machinegunner, when I killed him a new unit was created behind the sandbags...
This bug is fixed , but not in the best way. It appears when I try recreate leader of the group. Thus I need to upgrade  enable.sqf...
Still no medic or reammo support etc - I'm working on it.
Quote
Law-soldiers who attack infantry with rockets
manipulations with cost parameter in config ;)
« Last Edit: 27 Jul 2005, 23:50:40 by bdfy1 »

Offline Blanco

  • Former Staff
  • ****
Re:Enable AI + Trench pack
« Reply #7 on: 27 Jul 2005, 23:41:34 »
Hmmm, there must be something wrong,cos units stay prone and one of them left his position...

I'll take a look at the scripts...

Ok, your execution is wrong, you forgot the var.

Code: [Select]
["init",this,"crouch"] exec "AI\AIcover.sqs"
and you had...

Code: [Select]
["init",this] exec "AI\AIcover.sqs"
But the guy on the right still moves forward...
...

OK, you have grouped the M2 with the units, when you ungroup the M2, problem is solved but I can't explain why.






« Last Edit: 27 Jul 2005, 23:52:09 by Blanco »
Search or search or search before you ask.

bdfy1

  • Guest
Re:Enable AI + Trench pack
« Reply #8 on: 27 Jul 2005, 23:58:33 »
Sorry, silly mistake.
And problem with spawning leader
is not fixed  :( - I don't like method in previous  post.
So help with enableAI.sqf is desirable - I want leader to be spawned correctly.

Offline Blanco

  • Former Staff
  • ****
Re:Enable AI + Trench pack
« Reply #9 on: 28 Jul 2005, 00:50:28 »
In fact I haven't seen a problem so far with the leader spawning.
But I'm pretty tired now  :P

About enableAI.sqf...
I dunno much about functions but why don't you copy the unit's skill aswell?

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

bdfy1

  • Guest
Re:Enable AI + Trench pack
« Reply #10 on: 28 Jul 2005, 01:29:22 »
Quote
but why don't you copy the unit's skill aswell?
10x, fixed.

bdfy1

  • Guest
Re:Enable AI + Trench pack
« Reply #11 on: 28 Jul 2005, 20:24:26 »
I can track unit's ammo - now I'm thinking how to make him rearm.
I thought that bot without ammo will search for ammo on its own ( with AI enabled )...once ammo expires - I create unit without ammo ,but he does not go to ammocrate nearby - what's the ...?
IIUC I have to use domove and actiomn  command ...  see the example.

Offline Blanco

  • Former Staff
  • ****
Re:Enable AI + Trench pack
« Reply #12 on: 28 Jul 2005, 21:00:21 »
Bdfy1, you are too enthusiastic when you post your examples missions...  :)
You have forgotten to name the ammobox this time  ;)
Anyway, I see what you mean.
There could be a problem with that @unitReady _unit  line., because the script is still active when the unit got killed on his way to the ammbox.

Quote
I create unit without ammo ,but he does not go to ammocrate nearby

Yeah , i thought the same thing, maybe they only do it when they are in group and under command?
When AI runs out of ammo, normally they use the radio and ask for ammosupport, then the officer responds and points him in the right direction.

« Last Edit: 28 Jul 2005, 21:08:51 by Blanco »
Search or search or search before you ask.

bdfy1

  • Guest
Re:Enable AI + Trench pack
« Reply #13 on: 28 Jul 2005, 21:50:44 »
OK,  I hope everything is fine this time.
For some ingame bug\feature I can make unit take only 2 mags :(
ammobox now is global name ( it's easy to fix anyway ).
Quote
they only do it when they are in group and under command?
I adjust previous example - unit gets the order to rearm , but he only  returns back into formation :( I guess, that is AI react for enemy presence.
Also it's nearly impossible to rerurn unit back to his cover position  - under fire he doesn't obey any move commands. In demo-example EAST even advance once AI enabled !

Offline Blanco

  • Former Staff
  • ****
Re:Enable AI + Trench pack
« Reply #14 on: 28 Jul 2005, 22:19:50 »
Quote
lso it's nearly impossible to rerurn unit back to his cover position  - under fire he doesn't obey any move commands.

I was afraid for that, It works perfect on a simple desert island example, but once the enemy's around they first try to safe their own ass instead of obeying domove orders.
(they are not that stupid, huh?)
I wouldn't mind if they just rearm without moving first...rather a reliable solution that doesn't look that good than a solution that looks great but not reliable.  
imo..

I had no chance yet to see them rearm, because I or them were killed before.
But I like these kind of fights :)

« Last Edit: 28 Jul 2005, 22:20:35 by Blanco »
Search or search or search before you ask.