Aller au contenu

Photo

Overriding EVENT_TYPE_SPAWN + header file in custom script?


  • Veuillez vous connecter pour répondre
9 réponses à ce sujet

#1
Joshua Raven

Joshua Raven
  • Members
  • 182 messages
I'm trying to alter certain autolevel changes in the sys_autoscale_h.nss header file but I can't get the changes to work.

What I've done so far:

  • Change the following code in sys_autoscale_h.nss:
    // limit max level per appearance
    int nMaxScaleLevel = GetM2DAInt(TABLE_APPEARANCE, "MaxScaleLevel", nApr);
    
    To:
    // limit max level per appearance
    int nMaxScaleLevel = GetM2DAInt(TABLE_APPEARANCE, "MaxScaleLevel", nApr);
    
    if(GetCreatureTypeclassification(nApr) == CREATURE_TYPE_DARKSPAWN
      || GetCreatureTypeclassification(nApr) == CREATURE_TYPE_DRAGON)
      nMaxScaleLevel = FloatToInt(nMaxScaleLevel * 1.75);
    else
      nMaxScaleLevel = FloatToInt(nMaxScaleLevel * 1.5);
    
    if(nMaxScaleLevel > 20)
      nMaxScaleLevel = 20;
    
  • Copied the entire EVENT_TYPE_SPAWN case from creature_core.nss to creature_mymod.nss
  • Saved/Compiled both the sys_autoscale_h and the creature_mymod scripts
  • Placed both files in the override directory, removing all other files
  • Created a custom engineevents_mymod.gda file including:

    ID   Label               Visualizer    Script
    int  string              comment       string
    [b]3    EVENT_TYPE_SPAWN                  creature_mymod[/b]
    
  • For testing purposes I also added some logwrites in the header and in the creature_mymod file, but somehow no logs are written into the dragon age log (I have script logs enabled).
  • I also tried editing some other values in the header file that would be more easy to spot (like total health) but none of the values show ingame, not with current saves and not with completely new characters.


Am I missing a step here? I haven't messed with header files before so I'm guessing there's something wrong in the way I go about changing it and then compiling the script that uses the header file (creature_mymod)?

Modifié par Joshua Raven, 29 novembre 2009 - 07:28 .


#2
Joshua Raven

Joshua Raven
  • Members
  • 182 messages
 No one who can help me out with this issue 6 hours later? :blush:

#3
Craig Graff

Craig Graff
  • Members
  • 608 messages
People in general are going for engine event overrides a bit too often. Are you accounting for the fact that overriding EVENT_SPAWN will also override the script for placeables and possibly stores? If you are changing autoscale_h, why are you bothering to make a different script instead of modifying creature_core? (I realize there are valid reasons to do so, I just wonder what yours are.)



As to the actual problem you are having, I don't see anything obvious. Any chance you could post your code?



I would also recommend the standard things (though it sounds like you've already done them): make sure you don't have duplicate files in other override directories; double check that your script is compiling; use PrintToLog instead of PrintString; make sure that the .xls has been processed correctly into a .gda file; etc.




#4
Joshua Raven

Joshua Raven
  • Members
  • 182 messages
Thanks for the reply. As for your your questions:

  • I noticed the overriding of placables because I could no longer select barricades in a certain location while fighting Darkspawn, I was unaware (and foolish to not check) that the event was triggered in other core scripts as well
  • The Reason why I created a new script was that I didn't want to override the entire creature_core script as that might cause serious compatibility issues with other mods out there and I already had a script file that triggered on the EVENT_TYPE_ATTACKED event so I just worked from in there.
  • Actually, I didn't change a single thing in the EVENT_SPAWN type, I only modified the header, but I needed a script to be compiled for the changes in the header to take effect
  • Yes, I did remove duplicate files in override directories, the script compiled and the creation of the engineevent m2da file was succesfull (I know, since the EVENT_TYPE_ATTACKED event does fire in the game...
  • I did use PrintToLog, but even so, health changes wheren't working as well, so it's obvious the changes don't fire at all

Is there another, more elgant way to make changes to the autoscale header and have the changes take effect ingame?

Modifié par Joshua Raven, 30 novembre 2009 - 12:20 .


#5
Nodrak

Nodrak
  • Members
  • 144 messages
If you are trying to make this mod the OC, then make your changes in the autoscale header, and then just compile creature_core. All creatures will use your override script if its in the override folder, no 2da editing needed. See my sig for details.

#6
Joshua Raven

Joshua Raven
  • Members
  • 182 messages
Thank you for the help Nodrak. But what about other mods that edit parts of the creature_core? Isn't it bad practice to simply compile the entire creature_core script file and place it in the override directory? That's why I thought it'd be best if I used an event override in the engineevents.gda file and have the event handled in a custom script?

#7
Nodrak

Nodrak
  • Members
  • 144 messages
Sorry for the late reply. One thing to understand about modding is that there will always be mod conflicts. Everything that is not defined in an m2da, is handled in the script, overriding an event call can be troublesome for large events unless you want to reproduce all the logic it had, which you might as well just override it. If you override this event for example, your mod will still effect other creature mods, just that now you have to run all the normal spawn logic in your script, which another mod will not know. A huge portion of the creature_core script is about spawning them. If you want your mod to possibly work seamlessly with unknown mods, then focus on m2da editing.

Your change can be done in a 2da if you wanted. Also, nMaxScaleLevel is -1 for a majority of the Darkspwan and Dragons... If you are worried about overriding the core scripts, just change a few lines in an m2da (for this purpose).

Massive logical changes to the game rules should be in an all inclusive package anyways, like yours, and any appearance changes, property additions, spell additions (non-unique), etc, can be done in m2da.

To achieve total programming modularity would likely be an insurmountable task, so far DAO and the Unreal engine are the only ones I know of with this high of an end user modularity. NWN2 was much more constrained for example (afaik, I didn't to much modding there, only building).

EVENT_TYPE_SPWAN is handled in at least 6 places, Creature_core, Player_Core, Rules_core, Placeable_core and Trigger_core and sys_treasure.  By overriding this event from the m2da, you are essentially breaking 5 core scripts, instead of just overriding Creature_core to compile a changed header (or m2da edting the value).

Modifié par Nodrak, 04 décembre 2009 - 09:10 .


#8
Challseus

Challseus
  • Members
  • 1 032 messages
Hey Josh, quick question. Regardless of whether it was appropriate or not, were you ever able to override EVENT_TYPE_SPAWN in your events M2DA?

Thanks.

Modifié par Challseus, 04 décembre 2009 - 03:28 .


#9
Joshua Raven

Joshua Raven
  • Members
  • 182 messages
Hey Challseus, no I didn't.

After this tread I disbanded the idea. Instead I edited the appropriate header file (sys_autoscale_h) and recompiled the creature_core script.

Sure, it will now conflict with some other mods, but since my mod is becoming a kind of "Overhaul" mod, I guess there where bound to be mod compatibility problems in the near future anyway.

#10
Challseus

Challseus
  • Members
  • 1 032 messages
Okay, thanks anyway. Good luck with your mod.