Scripting Squad AI

Topics regarding Scripting with Reality Factory
Post Reply
Matte
Posts: 321
Joined: Fri Oct 19, 2007 7:49 pm

Scripting Squad AI

Post by Matte » Thu Aug 21, 2008 2:40 pm

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!

User avatar
ardentcrest
Posts: 735
Joined: Wed Jan 25, 2006 10:55 pm
Location: Ireland

Re: Scripting Squad AI

Post by ardentcrest » Thu Aug 21, 2008 4:17 pm

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
He's a Bot Jim, But not as we know It.

Matte
Posts: 321
Joined: Fri Oct 19, 2007 7:49 pm

Re: Scripting Squad AI

Post by Matte » Fri Aug 22, 2008 9:04 am

I'll take a look at that, thanks.

User avatar
ardentcrest
Posts: 735
Joined: Wed Jan 25, 2006 10:55 pm
Location: Ireland

Re: Scripting Squad AI

Post by ardentcrest » Wed Dec 17, 2008 5:41 pm

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.
He's a Bot Jim, But not as we know It.

User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Re: Scripting Squad AI

Post by Juutis » Fri Dec 19, 2008 7:17 pm

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.
Pain is only psychological.

User avatar
ardentcrest
Posts: 735
Joined: Wed Jan 25, 2006 10:55 pm
Location: Ireland

Re: Scripting Squad AI

Post by ardentcrest » Fri Dec 19, 2008 7:20 pm

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.
He's a Bot Jim, But not as we know It.

User avatar
ardentcrest
Posts: 735
Joined: Wed Jan 25, 2006 10:55 pm
Location: Ireland

Re: Scripting Squad AI

Post by ardentcrest » Fri Dec 19, 2008 8:44 pm

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
He's a Bot Jim, But not as we know It.

Post Reply