Page 1 of 1

Scripting Squad AI

Posted: Thu Aug 21, 2008 2:40 pm
by Matte
Hi everyone, this is my first attempt to scripting.
I would like to create a squad, consisting of 3 Computercontrolled players and 1 well, just you.
All the squad needs to do is to follow you and shoot everything in sight, but I still want them to be careful, not just to run into the enemy.
Examples are always welcome.

Thanks!

Re: Scripting Squad AI

Posted: Thu Aug 21, 2008 4:17 pm
by ardentcrest
This is an old script might need a little work to get working but it will give you an idea how to do it.

http://dodownload.filefront.com/1156349 ... bbf0f78f00

Re: Scripting Squad AI

Posted: Fri Aug 22, 2008 9:04 am
by Matte
I'll take a look at that, thanks.

Re: Scripting Squad AI

Posted: Wed Dec 17, 2008 5:41 pm
by ardentcrest
I know its an old post. but can someone take a look at the scripts in the link of my other post. I cant get it to work.

I can see 4 others ( yes they are facing the ground I changed that on my computer)

and yes the keys to pick each one are the keys for the first 4 wepons I canged them also

but no matter what i do i cant choses any of the others.


I someone can get this to work it would be a great addtion to the community.

Re: Scripting Squad AI

Posted: Fri Dec 19, 2008 7:17 pm
by Juutis
I tested it and found the problem. The GetAttribute() and SetAttribute() commands were changed since the version those scripts are made for. Just change the line

Code: Select all

if(GetAttribute("character")=1)
in each of the player scripts to:

Code: Select all

if(GetAttribute("character","Player")=1)
And a little modification to ccontrol.s:

Code: Select all

        //monitor character switching
        if(IsKeyDown(K_CHAR1))
        {
            //switch active character
            SetAttribute("character",1,"Player");
        }
        if(IsKeyDown(K_CHAR2))
        {
            //switch active character
            SetAttribute("character",2,"Player");
        }
        if(IsKeyDown(K_CHAR3))
        {
            //switch active character
            SetAttribute("character",3,"Player");
        }
        if(IsKeyDown(K_CHAR4))
        {
            //switch active character
            SetAttribute("character",4,"Player");
        }
That should do the trick if you've followed the instructions in the read-me file.

Re: Scripting Squad AI

Posted: Fri Dec 19, 2008 7:20 pm
by ardentcrest
Thank Mr J.

This update to an old script is going to give the games and demos a good boost.
It will open new doors for the type of games we can now do.

Re: Scripting Squad AI

Posted: Fri Dec 19, 2008 8:44 pm
by ardentcrest
Well this script needs a lot of lot of lot of work

But the backbone of it is there for a good scripter to fix