Results 1 to 8 of 8

Thread: AI spawning behaviour problem

  1. #1

    AI spawning behaviour problem

    I've been condensing a mission into script form so it can be spawned at will and used as an objective (it's a small smash and grab mission) anyway...

    problem is when i create my group of enemies i use the createUnit command and a for var loop:


    Code:
    _grpeast = createGroup EAST;
    
    	"RU_Commander" createUnit [[0,0,0],_grpeast,"this = leader _grpeast;nul = [this,_area] execVM 'Garrison_script.sqf';",0.5,"LIEUTENANT"];
    
    	for "_i" from 0 to 8 do {(_enemymen select (round (random ((count _enemymen) -1)))) createUnit [[0,0,0],_grpeast];};
    
    	{_x setPos (getPos _location);} foreach units _grpeast;
    The _enemymen var is an array full of unit class names which as you can see, it randomly pick from.

    despite my group being of side EAST the units spawned by this command are passive to WEST units.

    any thoughts?

  2. #2
    For some reason it may be fucking up try doing this after your script.

    Code:
    EAST setFriend [WEST, 0];
    WEST setFriend [EAST, 0];
    {_x setCaptive false;} forEach units _grpeast;
    If it still isn't working after that, I don't know what to tell you :P.
    My Work/ Projects

    - Life Project RPG (ArmA 2 Roleplay Mod)
    - Extended Functions Library
    - Loot System

    Spoiler:

  3. #3
    the setFriend worked fine man thanks...... any ideas why your AI spawnees come out without an enemy in mind?

  4. #4
    I would have no idea. I've written random spawning scripts before and never had to use setFriend. Odd one, but I guess just be happy there's a solution and who cares about an answer, amiright?

  5. #5
    well not exactly.... i've personally believe that full understanding of anything allows for further and greater, use and appreciation. If you build something but don't understand why it is the way it is, then you can't diagnose and repair effectively which is almost as bad as not having created it in the first place. Best you can do in those circumstances is take the opportunity to watch and draw a better understanding from what you don't understand.

    just my thoughts

    thanks again.

  6. #6
    When units are spawned they seem to be neutral unless there is a unit of that side on the map, the unit can have probability of presence set to zero.

    The above Setfriend seems to mimic this to some degree.
    I've tried it and it seems a little hit and miss.
    Sometimes I can walk right through them and other times they open fire.

    It seems distance related.
    Have them spawn on top of you and they don't fire, spawn them about 150 meters away and they shoot you.

  7. #7
    Oh now I remember, yeah F2k is right. Place down a non-playable unit of each faction in like the corner of the map with possibility of presence set to 0 and you should never get that problem That's what MSO did.

  8. #8
    cool man thanks

Similar Threads

  1. Problem with spawning script (ArmA 2 OA)
    By undercoverbrother in forum ARMA 2 & OA : MISSIONS - Editing & Scripting
    Replies: 3
    Last Post: Dec 7 2010, 07:21
  2. New behaviour
    By Mr_Centipede in forum ARMA 2 & OA - SUGGESTIONS
    Replies: 3
    Last Post: Jun 16 2008, 11:10
  3. Infinite clones spawning problem
    By Dielos in forum ARMA - MISSION EDITING & SCRIPTING
    Replies: 4
    Last Post: Jan 24 2008, 06:05
  4. Need a new Behaviour
    By Cloughy in forum ARMA - MISSION EDITING & SCRIPTING
    Replies: 4
    Last Post: Jan 26 2007, 22:19
  5. Behaviour
    By benreeper in forum OFP : MISSION EDITING & SCRIPTING
    Replies: 2
    Last Post: Dec 22 2002, 01:17

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •