ç i p h é r, I know what you want, and I think I can say with relative certainty I've got most of it my head, but I know thats not much of a help

I've got 3 classes this semester with projects each easily as big as the ACR, so its kind of rough (the good news is one of those projects is a membership database application designed for ALFA). Its also very hard to predict what resources need to be shared until we know all of what we have to work with in terms of the API. And I'm trying to limit my involvement until I know for sure if I will participate in ALFA2.
As he says, its easy to make systems which are independant of each other, that requires no organization. Its hard to make systems which depend on each other, and all-too-often software requires features to be added after the fact, changing other dependant systems. Organization bewteen the different people building these different systems can be tough.
This probably isn't the thread for it, but I'd like to propose a more flexible solution to adding content, one that I hope will enable new systems to be added without the need for any changes to the core module event scripts and hopefully increase the modularity of our features. I call them alfa event scripts, and their definitions would be ALFA_EVENT_*. You could associate an event script with anything, but mostly I expect them used for custom feats and items (cursed, magic, etc). Each custom feat would have an event script associated with it, and that one script would handle one or more of the events needed to make that feat work. Items would have an array of any number of event scripts attached to them as local variables. The events would be called from various places
For example, want to make an item cursed? Add a local variable AES_SCRIPT_1 with the value "aes_cursed_item". Want to give it some unique power, or have it turn the wearer into a badger when its equiped? Add the local variable AES_SCRIPT_2 with the value "aes_052_curse1" and submit your custom script to the global tech team. No changes to the ACR would be needed, and the script would be run automatically.
The event scripts themselves would look something like this,
aes_cursed_item.nss:
Code: Select all
switch(event_type) {
case ALFA_EVENT_ONFIRSTCLIENTENTER:
// Entering for the first time, curse the sucka
// (probably based on other local variables)
break;
case ALFA_EVENT_ONUNACQUIRE:
// Don't allow it, the item is cursed!
break;
case ALFA_EVENT_SPELLCASTAT:
// Was remove curse just cast on the item's owner?
break;
//etc.
}
Now as we said before, this item could have a custom power associated with it. We could define that with another script like the one above,
aes_052_curse1.nss:
Code: Select all
switch(event_type) {
case ALFA_EVENT_OWNERCASTS:
if(GetSpellId() == SPELL_ID_MAGIC_MISSILES) {
// The curse also turns his magic missiles into assorted vegtables.
}
break;
case ALFA_EVENT_ONEQUIP:
case ALFA_EVENT_ONENTEREQUIPED:
// Turn the sucka into a badger.
break;
}
Now under the cover, this system would be a bit more complex (such as getting all a PC's and NPC's custom event scripts somewhere they can be quickly retrieved in the case of events like ALFA_EVENT_ONDAMAGED and ALFA_EVENT_SPELLCASTATOWNER, looping through items and feats in those instances is just not an option), but this is the general idea.
Any comments? Off the top of my head, the events I can think of we could need are,
Code: Select all
ALFA_EVENT_ONACQUIRE // called from module event.
ALFA_EVENT_ONUNACQUIRE // ditto
ALFA_EVENT_ONEQUIP // ditto
ALFA_EVENT_ONUNEQUIP // // ditto
ALFA_EVENT_ONFIRSTCLIENTENTER // Called from OnClientEnter, during the ONE loop through the entire inventory.
ALFA_EVENT_ONCLIENTENTER // Ditto, but every time the PC enters.
ALFA_EVENT_ONENTEREQUIPED // Ditto, but if the item is equiped
ALFA_EVENT_PRESPELLCASTAT // Called from spellhook code before spell is fired.
ALFA_EVENT_SPELLCASTAT // Called from spellhook code after spell is fired.
ALFA_EVENT_SPELLCASTBY // Called from spellhook code.
ALFA_EVENT_ONUSE // Called from the module event
ALFA_EVENT_ONREST // Called from the module event
ALFA_EVENT_ONSPAWN // From the creature event.
ALFA_EVENT_ONDEATH // From the module event and creature event.
ALFA_EVENT_ONDAMAGED // From the creature event.
ALFA_EVENT_ONBLEEDING // From HCR code, on-death.
ALFA_EVENT_UNCONSCIOUS // Ditto as above, spells, subdual.
ALFA_EVENT_RAINING // From weather scripts
ALFA_EVENT_SNOWING // From weather scripts
ALFA_EVENT_ONKILLED // From module event and creature event, when something else is killed by the owner.
etc.
These do not have to be limited to items or feats. If we can create some sort of custom effects in NWN2, they could be used there. Also, areas could have event scripts, such as wild magic having an ALFA_EVENT_SPELLCASTS script defined. There are many possibilities.