Home   Help Search Login Register  

Author Topic: (Accepted) Basic script for trenchfights  (Read 11017 times)

0 Members and 1 Guest are viewing this topic.

Offline Blanco

  • Former Staff
  • ****
(Accepted) Basic script for trenchfights
« on: 15 Jul 2007, 21:44:34 »
First off all, this script requires an addon.
This script, written in oldskool sqs, make AI units stay put behind the sandbags and pop-up once a while (optional)

Check the demomission on Rahmadi and let me know what you think...

In the zip:
- demomision
- Sandbagfix1.1 addon by Raedor
- Readme in txt and pdf format
 

« Last Edit: 06 Sep 2007, 19:53:30 by hoz »
Search or search or search before you ask.

Offline Blanco

  • Former Staff
  • ****
Re: Basic script for trenchfights
« Reply #1 on: 19 Jul 2007, 20:23:31 »
Updated 1.1*


Added:

- AI groups support static weapons. (optional) When a gunner got killed another unit will take his place.

For more information, read the readme in txt or pdf.

In the zip:
- A new demomision
- Sandbagfix1.1 addon by Raedor
- Readme in txt and pdf format

Can somebody test this in MP coop please?

*edit* There were some problems with missing addons. It's fixed now. link updated
« Last Edit: 06 Sep 2007, 19:54:24 by hoz »
Search or search or search before you ask.

Offline sharkattack

  • Former Staff
  • ****
Re: Basic script for trenchfights
« Reply #2 on: 23 Jul 2007, 20:36:11 »
Quote
Can somebody test this in MP coop please?

will make a short  demo ... im  sure  cheetah  wouldnt  mind  testing  how it  handles   next time  we  get  together for a game !
"HOLY SARDINE" - see Shark-Attack meet his match

Offline ZapBrannigan

  • Members
  • *
Re: Basic script for trenchfights
« Reply #3 on: 28 Jul 2007, 04:40:02 »
If the script fails after a save game why not just put disableAI"move" in the #loop in popup.sqs, then it will be continualy applied.

Offline Blanco

  • Former Staff
  • ****
Re: Basic script for trenchfights
« Reply #4 on: 28 Jul 2007, 08:52:44 »
I didn't try that, might work.
Tried it and it doesn't work when I place the disableAI move commands in the loop of the popup script.

I tried another solution to nail the savegame bug in an updated version
I add dostop , disableAI "move" and enableattack false. An AI-leader can only give targetorders so everybody stays put even when you save or load the mission.
When you're in command you are able to enable moving by changing the selected unit(s) behavior to anything else then "combat" (thx to mandoble for the tip). Mounted units will dismount when they are in the same group.
Works fine, but it seems my script is getting slow. The condition to check the units behavior is in the popup script, it should take max 12sec before they leave the trenches, sometimes it takes minutes when they are under attack. I dunno why, but is this script lag?









 
« Last Edit: 28 Jul 2007, 09:58:02 by Blanco »
Search or search or search before you ask.

Offline johnnyboy

  • OFPEC Patron
  • ****
  • Matan los Pantalones!!!
Re: Basic script for trenchfights
« Reply #5 on: 28 Jul 2007, 10:10:36 »
I just tried this and it works pretty slick, I like it alot!.

I took the liberty of modifying the pop up script a little so that when prone, the unit will crawl sideways left or right sometimes, shifting their position a little (harder to predict where they will pop up that way).  Incorporate it if you like it.  I added comments to popup code below to clearly mark the new lines.  I also added a condition to exit the popup script if the unit is the player.

Code: [Select]
private ["_man"]

_man = _this select 0

;;; BEGIN ADDED CODE
;;; initialize _last_move variable
_last_move = "None"
;;; END ADDED CODE
#loop
;;; CHANGED FOLLOWING LINE, ADDED "or _man == player" CONDITION
?! alive _man or _man == player: exit
_man setUnitPos "down"

;;; BEGIN ADDED CODE
;;; next five lines will have shooter shift position left or right sometimes.
~1
_rand = ROUND (random 4)
?_rand == 0 && !(_last_move == "L"): _man playmove "AmovPpneMrunSlowWrflDl"; _last_move = "L"
?_rand == 1 && !(_last_move == "R"): _man playmove "AmovPpneMrunSlowWrflDr"; _last_move = "R"
?_rand > 1: _last_move == "None"
;;; END ADDED CODE

~5 + random 8
_man setUnitPos "middle"
~5 + random 8
goto "loop"


To take this further, you could test whether the unit's current weapon is rifle or pistol, and then play the correct corresponding move for crawling left/right (right now its hardcoded to rifle crawl).

It would also be really cool to integrate this with second's suppression script, where the time prone is increased the more suppressed the units are.  Might not be too hard to add a global variable in his his script (per group running the popup scripts) that carries the suppression level per group.  The  popup script would then check the global suppression level for their group, and adjust the time prone accordingly.

To speed the popup script up, converting it to a compiled function might help.  Especially because the script is being run by multiple units.

Anyways, good idea dude!
El Cojon: "Do you like to Tango?"
You: "Only in Bagango."
Download Last Tango in Bagango and discover how El Cojon earned his name...

Offline Blanco

  • Former Staff
  • ****
Re: Basic script for trenchfights
« Reply #6 on: 28 Jul 2007, 10:24:38 »
Very nice, I tried it and it looks very good.  I had the same thing in mind but with the rolling animaitions, but I didn't try it yet. Maybe I can use them both.

 
Search or search or search before you ask.

Offline johnnyboy

  • OFPEC Patron
  • ****
  • Matan los Pantalones!!!
Re: Basic script for trenchfights
« Reply #7 on: 28 Jul 2007, 23:35:38 »
Rolling would be cool.  Especially for guys on the sides of the cover.  Roll out shoot.  Roll back hide.  Repeat.

I also tried it with two side-crawls in a row, so they pop up further away from center position.  But then you get them bumping into their neighbors, so you have think more about how far apart you space the defenders.  You will likely have that issue with the roll too.  So Parameter driving that with the script would make it more flexible.  Mission Designer can pass one parameter for a group that has its units close to each other, so you only crawl once left/right.  Pass a different parameter if they are more widely spaced, so they can roll or crawl twice.  Pass another parameter for guys on sides of cover,who will roll out---shoot--roll back.  The bigger the mix of possiblities, the more natural it will look.

I've been toying with these ideas for awhile, as I am working on group movement script that directs units to fixed positions in buildings or anywhere.  Once in position, it would be nice to integrate your script, with a few more options.  Popup is good for low walls and some windows.  But sidestepping would also be good for windows, pillars, wall corners, vehicle corners, etc.   Step out, shoot, step back.  Sidestepping looked really good in that video by sin329 linked on the ofpec home page.
El Cojon: "Do you like to Tango?"
You: "Only in Bagango."
Download Last Tango in Bagango and discover how El Cojon earned his name...

Offline Blanco

  • Former Staff
  • ****
Re: Basic script for trenchfights
« Reply #8 on: 29 Jul 2007, 03:04:20 »
I tried the rolling but I have a problem.
Animation names are "amovppnemstpsraswrfldnon_amovppnemevaslowwrfldl" for a left roll and "amovppnemstpsraswrfldnon_amovppnemevaslowwrfldr" for a right roll. When I use these in my popup script, the units perform the roll but always twice. First I thought it had something to do with loop, but later in the editor I tried these on a single unit via a trigger and they still do a double roll. I don't understand why this happens, it makes no sense.



Search or search or search before you ask.

Offline ZapBrannigan

  • Members
  • *
Re: Basic script for trenchfights
« Reply #9 on: 30 Jul 2007, 03:24:38 »
It has to do with the config in the animations im sure, if you de-PBO them and look at the config you will see the awnser.
I used to do configs for OFP animations. I dont know if arma is the same and it was along time ago that I last looked at one but maybe I can help.

also, in your demo mission, I cant find how you are executing the trench scripts, there is no trigger that I can find with []exec anything. And there is no init in the mission file. how are you running them?


Offline Blanco

  • Former Staff
  • ****
Re: Basic script for trenchfights
« Reply #10 on: 30 Jul 2007, 07:06:00 »
There are three parameters. (last two of them are optional)

1- name of the group
2- pop-up ability (true or false)
3- Third parameter is a nested array.

First element in the array is the name of the static weapon the group must support (when the gunner got killed, the closest unit in the group will take his place)
Second element is the name of the trigger that covers the units that must support the static weapon. Positions of the units are fixed anyway.

You can run the script in an init, trigger, script. In the demo I start the script in the groupleader init. I don't define a group name, I use group this.
If you want to run it in a script, trigger,... whatever you have to define and use the groupname.

Examples:
Quote
[group this, true] exec "trenches\outpost.sqs"

In this case the script starts in the init of a groupleader, because groupname is not defined. The group will pop-up once a while (default) but they won't support any static weapon.
Quote
[mygrp, false] exec "trenches\outpost.sqs"


Name of the group is mygrp and they will kneel all the time and no weapon support.

Quote
[wgrp3, true,[MGbunker,MGbunkertrig]] exec "trenches\outpost.sqs" 

Name of the group is Wgrp3, they pop-up and they support a static weapon named MGbunker. There also a trigger named MGbunkertrig covering all the unit that should support the weapon. You don't have to cover all the units in the group, units outside the triggerarea don't support static weapons.

When you place a group behind the trenches, just put them in the desired position/direction, but don't forget to set "none" in the special dropdown menu in the units init. (for each unit).

Can this be done via scripting btw? I know you can when you create units, but I'm not sure you can when you place the units on the map...

 
 

It's in the readme btw :)

« Last Edit: 30 Jul 2007, 07:23:26 by Blanco »
Search or search or search before you ask.

Offline ZapBrannigan

  • Members
  • *
Re: Basic script for trenchfights
« Reply #11 on: 30 Jul 2007, 18:29:26 »
Quote
In the demo I start the script in the groupleader init.

I see. I was expecting it to be started in a trigger. Have you ever tried starting it in a trigger, because that could maybe fix the save game bug. Possibly. You probably have already tried it.  Because If in a trigger the script wont be executed until .5 seconds or later after the game starts(which is the time a trigger takes I think).
« Last Edit: 30 Jul 2007, 18:31:49 by ZapBrannigan »

Offline subroc

  • Members
  • *
Re: Basic script for trenchfights
« Reply #12 on: 06 Aug 2007, 21:25:54 »

Offline nettrucker

  • Members
  • *
  • Too young to die-OFP Campaign by TOY & nettrucker
Re: (Accepted) Basic script for trenchfights
« Reply #13 on: 28 Dec 2008, 15:05:45 »
Hello blanco, hello everybody
sorry for digging up this thread but I need to know how to fix my current problem with this script. The scripts are working fine and I'm using the script for a lot of my defending missions, but there is 1 thing I would like to mention.
1.) My main problem lies in a kind of listing of following string messages

Code: [Select]
"SCALAR BOOL ARRAY STRING 0XE0FFFFEF"
Now I believe that it has definitely something to do with Raedor's Sandbagfix. I removed it from all missions mqs. since then I receive this strange string listings. I wasn't fully aware until now reading throughout this topic that the sandbagfix is neccessary in order for the script to work propperly.

Since I don't have any clue how to fix this can anybody give me some advice?
Thanks for any feedback in advance and a happy new year.
nettrucker

Offline MRO204

  • Members
  • *
  • I'm a llama!
Re: (Accepted) Basic script for trenchfights
« Reply #14 on: 05 Jan 2009, 18:52:26 »
You dont need the sandbag fix after patch 1.08 i think.  :)