ElijahSnowFan's latest AI scripting issue: Understanding/using Active Defense

Started by ElijahSnowFan, March 21, 2009, 05:56:24 PM

Previous topic - Next topic

ElijahSnowFan

hi, all!

so, periodically i have to stop in here and remind everyone about how much i DON'T know about scripting AI. trust me, nothing is as humiliating as working on AI, then thinking you've got it right...and it doesn't do ANYTHING like you expected. ha! but i can still laugh at myself.

but today's issue/project: Active Defenses, particularly Force Fields. now, here's a sample AI i have for a character who can create a hard-light force field that can stop bullets and thrown items:

"TActiveDefense('proton shield',time=1.23,mindist=0,maxdist='medium',subtype='ranged_crushing or ranged_piercing',defense_time 1.7)",

now, to my mind -- and again, i realize i haven't mastered this, by any stretch -- this character should use their force field when an enemy is using a ranged attack capable of causing piercing or crushing damage ONLY.

to my mind, it should not use it at any other time, especially when facing a character who does not have any of those types of attacks.

but what this character does is not only turn the force field on immediately upon the start of the Rumble Room session, it continues to use the force field repeatedly, no matter the situation or character it is facing.

soooooo...if somebody could please offer an opinion, what am i screwing up, here? or if someone could post an Active Defense script for FFvsTTR that they use and really like so i could see it and adapt it, i'd love to see that, as well.

i've been having a lot of fun with this game lately by tweaking the AIs, with some of the advice/tips i've gotten in this forum. i'm hoping you guys can come through again!

laughing paradox

Add something in the middle there like this:

pct=20,priority=100

Also, I am not familiar with "defense_time 1.7" at the end there. I've always seen it just as "time=3.08" or whatever the amount of time it is for the animation of the particular move to complete.

Hope that helps.

Xenolith

Active defenses can be very frustrating.

I think it should read: "defense_time=1.7", not "defense_time 1.7".  As to why the AI uses it all the time: Perhaps many of the opposing AI have that condtion met.  I dunno why the power triggers all the time.

Just sort of thinking out loud, maybe this would work?

"TActiveDefense('proton shield',pct=100,time=2.3,mindist=0,maxdist='long',type='enemy',situation='ranged_crushing or ranged-piercing',priority='high',defense_time=1.7)

Let us know what you come up with.  :)

M25

defense_time is used by the AI to determine how long an active defense lasts, in seconds.  Short is 10 seconds, medium is 20 seconds and long duration is 30 seconds (I think).  So setting it to 1.7 seconds would cause the AI to restart its defense over and over again.

However, Xenolith is right, there's an error in the tactic, and chances are that AI definition wasn't being loaded correctly.  You really don't need to specify defense_time, since the AI can figure it out on its own. 

Your intuition is right though.  The AI should use the defense when an enemy is in the range you specify and is capable of throwing piercing or crushing attacks.


stumpy

Slightly OT but, just out of curiosity, I have a question about how the AI knows when not to attack a character with his AD turned on. How do you determine when an AD is on and when it isn't? Or, do you just assume that if a character has one, he's using it?
Courage is knowing it might hurt, and doing it anyway. Stupidity is the same. And that's why life is hard. - Jeremy Goldberg

ElijahSnowFan

thanks for the feedback, you guys -- i've said it before, but you guys are really awesome to communicate with. this is easily the most responsive and helpful forum i've ever participated in, on any web site. seriously.

thanks!

M25

stumpy,

The AI knows when other (custom) AI's have used their active defense, but I don't know of a way to detect when a player or built-in AI has used their defense.


stumpy

Gotcha. The scripted AI knows when some AIs are on because it turned them on.  :) I was thinking you might have come up with a heuristic for character ADs or ADs controlled by the game's internal AI.
Courage is knowing it might hurt, and doing it anyway. Stupidity is the same. And that's why life is hard. - Jeremy Goldberg