Home   Help Search Login Register  

Author Topic: Smart AI trench cover map & scripts here. Get it now. Testing required.  (Read 3665 times)

0 Members and 3 Guests are viewing this topic.

Offline Zayfod

  • ECP Team
  • *
  • Llama, softest natural fibre in the world.
Here it is. Download the map  ;)

Test it out and tell me what you think. All offers to streamline these scripts and make them better gladly accepted. I am no script guru but these work quite well me thinks.

They may have stuff in them that aint needed so let me know.

Fox2 and a guy called Dolittle at www.flashpoint1985.com  hit the nail on the head about AIs ability to fire over sandbags (or for that matter most objects) when they suggested setting the objects damage to 1.

So I tried it and WHAMMO they WASTED the enemy (even at long range) instantly while only exposing the top of their heads so CHEERS guys for all that gave input to the subject.

Prior to that I had spent like 48 hrs working on a camcreate bullet script which actually works well (lol and NO it doesnt cheat). It relies on knowsabout and distance to object etc. BUT I dont need that now ofcourse. However it would be  great for pillboxes and stuff as I added  random variables as it tries to target you. Not only that--it aint invincible, you can kill it cause it requires an AI for the targeting. I'll finish that one later.

Actually u could use it so that the AI guys sitting on the outside off the huey in the sebnam pack could fire at u as they fly by. ;D Anyways I have not included this script in the map cause it wasnt needed.

OK quick breakdown of what the scripts in the map do:
********************************************
startcover.sqs
tells all dudes in the West defending group to start the
(1) Cover.sqs
(2) jiggle.sqs

*****************************************
Cover.sqs
tells the AI unit to randomly pop up and down behind the cover and hopefully stay put.

********************************************
Jiggle.sqs
tells the AI unit to do just that, jiggle left to right / back and forth.

******************************************
Artspottercover.sqs
same as Cover.sqs but for the AI artillery spotter.
I tried to get him to run the cover .sqs but I got an error so i just made a seperate on for him. (like I said Im no guru) Maybe u guys can solve that for me. :)

*********************************************
morebaddies.sqs
Just a small createunit script so west are always under attack.

Ive added Bremmers improved AI script for a bit of atmosphere and for the artillery. I changed it slighty so the artillery can reload a little bit quicker, they fire less rounds, the rounds are a bit more accurate, and I put a condition in there too called bombsaway so if the west gets over run they dont call artillery in on themselves.

I have a head ache :-[

Once again thanks to all those that helped.

Download the MAP!!
BTW radio Alpha takes away wests cammo so u can see them in the trenches.

Radio Bravo set the trenches to dammage 1 and WHAMMO west lets rip

For the trenches I used sandbags and lowered tank ramps

ZAY out











 


« Last Edit: 01 Aug 2003, 14:01:26 by Zayfod »
"I have come here to kick ass and chew bubble gum......an I'm all outta bubble gum!"

Fox2

  • Guest
Hot damn, Zay.  :o  Very nice script there, mate. Very nice, indeed.

Although I can't offer any suggestions to trim it down or streamline it (as my philosophy is "If it ain't broke, don't fix it") I will say that this is damned nice. You've just created something that may just make the difference between a good hold-the-fort-type map and a GREAT hold-the-fort-type map. Those Russians didn't have much of a chance against those US soldiers.  :P  ;D

Two thumbs way up and a salute for good measure!  :wave:

If you need any help testing it some more (or even better, for multiplayer) gimme a holler.

Offline Blanco

  • Former Staff
  • ****
Hello,

I experiment a bit with the snippet code you posted in the previous thread. I 'did'nt had the time yet to test this map, but I will try it soon. :)

There are some things I noticed

- It works much better with Unofficial addons! (I tried units from the HK2pack and the WW2 units from WWIIEC) WHY?COINCEDENCE?

- The basic pillbox and the large blockhouse (GFX) works great also. (sandbags suck big time)

- I placed a staight Res CASTLE wall (instead of a sandbag wall)deep in the ground and it works great. . I placed 3 Airborne WW2 units vs 8 german soldiers behind such a wall. They've murdered the whole german squad without a casualty. I also played with the germans and they were very difficult to kill, even if you know where they are. Only the top of their helmets were visible and they opened fire in crouch & stand position. Perfect!  It was a complete ambush!

- Placement of the several objects and soldiers were very crucial to make it work.

I tested the behaviour of the AI with a radio trigger that replace the player with one of the Ai units (unitname Switchcamera "internal")

- Did you ever tried another combination ( prone to crouch) ?
popup behind windows...

Great work, this was something we missed in OFP!!

Blanco

Search or search or search before you ask.

Offline Zayfod

  • ECP Team
  • *
  • Llama, softest natural fibre in the world.
Hey guys a few updates 4 ya. ;)


#point 1

So far Ive found that  tank ramps  lowered to -0.21 are the best. IMHO. See my map above for example.

Why?
(1) They dont warp and change shape when set to dammage 1 (this required for AI to fire over them easily)
 
(2) they make no sound (explosion) when setdammage 1

(3) They are a good shape for building barricades.(nice uniform level)

(4) They are low detail so when used a lot for building things they dont slow framerate much.

#point2
Quote
- The basic pillbox and the large blockhouse (GFX) works great also. (sandbags suck big time)


No sand bags are fine you just have to setdammage to 1.

But.

(1) They warp slightly

(2) They explode making a nasty sound when you do this. Thats ok tho just put:

this setpos [getpos this select 0, getpos this select 1, 50000]; this setdammage 1; this setpos [getpos this select 0, getpos this select 1,0]

this put them 50,000 m into the air b4 they blow up then sets the back down and u dont hear the explosion.

(3) beware--multiple use of sandbags has potential to slow frame rate on lower end systems cause they have more detail.

#point 3

I tried using CASTLE Wall Small (Res) as its about the same size as sandbags but even when I lowered them alot into the ground AI still would not fire over them......

SO I set dammage them to 1 but they crumble and dissappear. NO GOOD. ::)

 Not only that they have HIGH detail so when used in large numbers they really slowed framerate.

#point 4

I tried CASTLE Wall Long 02 (Res) works VERY WELL.
I lowered it into ground (-2.3). It was excellent.

(1)Its a broken wall at different heights and when lowered to that level AI can fire over the highest point.

(2) Its large, you dont need many to form a barricade and its detail is low so no frame rate issue.

(3)BEST  OF ALL it DOESNT require you to setdammage 1. ;D


My choices so far for best cover using the cover script?

1. lowered tank ramp (setdammage 1 required)

2. lowered CASTLE Wall Long 02 (Res)--(setdammage 1  not required)

3. sandbags (called woodfence in editor)--(setdammage 1 required)

Blanco--
Quote
- Placement of the several objects and soldiers were very crucial to make it work.


KINDA ........but ts not so crucial if you group the ai together and put a dostop this command in their init.

see my map example

 This way when one of the group sees a tango they will all turn around and try to enagage the tango from where ever they are hidden--but they wont move. ;D


#Please post your findings regarding what oblects work for cover that the ai can see and fire over here( and whether or not u had to lower them or setdammage to 1).

I would really like to get a list going--maybe it will help MOD makers overcome the issue when they make their own objects. ######IE make buildings where AI can fire from the windows lol obviously setdammage 1 CANT be used there.#########

Zay out






« Last Edit: 08 Feb 2003, 02:49:46 by Zayfod »
"I have come here to kick ass and chew bubble gum......an I'm all outta bubble gum!"

Offline Zayfod

  • ECP Team
  • *
  • Llama, softest natural fibre in the world.
*********UPDATE********

Trench cover Script and test map has been updated.

OMG these guys are EVIL NOW. ;D

Many fixes and extra features to the units taking cover. For a full update goto:

Also fixed the create unit script as there was a 1 sec pause between deleting the dead units and creating the new east units, this caused a small pause in the game on lower end systems as the textures were removed from the memory then recreated 1 sec later.

I simply removed the pause now all is well, no stutter in game at all. :)

this script TEST Map is basically same as previous version  BUT WEST IS EVIL now.

West is only 3 infantry and 3 law dudes. Sure they have 2 artillery spotters but try deleting them in the editor and west does almost as well without them.

Anyways try the map youll see what I mean

They hide in the trenches and are attacked form three angles by 18 east infantry, a T80, and a BMP. AND 7/10 the suffer no casualties at all, unless the are OVER RUN, but I have made the script to react to this ALSO.

What I need now is a guru to help me make it a stand alone single script, cause at the moment it relies on Bremmer's Improved AI script--cause Ive added conditions to his script for most known enemy etc.

Also the script is custom to the map cause the names of the tanks are in the script. I dont know enuff about arrays and stuff so HELP ???

But apart from that works perfectly well.



TRY the new version test map it beats the crap outta the previous one.

MP testers needed, and help with the tank arrays and knows about. Cheers all enjoy ;D :cheers:

ZAY out

BTW make sure when you play the map as the civie you HIT THE DIRT and dont draw attention to yourself or the west AI will get distracted by you and wont do as well lol :P ALSO if you want west to do really well radio bravo real quick and itll set dammage to 1 the barricade so they can fire over it. 8)





« Last Edit: 01 Aug 2003, 14:03:25 by Zayfod »
"I have come here to kick ass and chew bubble gum......an I'm all outta bubble gum!"

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
here is idea ;D

use secondryweapon _unit - to check wich launcher da uit have (returns null 4 no weapon) so da mision maker dont need 3-4vers of da script if dere r ppl wid LAW, RPG and oder launcher ;)

ill test it soon ;D

LCD OUT
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

Offline Zayfod

  • ECP Team
  • *
  • Llama, softest natural fibre in the world.
Just to let u all know I am still working on this but Im gonna finish the rappel script first ;D

Quote
use secondryweapon _unit - to check wich launcher da uit have (returns null 4 no weapon) so da mision maker dont need 3-4vers of da script if dere r ppl wid LAW, RPG and oder launcher

good idea LCD I have implemeted this into my script at home to cover all tube launchers and Ill post the script soon.

Itll include many other fixes and additions such as.

#1: If the AI are over run by armour that is manned and can fire they hide (go prone behind barricade) and then every once in a while they pop up to see if any enemy infantry are closing in.

#2 If any infantry over run them and are really close theyll scan for them and stand up so they can get the angle to fire at them (if the over running enemy is prone behind the barricade.)

#3: only the guys with the launchers will stop scanning for enemy when armour is inbound. The rest keep looking for infantry.

#4: I have over come the create unit issue now so youll be able to spawn new AI troops and the script recognises them correctly.

#5: If the AI in the trench cant walk then he exits the script now.

All this and more will be included in the next edition.

 ;D

Zay out
« Last Edit: 12 Mar 2003, 05:06:00 by Zayfod »
"I have come here to kick ass and chew bubble gum......an I'm all outta bubble gum!"

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Zayford,

I really like your script idea, its great! Okay, I don't have OFP:R, so I have only downloaded and tried v1.0 of your script. I made a few changes that you might want to take a look at. If any of this no longer applies in version 1.1 of your script, just ignore it. Like I said, I'm only using v1.1.

  First of all, the code in kneel_popup.sqs was pretty messy. Basically there was nothing wrong, you just applied the same command again and again in a loop, which was unnessasary. (I.e. setunitpos "up") I just changed it so those commands are only applied once, at the beginning. I also added a way to exit the script before the unit is killed. If the unit's combat mode changes from "yellow", the script ends. This gives mission designers a way to end the script (if they want the men to retreat via a trigger, for example).
  I also changed jiggle.sqs (below I call it Z_jiggle.sqs). I will talk more on this below. But now I have it called by kneel_popup.sqs every time the unit crouches. Basically, the unit moves side to side while he is crouching, but not while he is up (usually). I think this is a little closer to what you intended. I also toggled the delay on kneeling and popping up, but that can easily be changed.

  Here is the code:

Code: [Select]
_man = _this select 0
_man setcombatmode "yellow"
_man setunitpos "up"

#loop
_man playmove "CrouchToCombat"
_man playmove ""
~ (random 5)
? not(alive _man) OR combatmode _man != "yellow" : exit
_man playmove "combattocrouch"
_man playmove ""
[_man] exec "Z_jiggle.sqs"
~ (random 5) + 5
goto "loop"

  Okay, now for jiggle.sqs. This is a very good idea, and I changed it a little. First of all, when it is executed, it only runs once before terminating. This is because of the way I changed how it is called above. Along those lines, I removed the pausing feature in the script.
  Now, here's the big improvement. In your old script, the guy kinda jiggles diagonally, depending on which way he is facing. I used a little math so that now he jiggles to his left and right. This means that no matter which direction he is facing, he moves to his left and right. This works better because now he moves parallel to whatever cover he is behind, instead of sometimes moving towards it.

  Here is the code:

Code: [Select]
_jiggler = _this select 0

_movetotal = 0
_movemax = 0

  #moveRightStart
_movetotal = 0
_movemax = (random 1.5)

  #moveRight
? not(alive _jiggler) OR combatmode _jiggler != "yellow" : exit

_movedist = (random .01) + 0.015
_movetotal = _movetotal + _movedist

_jiggler setpos [(getpos _jiggler select 0) + (_movedist * cos (getdir _jiggler)),  (getpos _jiggler select 1) + (_movedist * sin (getdir _jiggler)),0]

?_movetotal >= _movemax : goto "moveLeftStart"
~ 0.02
goto "moveRight"


  #moveLeftStart
_movetotal = 0
_movemax = (random 1.5) //NOTE: SEE BELOW

  #moveLeft
? not(alive _jiggler) OR combatmode _jiggler != "yellow" : exit

_movedist = (random .01) + 0.015
_movetotal = _movetotal + _movedist

_jiggler setpos [(getpos _jiggler select 0) + (_movedist * cos (getdir _jiggler + 180)),  (getpos _jiggler select 1) + (_movedist * sin (getdir _jiggler + 180)),0]

?_movetotal >= _movemax : exit
~ 0.02
goto "moveLeft"

  NOTE: The jiggler will move different amounts left and right. This means that he will not end up in the same position as he started in. If you want him to always end up where he started, delete this line.

  I hope you like my suggestions. Great script, keep working on it!
HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!

Offline Zayfod

  • ECP Team
  • *
  • Llama, softest natural fibre in the world.
Thank you very much for your input General Barron--nice work.

I have completed the script to virtually final version and have implemented your additions to a degree--although I noticed that when the jiggle.sqs was executed the AIs accuracy deminished considerably.

Fear not tho as I still have it in the script but (truth be told) more for eye candy than anything else. It executes as the unit acquires a new tango (so kinda looks like the soldier settling in before he takes the shot)

Ive deminished the movemax to 0.5 cause 1M looked like it was outta the movie "OMEN"  too weird sliding all that way to the left and then right. All looks natural now.

Great work on the code and TY  :-*


This thread is now closed as this script has had a rebirth---"WAAAAAAAAAAAAAA-------its a BOY"

PLZ see here for updates.


http://www.ofpec.com/yabbse/index.php?board=27;action=display;threadid=11904


Zay out


"I have come here to kick ass and chew bubble gum......an I'm all outta bubble gum!"