Hey,
A while ago I read a dissertation about AI in computer games, more in specific making them feel alive. It went on in detail about a system of needs an actor would have in the world, and how he would find ways to satisfy these needs. The best example being put out being the Sims games of the past years. You build them a house with stuff and they get hungry so they go cook, or want to take a bath and go to the bathroom.
So that got me thinking back on my NWN script days and I got the itch again to try something likewise on my own. But then I started thinking about what NWN actually is. It's a computer representation of D&D where a DM would tell a story and it plays out with the players doing actions triggering events ... So this sounds terribly familiar with how a regular computer program works. You do an action like press a button and an event gets send to an eventhandler that launches some backendservice to handle the event. This could perfectly be replicated in the NWN2 or NWN1 engine with not that much trouble. In principle ... what I did tend to forget is that it was way to long ago that I scripted in it let alone know any of the libraries and the Aurora quirks like no arrays and no list, sets or maps ... hell to be without for a java programmer !
However I wouldn't let that stop me and started to design a system of scripted dm's. Basicly what it comes down to is that you will have invicible placeables that will act as a DM and guide a story or handle the daily life of a village. I started out with something simple, a village needs x amount of grain so that a miller can turn it into flower and a baker can use that flower to make bread. When the villagers get hungry they will come and fetch that bread.
With a prove of concept like that I could go on to bigger braver things. Like for instance orcs in the mountains multiply after x hearthbeats , raising their need for expantion and when that need is met , an orc camp would appear on a random spawn location in the world. When to much orc camps appear the villages get restless and put out a quest on a notice board for a PC to clear out an orc camp. This as just a small thing of what would be possible. Each event/story would then be guided by a scripted DM invincible object somewhere in the world.
I started scripting and got a system running with a fixed need of 5 grain to send a farmer off to a field to do some farming. The backbone is working , however actually making a farmer walk over to the right waypoint, looping a digging animation, and such is giving me more headaches then I would like for such a simple action.
So my question after this lenghty introduction , is there somewhere a nice tool that let you search through the NWN2 script library for functions cause the toolkit script IDE is well terrible. I found a BioSearcher program , but that one doesn't seem to be working at least not on my system, it crashes with what I believe a Nullpointer on a memory address ... it's Delphi and I'm a java dev so it's hard for me to figure out the exception being thrown.
this is the script I'm trying to complete my problems are:
- How can I find out if a creature is allready present at the waypoint
- How can I loop constantly a digging animation
- How can I make the farmer walk to the waypoint in the first place without getting stuck behind a rock or house or ... well whatever (I know waypoints in NWN2 where a drag)
void handleFarmActivity(object farmer){
string phase = GetLocalString(farmer, VAR_ACTIVITY_PHASE);
PrintString("FARMING PHASE:" + phase);
if(phase == PHASE_INITIALIZE){
//farmer should go to a farm waypoint that is not occupied yet
//once reached upgrade phase to PHASE_FARM
}
if(phase == PHASE_FARM){
//set a duration local int on the farmer measured in HB ticks if not present
//each time we enter this phase, decrease duration with one
//on duration zero create one GRAIN token in the farmer inventory and upgrade phase to PHASE_DELIVER
}
if(phase == PHASE_DELIVER){
//let the farmer go to the area stock object
//once arrived move grain object from farmer inventory to stock object inventory
//upgrade phase to PHASE_COMPLETED
}
if(phase == PHASE_COMPLETED){
//just let the farmer walk around a bit the DM will assign him a new task soon
}
return;
}





Retour en haut






