News:

Happy 20th, FFvT3R!

Main Menu

Modding AI

Started by freedomje, March 12, 2013, 11:18:02 PM

Previous topic - Next topic

freedomje

Is there anyway to do this?  There is one mission in particular that i would love to mod. the pinstripe warehouse, where Order goes wandering and tries to bash down warehouses..   though he ends up skipping buildings, running ahead, and basically gets himself killed all the time..  (especially on higher difficulties) 

I would love to see about trying to fix his AI,  (make sure a building is completely smashed, and no villains left in that area before he moves on)

Id think this would be a task as honestly i never have modded AI before..  But i think it could make for a fun project..


If that is not possible, I was wondering about a work around fix..  basically spawning Order in the mission, and removing his AI, and making him player controled..  (this really would be the best, but kinda take away from the tone of the mission)


Has anyone done anything with this, or know how i could perhaps get started?  (links to anything that might help me would be great) 


I just stumbled across this site the other day, and am new..  But i am a rabid FF fan.. and have been since 2002..   :)

stumpy

Welcome to FR, freedomje! Glad to see that long-time players are still discovering us. :)

I don't recall if there is anything tricky in the scripting IG used to get Order to attack the buildings. It would require a little programming knowhow to get him to do it and not get stuck and to be smart about knowing when to keep going after buildings and when to stop and take down the thugs that attack him while he is doing that.

If you want to take a look at the code that sets up Order's activities in that mission, see the script ../Data/Missions/11b_docks/mission.py. About 3/4 the way down, the list for the starting cut-scene (intro) is defined and it sets some AI goals for Order, including killing the four warehouse buildings. It looks like some experimentation was done to get Order to attack the baddies as well, but that has been commented out. The reason could be that those commands caused Order to act badly or get stuck or get killed taking on too many baddies at once. Or, those commands could be commented out because having Order fighting the baddies made the mission too easy for the player. I am not sure. But, if you want to play with it, that's probably where to start. You will also want to have some working knowledge of python (though IG never does anything too fancy in the mission scripts) and the Scripting documentation that comes with FFEdit will be helpful, too.

Anyway, the option you suggest (making Order a team member in the mission) is doable. But as you note, it changes the story logic of the mission a bit. But, it's possible to choose one fewer heroes at the base and then Order could join the team after the Law/Order cut-scene.

Another option would be to write a little heartbeat script that checks Order's health every so often and has him hoof it toward the player's party (e.g. Minute Man) if he is at less than 50% health. That way he at least might last a little longer and the people attacking him would have to take on the party as well instead of whittling down Order on his own.

Actually, lots of approaches might work there, depending on what you think is reasonable. And, as you note, it would be a good project to get familiar with some of the AI commands. But, getting a character to do something can be tricky, so have some patience with it. If you haven't done any other FF scripting, this would be a challenging place to start.
Courage is knowing it might hurt, and doing it anyway. Stupidity is the same. And that's why life is hard. - Jeremy Goldberg

freedomje

thanks for the info, I guess i will have to do some reading on how to go about modding this stuff.  I have never modded FF, and only have done mods using tools.   basically i worked on a big module for neverwinter nights back in the day.  I also used some mission builders.  This is just one missiion that is fun,, But order is such a PIA.

As far as difficulty goes, It changes drastically depending on how you set up your team, and how uses the XP canisters as i'm sure you know.  Get some noobies on the team, and the mission takes on a whole other level of challenge, especially on higher difficulties..


anyways, Onto the scripting..

My thought was to add a check to make sure the first building is completly destroyed before moving on, another level i was also thinking was to also add a check to make sure all the baddies in the area are dead before moving on..   perhaps add a new path flag as well to make him goto the middle of the map, when walking from the 3rd building to the final..

So often does he go brain dead, skip half the buildings, and beeline to the final building were he gets killed by like 8 guys.

Or sometimes he just stands their and gets shot from a guy from a roof top.. and doesnt move..  atleast Bash the building the dude is standing on!

another thing i noticed that he can get bugged too from liberty lads schoolyard taunt.  And often will just stand and do nothing in the final battle, unless you taunt him, or he gets enraged.


I just thought this might be a fun mission to mod, and making him smarter could be a fun learning experiance..  I have never done any AI coding before, so it will be a challenge. what's the worse that can happen?  I suppose having to reinstall the game.. :)

stumpy

#3
I definitely encourage you to dig around the innards and try fixing the aspects of the mission (and the maps, the characters, etc.) that don't seem to work well. That's how I got started scripting (I had never used python for anything before) and I've since scripted missions and written some code that is often used in FF. All that started with me wondering if I could get a couple silly things in the default game to work better. :)

Regarding Order, one problem that can occur in the game, especially near objects with complex shapes like partially destroyed buildings, is that the path planner gets confused and doesn't know how to move the toon, so he just stands there. It's been a while since I played that mission, but I seem to recall that that is part of the problem with Order: He smashes buildings, but eventually gets 1) stuck near a broken building and doesn't move or 2) leaves a building when it is partially destroyed and moves to another building.

The second issue I suspect is a consequence of the way buildings are destroyed, not always leaving an attacker more near the remaining parts of the building than to another target building. But, that isn't the bigger of the two problems, because Order will eventually go back to finish off the buildings when he runs out of targets. I am pretty sure that the final building of that area (the one near where Pinstripe appears) is far enough away from the others that he will destroy it last, assuming he doesn't get stuck and can find a path to the other three.

The first issue is annoying because Order just standing around stuck and getting pecked to death by any thugs who spot him is really annoying. However, it may be possible to address this with a very simple fix. The game uses an object attribute called pathBudget to determine the computational resources to give to path planning. A low pathBudget means that a toon will likely get stuck if he wanders near complicated shapes, which is exactly what Order does. According to the documentation, a pathBudget of a couple hundred is low and a couple thousand is high. I think that by default, this attribute is left unset and it defaults to something fairly low for most NPCs.

If that's the problem, then the fix is pretty simple. By editing the order_neutral object in the Templates tab and setting the attribute to something higher (say 1000), Order might act more reasonably. I don't recall if any change to the template has to take place before the campaign starts or just before the mission starts. Alternately, one can add a command to the script for that mission that set's Order's pathBudget to something higher. E.g. Object_SetAttr('order_standin','pathBudget',1000), which is also something one can try from the console to see how well it works.

You mention making sure that Order destroys one building before moving on to the next. That would be fairly straightforward to script. In the mission script, instead of adding all of the buildings to Order's AI goals at the beginning, add only the first one. Then, in the regDeath event handler for each building BuildingDown() (that function runs as each building reaches 0 health), have it add the next building to Order's AI kill goals.

BTW, probably like many FF players, I also enjoy NWN. Which NWN module did you work on?
Courage is knowing it might hurt, and doing it anyway. Stupidity is the same. And that's why life is hard. - Jeremy Goldberg