Home   Help Search Login Register  

Author Topic: the script that dies  (Read 1541 times)

0 Members and 1 Guest are viewing this topic.

Offline Fragorl

  • Coding Team
  • Former Staff
  • ****
the script that dies
« on: 04 Dec 2004, 00:12:36 »
Hello I have a rather annoying problem with a script:
Code: [Select]
? !(local Server) : exit
_person = _this select 0
_group = group _person
_triggerstring = _this select 1
goto "start"
#loop
~0.01
@!alive ((units _group) select 0)
@alive ((units _group) select 0)
~1
#start
_person = ((units _group) select 0);[_person,_triggerstring] exec "AI WIP.sqs"
goto "loop"

The script is called once per soldier at the beginning of a multiplayer game.
The prpose of the script is to make sure another script, "AI WIP.sqs" , runs again and again whenever the soldier dies and respawns. Each soldier is in a separate group, which is why i can use
@!alive ((units _group) select 0)
as the soldier is always the first (and only) unit in his group.

The problem is that the script runs fine for about 10-15 respawns but after this, i start seeing a few soldiers respawning without running AI WIP.sqs. The longer i leave the game going, the more soldiers eventually respawn without it.

Adding the line  
hint "Running"
to the beginning of ai wip.sqs confirms that the script is not running when the soldiers respawn.

Any ideas welcome


Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:the script that dies
« Reply #1 on: 04 Dec 2004, 00:34:42 »
? !(local Server) : exit
_person = _this select 0
_group = group _person
_triggerstring = _this select 1
goto "start"
#loop
~0.01
@!alive ((units _group) select 0)
@alive ((units _group) select 0)
~2
#start
_person = ((units _group) select 0)
[_person,_triggerstring] exec "AI WIP.sqs"

goto "loop"

thats what i would do. The bigger delay is so it won't start lagging and getting behind itself with all the units running this script

Offline Fragorl

  • Coding Team
  • Former Staff
  • ****
Re:the script that dies
« Reply #2 on: 04 Dec 2004, 08:07:33 »
Cheers Triggerhappy

I've been working on this problem for about 2 weeks, and now this idea occurs to me  a few hours after i post.  ::) :-[ . Arg. Not on purpose i swear!

What happens to the ai when they get into the same vehicle as other ai in MP? Do they join the commander's group temporarily, or is this only when the player is the commander?

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:the script that dies
« Reply #3 on: 04 Dec 2004, 16:03:12 »
i don't think so, because when you put multiple groups in a vehicle, you can order them out seperately, so it has to keep a seperate grouping

Offline Platoon Patton

  • Members
  • *
  • "Barbecue" CreateVehicle getpos LLama
Re:the script that dies
« Reply #4 on: 04 Dec 2004, 18:39:41 »
Isnt there a max of groups possible in OFP?

Maybe use player instead of ((units _group) select 0)

Respawn.sqs:

?!(local player):exit
#start
@!alive player
........(Respawn time to do something)
@alive player
[] exec AI WIP.sqs
goto "start"

Run the script with
 ?! (local server):[] exec respawn.sqs from init .sqs

http://www.platoon-clan.com/ We always wellcome dedicated OFP players :)

http://www.european-combat-league.com/index.php To play with us in the best OFP league ;)

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:the script that dies
« Reply #5 on: 05 Dec 2004, 00:38:43 »
yeah that should work

Offline Fragorl

  • Coding Team
  • Former Staff
  • ****
Re:the script that dies
« Reply #6 on: 05 Dec 2004, 10:08:18 »
I've tried to avoid using groups, as my ai script is designed to operate on individual units, where each unit makes decisions based on its environment, viz., how many vehicles there are to drive, whether more footsoldiers are needed that chopper pilots etc.

The max groups (and therefore max units for me) per side is 63, this is way more than enough to work with provided I stagger the scripts when they start up to avoid chug.

I think the problem lies with a couple of scripts from ECP that were interfering with the groupings, namely join.sqs and crew_burn.sqs, in each one a unit has their group changed... :P