Results 1 to 3 of 3

Thread: Friendly Stormtroopers

  1. #1

    Friendly Stormtroopers

    I'm having a doozy of a time editing the ai files, etc trying to get stormtroopers to target enemies rather than the player. I've looked in the AI and the COG files and I can't seem to figure out what I'm doing wrong.
    Completely Overrated Facebook:http://www.facebook.com/pages/Comple...59732330769611
    A community dedicated to discussing all things entertainment.

  2. #2
    Admiral of Awesome
    Posts
    12,387
    Quote Originally Posted by Darth J View Post
    I posted this in the cog forum
    No you didn't.

    Code:
    # Jedi Knight COG Script
    #
    # 00_friendly.cog
    #
    # Actor designated by 'friendly' will assist the player once touched.
    # Passive_ai is the actor's AI when not attacking.
    # Angry_ai is the actor's AI when battling an enemy.
    # I'd suggest pednarsh.ai or something of the sort for passive_ai and then
    # use one of the actor's original AI files for it's angry_ai.
    #
    # Example: for a friendly stormtrooper, set the passive_ai to pednarsh.ai and
    # the angry_ai to stdefault.ai.
    #
    # (C) 1997 LucasArts Entertainment Co. All Rights Reserved 
    # Scripted 1998 by Zero. Email at: zero@downeast.net
    
    
    symbols
    
    
    message startup
    message entered
    message killed
    message pulse
    
    sector sec linkid=1
    
    
    thing friendly mask=0x408
    thing player local
    thing enemy local
    
    
    ai passive_ai
    ai angry_ai
    
    
    end
    
    
    # ========================================================================================
    
    
    code
    
    
    startup:
    player = GetLocalPlayerThing();
    AISetClass(friendly, passive_ai);
    return;
    
    entered:
    if(GetSourceRef() != player || GetSenderId() != 1) return;
    SetPulse(1.0);
    return;
    
    
    killed:
    SetPulse(0.0);
    return;
    
    
    pulse:
    enemy = FirstThingInView(friendly, 170, 12, 0x4);
    
    player = GetLocalPlayerThing();
    
    
    if((enemy == friendly) || (enemy == player) || (!enemy))
    {
    AISetClass(friendly, passive_ai);
    return;
    }
    
    
    AISetClass(friendly, angry_ai); 
    AISetFireTarget(friendly, enemy);
    AISetMoveThing(friendly, GetThingPos(enemy));
    AISetLookPos(friendly, GetThingPos(enemy));
    AISetMode(friendly, 0x202);
    AIClearMode(friendly, 0x1000);
    
    
    return;
    
    
    end
    That should work, but I haven't tested it.

  3. #3
    Registered User
    Posts
    604
    My rotten memory said about AI parameter to decide which side the character is on, assuming you're only trying to permanently change a character's side.
    http://millennium.massassi.net/jkspec/ai.htm#a_header

Posting Permissions

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