Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

FPSC Classic Scripts / Friandly AI

Author
Message
eXone 42zero
18
Years of Service
User Offline
Joined: 31st Oct 2006
Location: 7!9
Posted: 31st Oct 2008 20:32
I have been in search of a way to have allies in my fpsc games for a while.
I've been able to script a simple follow-the-player AI, but I haven't been able to make them use their weapons.

So, I did another quick forum search and found this:
http://forum.thegamecreators.com/?m=forum_view&t=98996&b=23

I thought I was golden.
So I downloaded the Sensei AI from the website and attempted to implement it. But alas! The same problem persists!

I read through the code line by line a few times to see if anything was wrong, and I found one place, but I'm not sure if I'm mistaken or not.

Here is the code:


The only thing I can think of is that maybe "settargetname" is not an actual method.

Any ideas?

"There's more to life than being really, really, ridiculously good looking." - Derek Zoolander
Gamer X
16
Years of Service
User Offline
Joined: 1st Feb 2008
Location: Planet X
Posted: 31st Oct 2008 20:46
Look in the "Ally Script Revive" in order to get a mod-free ally.


eXone 42zero
18
Years of Service
User Offline
Joined: 31st Oct 2006
Location: 7!9
Posted: 31st Oct 2008 20:54
Thanks bro I'll check it out.

"There's more to life than being really, really, ridiculously good looking." - Derek Zoolander
eXone 42zero
18
Years of Service
User Offline
Joined: 31st Oct 2006
Location: 7!9
Posted: 31st Oct 2008 21:15
well poo
i need allies that act and think for themselves, rather than the player having to control them

*sigh*

but i did just find out that "settargetname" DOES NOT exist
howsoever, "settarget" DOES exist

so i'm going to try it with that and see what I can come up with

"There's more to life than being really, really, ridiculously good looking." - Derek Zoolander
eXone 42zero
18
Years of Service
User Offline
Joined: 31st Oct 2006
Location: 7!9
Posted: 31st Oct 2008 21:28
haha i just realised that i misspelled friendly in the subject

"There's more to life than being really, really, ridiculously good looking." - Derek Zoolander
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 31st Oct 2008 22:01
"settargetname" was added in V1.04 and never added to the manual. It's real, and it works.


If you don't like the current AI being offered, I'd go make my own ally AI if I were you.


The one and only,


Those who live in the past, are destined to insanity. Those who live only for the future, will be slaves to their ambitions.
Those who live in the moment... only they, are truly happy.
eXone 42zero
18
Years of Service
User Offline
Joined: 31st Oct 2006
Location: 7!9
Posted: 31st Oct 2008 22:22
wait are you for cereal?
so settargetname does exist?!?!
son of a...

do you happen to know the difference between the two?
dif between settarget and settargetname?

what do they actually do?

or even better, is there an updated action list and/or condition list?

sorry for all the questions
i'm very ambitious haha

and yeah i am in the process of taking bits and pieces of friendly AI that i like and putting them into one AI that i'll tweak until i get it just right

"There's more to life than being really, really, ridiculously good looking." - Derek Zoolander
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 31st Oct 2008 23:47
settarget

No parameters are accepted for this action. It will set the entity's target to the last "noticed" entity by other commands. Ex. "plrcanbeseen" will set the player as the last "noticed" entity.


setargetname=X

Will set the entity's target to the entity whose name is specified by X. Ex. settargetname=Ally will set the entity's target to the entity whose name is "Ally"


The one and only,


Those who live in the past, are destined to insanity. Those who live only for the future, will be slaves to their ambitions.
Those who live in the moment... only they, are truly happy.
eXone 42zero
18
Years of Service
User Offline
Joined: 31st Oct 2006
Location: 7!9
Posted: 1st Nov 2008 00:53
ok that's what i was thinkin
when i finish writin this thing up i'mma test it

cause the other fpi files that used the settargetname=x method seemed to fall short of doing so
like the command wasn't supported or something

i might just go back to 1.04 and install each update in order til 1.13 just in case something got left out

"There's more to life than being really, really, ridiculously good looking." - Derek Zoolander
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 1st Nov 2008 01:19
No, just updating directly to 1.13 will provide everything.


The one and only,


Those who live in the past, are destined to insanity. Those who live only for the future, will be slaves to their ambitions.
Those who live in the moment... only they, are truly happy.
eXone 42zero
18
Years of Service
User Offline
Joined: 31st Oct 2006
Location: 7!9
Posted: 2nd Nov 2008 07:42
hmmm ok
i will give it another try then

problem is still that the AI will not engage the target
dunno why but i suspect settargetname is the culprit

we shall see

thanks for all the help by the way

"There's more to life than being really, really, ridiculously good looking." - Derek Zoolander
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 2nd Nov 2008 08:45
It's not the culprit, I know it works just fine.


Post the script you're using here and I'll take a look at it. Also, tell me exactly how you're setting everything up.


The one and only,


Those who live in the past, are destined to insanity. Those who live only for the future, will be slaves to their ambitions.
Those who live in the moment... only they, are truly happy.
eXone 42zero
18
Years of Service
User Offline
Joined: 31st Oct 2006
Location: 7!9
Posted: 2nd Nov 2008 22:40
ok here's what i've got so far:


all it does right meow is have the ally follow the player around, hold position when you press G, and supposedly return fire
it also makes the ally reload when empty, and take cover while holding position/reloading
i'm getting ready to test it out
lemme know if i did something wrong

"There's more to life than being really, really, ridiculously good looking." - Derek Zoolander
eXone 42zero
18
Years of Service
User Offline
Joined: 31st Oct 2006
Location: 7!9
Posted: 2nd Nov 2008 22:47
i'm eventually going to have allies that take evasive action when taking fire from enemies, and play sounds from a custom soundset when taking damage as well as speak for certain parts of the story
since there's no mouth animations, the characters will use a comm radio to communicate with the player
and, like in halo, the player will not respond to his allies except in story mode (video cutscene)

this script i posted is just the meat of the ally script i've got so far
i don't know if it works or not though
i'm doing theology homework right meow or i'd test it\
and i have 1.13.006

"There's more to life than being really, really, ridiculously good looking." - Derek Zoolander
CoffeeGrunt
17
Years of Service
User Offline
Joined: 5th Oct 2007
Location: England
Posted: 2nd Nov 2008 22:49
Use ROTATETOPLR when it's following him.....

FREEZE will immobilise it, don't use that...

It can't freeze and animate at the same time, the reload won't work...

Otherwise, it looks good. You may want to add a line where it checks if te player has shot it, then make it run the Strafe10.fpi script to show it's got angry with the player using it for target practice....

eXone 42zero
18
Years of Service
User Offline
Joined: 31st Oct 2006
Location: 7!9
Posted: 2nd Nov 2008 22:52
if you're wondering about the "meow" it's from super troopers

"There's more to life than being really, really, ridiculously good looking." - Derek Zoolander
eXone 42zero
18
Years of Service
User Offline
Joined: 31st Oct 2006
Location: 7!9
Posted: 2nd Nov 2008 22:55
thanks i'll change that
i also added the line:
:state=3,scancodekeypressed=34:state=2,animate=1
so that the player can make the ally hold a position even while in combat
i almost removed state=1 from the original line, but then i thought why would you want to have an ally hold a position if you haven't gotten to his starting position in the level yet?
hmm

thank you very much i'll take your suggestions

"There's more to life than being really, really, ridiculously good looking." - Derek Zoolander
eXone 42zero
18
Years of Service
User Offline
Joined: 31st Oct 2006
Location: 7!9
Posted: 3rd Nov 2008 02:24
ok bad news
the script doesn't work
no clue why
sombody else will please test to make sure it's not just my machine that's givin it trouble?
thanks

"There's more to life than being really, really, ridiculously good looking." - Derek Zoolander
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 3rd Nov 2008 04:43
Quote: "the script doesn't work"


What is it doing that you consider to be "not working"?

Does your ally just stand there and stare into dimensions yet unknown? Does he shoot you for pointing your gun at him? Does he ignore your orders and instead go play Halo cuz your game isn't quite as good? Does he dress and drag and do the hula? We kinda need a bit more info to go off of here.


The one and only,


Those who live in the past, are destined to insanity. Those who live only for the future, will be slaves to their ambitions.
Those who live in the moment... only they, are truly happy.
eXone 42zero
18
Years of Service
User Offline
Joined: 31st Oct 2006
Location: 7!9
Posted: 3rd Nov 2008 07:22
ok yes sorry
my ally (let's call him phil)
so, phil will follow me around just fine, and at a good pace too
he doesn't get stuck on corners or staircases
and he doesn't get stuck on doorways either
howsoever
when i come in contact with an enemy, more specifically the enemy specified by phil's "settargetname" command, he does nothing
he'll just continue to follow me around until i kill him or press G to have him Guard/hold position
and when i press G, phil stops, reloads his weapon, and ignores me

i feel so unwanted... (*sob*)

and no, phil doesn't go around in drag in any point of the gameplay
those allies come later in the game
the national rifle association's tenth transvestite wing or something...

not quite sure about that yet, but uh... yeah...

if you don't listen to eddie izzard, that joke went right over your head probably

so yes, that's all that happens
if nothing else, i might just want to have my allies fire blindly down the street in the direction of the enemies, which will in turn cause the player to have to do some actual work instead of letting the SAS and Spetsnaz operatives carry the him/her to the glorious end of the game

just a thought
most of what i'm doing is for theatrical effect, so blindfire is better than no fire

"There's more to life than being really, really, ridiculously good looking." - Derek Zoolander
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 3rd Nov 2008 11:24
Well for starters, your "engage enemy" is in state 3, and the only way for your script to GET to state 3 is for it to be in state 0 and for the player to NOT be nearby and hope to god that those random conditions don't become true.

May wanna give him a way to get into that engage enemy state WHILE he's following you.


The one and only,


Those who live in the past, are destined to insanity. Those who live only for the future, will be slaves to their ambitions.
Those who live in the moment... only they, are truly happy.
eXone 42zero
18
Years of Service
User Offline
Joined: 31st Oct 2006
Location: 7!9
Posted: 3rd Nov 2008 16:05
ok i'll check it out
thanks

hopefully test it tonight
we'll see

"There's more to life than being really, really, ridiculously good looking." - Derek Zoolander
eXone 42zero
18
Years of Service
User Offline
Joined: 31st Oct 2006
Location: 7!9
Posted: 3rd Nov 2008 16:25
ok here's the edit:
haven't tested it yet because i'm at school right meow



not quite sure if ":state=1:state=3" will allow the ally to engage the enemy while following the player, but we'll see

perhaps the desired behavior should be that the ally stops following the player to engage the enemy, then resumes his puppy-dog behavior when the enemy entity is dead

are there conditions to test for line of sight between entities (such as that between an ally and an ememy)?
and is there a condition to test whether the entity is dead or not?

also for holding position, how can i first stop the ally from moving, then have him crouch by default, then stand/move to engage the enemy?
i think i tried "freeze,animate=81,state=3" but someone told me that i cannot freeze and animate at the same time

makes sense

but that still doesn't solve the problem

if all else fails, i'll put a "crouched" state, with a timer, so when i press G, he crouches for a set amount of time, then changes to the "attack" state

this is becoming more of a task than i had anticipated

"There's more to life than being really, really, ridiculously good looking." - Derek Zoolander
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 4th Nov 2008 07:44
AI is a big deal, it is definitally a big task to make it good, else we would have had the ultimate AI by now.

Let's start from the top... with the script:
- You need to have some way of the entity "possibly following player", "accepting commands", "engaging enemy", etc. all at the same time.
- As soon as the script reaches state 3, the Ally will target an enemy even if he canot see that enemy and he is not even remotely close to that enemy. *PROBLEM*


We'll leave it at that for now. Basically, to get him acting on everything at onc, you'll need to have some sort of "transitional state" that will check for the NEED to go to any of the other states. Like.... first it'll check if he NEEDS to target an enemy, then it'll check if he NEEDS to follow the player. You'll also need to have some sort of transition from the specific states into the other states when necessary... for example, WHILE he is following the player, you'll want to check for if he NEEDS to engage an enemy or if he has been given a command to stay. And following this, you'll want to do the same for your "stay" state engaging the enemy/re-following the player. Also for the engage state, it may be in his best interest to stop fighting if the player gets too far away from him.



That's a lot... I know. I always encourage new scripters to start simple, but if you're ambitious, I'm not one to stop you from tackling the hard stuff first.


Quote: "are there conditions to test for line of sight between entities (such as that between an ally and an ememy)?
and is there a condition to test whether the entity is dead or not?"


There is no "targetcanbeseen" command, nor is there a "targetdistwithin" command, unfortunately.

I'm not entirely sure, but the ally MAY automatically "release" his target if that target has died.


As for stopping him, I think if you simply stop using the "followplr" command, he'll stop at his next "follow marker". The rest of this, I'll leave up to you to figure out.


That does it for today's lesson!


The one and only,


Those who live in the past, are destined to insanity. Those who live only for the future, will be slaves to their ambitions.
Those who live in the moment... only they, are truly happy.
eXone 42zero
18
Years of Service
User Offline
Joined: 31st Oct 2006
Location: 7!9
Posted: 4th Nov 2008 09:18
ka-klunk
and in to the brain it goes
thank you very much i'll work on this over the next day or two when i have time

and alas!
those targetcanbeseen and targetiswithin conditions that i need...
crap on a stick as far as that's concerned

so now this means that unless they update the engine's conditionlist, i can't have my AI check if objects are in its walking path to the destination either...

so i might just use waypoints for the sake of the theatrical effect needed
this way, our dear phillip will not get stuck on anything along the way, and the player will seem like more of a squad member following his teammates around rather than a fearless leader, charging into packed rooms and hoping that they follow him

another issue i haven't yet brought up is phil's health
now, for the player, there is a plraddhealth=X command which accepts a positive or negative integer as an argument
but does a similar command exist for other entities?

"There's more to life than being really, really, ridiculously good looking." - Derek Zoolander
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 5th Nov 2008 03:33
In Phil's script you can use a "addhealth=X" comand to add health to him (or take it away with a negative number)


The one and only,


Those who live in the past, are destined to insanity. Those who live only for the future, will be slaves to their ambitions.
Those who live in the moment... only they, are truly happy.
eXone 42zero
18
Years of Service
User Offline
Joined: 31st Oct 2006
Location: 7!9
Posted: 5th Nov 2008 03:56
sweet tits

"There's more to life than being really, really, ridiculously good looking." - Derek Zoolander

Login to post a reply

Server time is: 2024-11-24 13:46:28
Your offset time is: 2024-11-24 13:46:28