Warning: include(/var/www/html/forum/Sources/../../../includes/depot_files/OFPEC_get_header_image.inc.php): failed to open stream: No such file or directory in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 146

Warning: include(): Failed opening '/var/www/html/forum/Sources/../../../includes/depot_files/OFPEC_get_header_image.inc.php' for inclusion (include_path='.:/usr/local/lib/php') in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 146

Notice: Undefined index: OFPEC in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 152

Notice: Trying to access array offset on value of type null in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 152

Notice: Trying to access array offset on value of type null in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 152
    Home   Help Login Register  

Author Topic: Better AI  (Read 3036 times)

0 Members and 1 Guest are viewing this topic.

Corben Dallas

  • Guest
Better AI
« on: 15 Jun 2005, 10:27:27 »
I'm trying to use General Barron's InforShare (http://www.ofpec.com/editors/resource_view.php?id=608) script to make my loons react when someone near to them gets shot - a major failing in OFP I think.

Anyway, I have all resistance units, and it wasn't working.  I searched and found a thread that said put GUER units in to make resistance work, then set the trigger which activates the script to do the same. However, I get an invalid number error with the following line in my init.sqs file:

  {[_x, GUER_units, west_units] exec "infoShare.sqs"} foreach GUER_units

if I change it to:

  [_x, GUER_units, west_units] exec "infoShare.sqs" foreach GUER_units

I don't get the error, but it doesn't work.

I don't want to understand how the whole thing works, I'd just like it to work so loons aren't so, well, loony.

Personally, I feel that if I can't get the loons to react then it's worthless continuing spending hours and days writing my first mission (which could be reasonably good) - it looks so stupid shooting someone only to have the rest of them all continue and mooch about happily.  >:(

Any help very much appreciated.

Edit:

I've just re-read the page at the link above, and was missing this:

  knownEnemies = preprocessFile "knownEnemies.sqf"

Mind you, that gives an error - not supported in 1.46?

Is there a simple way to make enemies within say 20 meters go combat if they 'see' or 'hear' someone get shot..?

This is making a mess of my mission, and the only way to make it less unrealistic is to just keep units apart, but then I can't have the mission plot I'm working on...
« Last Edit: 15 Jun 2005, 10:35:26 by Corben Dallas »

Offline Fragorl

  • Coding Team
  • Former Staff
  • ****
Re:Better AI
« Reply #1 on: 15 Jun 2005, 11:16:01 »
Hm... you won't be able to use functions if you're running 1.46

You could try taking the content of the function (i don't know too much about it, so i could be off the ball a bit here) and converting it for use in your script, but that's a difficult way, plus you need to credit the author (Gen Barron) if you do so, as you no doubt know.

There are lots and lots of things that resistance supports that CWC does not. I was in the same situation as you a while back, trying to work in 1.46. I knew there were quite a few things i was missing out on, but i just kind of ignored them. Later, when I got a copy of resistance, I came to realise all of the things that could be done in res that couldn't in 1.46, and i realised how limited my own stuff was. My advice is try and find a copy of resistance; it's dirt cheap now, and according to various people quite easy to get a hold of.

For the foreach line, try this:

"[_x, GUER_units, west_units] exec ""infoShare.sqs"" " foreach GUER_units

that's how i used to do it before i found out about the curly braces... maybe it's a 1.46 thing.

Corben Dallas

  • Guest
Re:Better AI
« Reply #2 on: 15 Jun 2005, 11:42:55 »
Thanks for that, I'll give it a go.

As to Resistance 1.9x, I binned the CD it annoyed me so much. Some might say that was crazy, but it made my PC slow down horribly, and nothing I could do helped. It just runs too many things in the background, and I didn't see that having pathetic graphic quality just to play 1.9 was worth it. Pehaps next year if I buy a super powered PC I'll get hold of it again.

Edit:

Nope, the code with quotes didn't work.

1.46 doesn't appear to have the AddEventHandler command, which a lot of scripts use.  Is there any way around this?
« Last Edit: 15 Jun 2005, 11:55:55 by Corben Dallas »

qqqqqq

  • Guest
Re:Better AI
« Reply #3 on: 15 Jun 2005, 14:16:32 »
You can do soooo much stuff in 1.75+ it's worth it.   You're right the graphics didn't make it worth it though.    

Resistance runs fine on a Pentium II processor.    If you have that or better its just a question of using mod folders, -nomap, low settings and all that good stuff to make it run ok.

Corben Dallas

  • Guest
Re:Better AI
« Reply #4 on: 15 Jun 2005, 14:32:02 »
I run 1.46 in 800x600 on my laptop (P4 2.8ghz, 512mb Ram, 1400x1050 TFT, GeForce Go5200) and it looks fine.  Any higher version with all of its background processing, having to drop the graphics until it looks like a Sinclair Spectrum - forget it.  I'd rather not play the game.

Incidentally, if anyone runs Res. 1.96 at top resolution with all goodies turned on, maxed out everything, etc., and still running smooth as you like - what the hell kind of PC do you need to do that?!  :P

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:Better AI
« Reply #5 on: 15 Jun 2005, 14:43:37 »
Quote
what the hell kind of PC do you need to do that?!

HAL 9000, naturally. ;)

Corben Dallas

  • Guest
Re:Better AI
« Reply #6 on: 15 Jun 2005, 14:48:08 »
Stop shooting people Dave.  I don't like it when you do that...

Seriously, can anyone run it at full tilt..?
« Last Edit: 15 Jun 2005, 14:49:19 by Corben Dallas »

Corben Dallas

  • Guest
Re:Better AI
« Reply #7 on: 15 Jun 2005, 14:53:37 »
Ok, I have an idea - tell me how stupid this is or if it can be done.

How about placing a trigger which checks whenever an east/res unit has been shot, then sets all other units within the trigger range to combat mode.  Is that, or something like it, possible?

There must be some way of making the loons in 1.46 more aware, surely..?  I swear you could kill some of them with a box of old bagels.  What's more, nobody else would even notice.
« Last Edit: 15 Jun 2005, 14:57:59 by Corben Dallas »

qqqqqq

  • Guest
Re:Better AI
« Reply #8 on: 15 Jun 2005, 16:39:10 »
No, nobody can run it at anything like full tilt.    Setting the viewdistance to 5000 will crash it for most people.    

Your setup is better than average.  Stop being so fussy.   ;)   And look at the middle distance, not the foreground.    Best graphics you've ever seen.   I've nearly crashed the car more than once because the view was so like OFP.

Your trigger idea is essentially possible.    However, by far the easiest way to get what you want is to use eventhandlers.

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:Better AI
« Reply #9 on: 15 Jun 2005, 16:56:27 »
i just yesterday did something similar... let's see now...

create a trigger, whatever dimensions, make it activate on east present. in the 'on activation' field put

Code: [Select]
east_area1_total = +thislist; east_area1 = thislist
next to it create a trigger, no area, and in the conditional field put

Code: [Select]
count (east_area1) < count (east_area1_total)
in the 'on activation' field put

Code: [Select]
{_x setbehaviour "combat"} foreach east_area1
just tested it, and it works just fine ;)
« Last Edit: 15 Jun 2005, 16:56:47 by bedges »

Offline Blanco

  • Former Staff
  • ****
Re:Better AI
« Reply #10 on: 15 Jun 2005, 17:27:19 »
Quote
How about placing a trigger which checks whenever an east/res unit has been shot, then sets all other units within the trigger range to combat mode.  Is that, or something like it, possible?

http://www.ofpec.com/editors/resource_view.php?id=686

Search or search or search before you ask.

Corben Dallas

  • Guest
Re:Better AI
« Reply #11 on: 15 Jun 2005, 18:08:39 »
Many thanks for those ideas/links.  I'll try them out in a few minutes.  I think if I got the loons to be more AI I'd be happier spending time making missions.  As it is it's kind of;

"Oooh, Brian just blew up! Well, who'd have thought it."

"Yeah, happens. Let's walk over there..."

Oh, and yes I am fussy with the game.  It's not so much the actual frame rate (as long as I can run it high to stop lurrrghhh) - it's more the sudden slow down when things start happening.  Why have a P4 with a resonable spec and have it feel like playing on an old box?  I only play OFP - nothing else - and I like it smooth, loud and with bits of things going all over the place.  Heck, half the fun of making a mission is seeing what happens when I change the BlackOp for an AT and whap the UAZ and surrounding folks with something big and loud.

Edit:

In fact, I want an Old Testament mod with Moses in flowing robes, sheeps and shepherds, etc., so I can try the Armageddon Falling Comets script I saw somewhere.  ;D

Edit too:

Just had a thought.  My son is in the Paras, and has been filling me in on some of the kit they use.  Basically, everyone in a battle area gets to know what's going on right away (assuming all is working ok).  So, it seems to me that what I want is a very simple script which when any oppo unit is shot just sets the entire lot to combat mode.  After all, that's pretty much what would happen.
« Last Edit: 15 Jun 2005, 18:20:47 by Corben Dallas »

Corben Dallas

  • Guest
Re:Better AI
« Reply #12 on: 15 Jun 2005, 18:46:43 »
Ok, can anyone help turn my simple description into code?  It's got to be easy this way, and shouldn't laaaag either:

1. Trigger covering whole of map.  Calls script whenever East/Resistance present.

2. Script.

  if global time_count < 20 exit

  increment time_count
  check all east/res units
  if any in "combat"
    set all others to aware
  exit

That way it'd work in 1.46, and all units would go combat quickly after any of them were shot, just as if someone had radioed that they were under attack.  It doesn't say where you are, just that shots have been fired so keep your heads down.

I can't code it though.   :-[

Edit three: Better would be:

  if global time_count < 20 exit

  increment time_count
  check all east/res units
  if any in "combat"
    if others within 100 yards
      set them to aware
  exit

I'm going to try and code this.  You may hear from me again by next Christmas.   8)

Ok, the trigger exists, detects Resistance repeatedly, and calls a script.  The script is called "warnfriends.sqs".  All I need to do now is put some code in it...  ::)
« Last Edit: 15 Jun 2005, 19:54:16 by Corben Dallas »

Corben Dallas

  • Guest
Re:Better AI
« Reply #13 on: 16 Jun 2005, 11:42:12 »
I tried your doube trigger way bedges, but 1.46 doesn't like this:

  {_x setbehaviour "combat"} foreach east_area1

It errors on the curly bracket.  I've tried removing it, but then it errors on 'local variable _x'.  Quotes instead of {} don't seem to work either.  ???

Offline Sui

  • Former Staff
  • ****
    • OFPEC
Re:Better AI
« Reply #14 on: 16 Jun 2005, 11:52:09 »
1.46 doesn't know what to do with braces (ie, you can't use them at all!).

You'll need to use a double set of double quotes, like so:

 "_x setbehaviour ""combat""" foreach east_area1

Note that there's one set at the start of the line, two sets at the start of combat and three sets at the end of combat. Nice and confusing... ;D