Home   Help Search Login Register  

Author Topic: Zombie AI, possible?  (Read 558 times)

0 Members and 1 Guest are viewing this topic.

Paralytic

  • Guest
Zombie AI, possible?
« on: 22 Feb 2003, 18:59:26 »
Yesterday I saw the movie "28 days later" and thought it would be cool to do a similar mission to OFP, but the only problem is the AI. Is it possible to disable the original AI and write my own to replace it? If it is, could you give me some hints or a direct link to an AI scripting tutorial.

And how do I do a unit that could attack only using very very short range weapons (0,50 metres maximum)?

Offline D.murphy man

  • Members
  • *
  • I'm a llama!
Re:Zombie AI, possible?
« Reply #1 on: 24 Feb 2003, 20:19:36 »
I had the same proplem and heres my soluation (keep in mind im a n00b to scripting)

all i did was make a .sqs file called it Loop then put init

#loop
Name of zombie  domove (getpos Name of Victem)
~1
Name of zombie2  domove (getpos Name of Victem)
~1
Ect...
goto "loop"

then in game i made a trigger that made the Zombies victem die if the zombie came with in a cetain range of the Victem
TRIGGER SET UP:
condition:
this AND "Name of victem distance _x < 50" count (thislist) > 0

OnActivation: Name of victem setdammage (getdammage player) + 0.5

Its a simple way of doing it but affective.

Paralytic

  • Guest
Re:Zombie AI, possible?
« Reply #2 on: 24 Feb 2003, 20:43:18 »
I'm a total newbie in scripting also..

"this AND "Name of victem distance _x < 50" count (thislist) > 0"
What does that _x and count (thislist) > 0 do?

Can I do a for loop like this:

Code: [Select]

#loop

for(i = 0; i < num_of_zombies; i++) {
    shortest_target = -1;
    shortest = 100;
    for(a = 0; a < human_controlled_players; a++) {
        if(human[a] distance zombie[i] < shortest || shortest_targe == -1) {
            shortest = human[a] distance zombie[i];
            shortest_target = a;
        }
    }
    if(shortest < 100) zombie[i] domove(getpos human[shortest_target]);
}

~1
goto "loop"


What that does (okay that does nothing in OFP, but you'll get the point) is it finds the closest human controlled player and moves towards it.

If that's possible, I wouldn't have to move every zombie separately in the sqs file..

Could someone give me an example how to do that in the OFP scripting language.
« Last Edit: 24 Feb 2003, 20:48:27 by Paralytic »