STAR TREK 2d20
Page 47 of 47 First ... 37454647
  1. #461
    Own extension on top makes sense - as long as you do not change the functions which I need to replace (too often)

    Will check the extention you mentioned - hope I can find some code examples to see how RESULT parcel names generated from tables can be changed.

    Found it: NPC Random Treasure Drops
    Last edited by Arnagus; March 24th, 2024 at 21:33. Reason: Added URL for extension

  2. #462

  3. #463
    Quote Originally Posted by SilentRuin View Post
    Just write a simple extension on top of mine and have it do what you want it to do. I know some other loot generator does something to put out map parcels but don't remember what its called.
    Okay, have now done this (will not post here as it contains a copy of your copyrighted/paid onDeath function).
    I have also looked into the NPC Random Treasure Drops extension description, but decided against it as it does not change the parcel names from table rolls, but introduces a complete new type of parcels. Might potentially be configured to do what I need, but too mighty/many other features which I do not (yet?) need.

    I have however a fundamental question: in your onInit(), you are registering a handler pointing to said onDead function. I tried to point it to my modified customOnDead function by replacing the reference during my own extension's onInit():
    Code:
    origOnDead = MapParcelManager.onDead;
    MapParcelManager.onDead = customOnDead;
    Still - the original function is called from the handler.
    It only worked when I was registering my own handler and removing yours (during my extension's onInit()):
    Code:
    DB.removeHandler("combattracker.list.*.status", "onUpdate", origOnDead);
    DB.addHandler("combattracker.list.*.status", "onUpdate", customOnDead);
    Any clue how to avoid this registration/unregistration and rather replace the function directly?

  4. #464
    Quote Originally Posted by Arnagus View Post
    Okay, have now done this (will not post here as it contains a copy of your copyrighted/paid onDeath function).
    I have also looked into the NPC Random Treasure Drops extension description, but decided against it as it does not change the parcel names from table rolls, but introduces a complete new type of parcels. Might potentially be configured to do what I need, but too mighty/many other features which I do not (yet?) need.

    I have however a fundamental question: in your onInit(), you are registering a handler pointing to said onDead function. I tried to point it to my modified customOnDead function by replacing the reference during my own extension's onInit():
    Code:
    origOnDead = MapParcelManager.onDead;
    MapParcelManager.onDead = customOnDead;
    Still - the original function is called from the handler.
    It only worked when I was registering my own handler and removing yours (during my extension's onInit()):
    Code:
    DB.removeHandler("combattracker.list.*.status", "onUpdate", origOnDead);
    DB.addHandler("combattracker.list.*.status", "onUpdate", customOnDead);
    Any clue how to avoid this registration/unregistration and rather replace the function directly?
    You have my permission to use post whatever - that you find useful. Im not territorial like some devs - we are all building on someone elses work - through example or unique effort - feel free to use what helps. Ill look later today if i can figure out what your talking about but you should always try to override and call the original code if you can as many share the same code space and you dont want to stomp on their changes if you can help it. Ive posted on this in these forums if you can look it up.


    Anyway i suspect you should be doing that im sure map parcels gas examples of where im doing that exact type of thing. Also leaves less of an impact or footprint in the code meaning you will less likely damage or be damaged by others code changes.

    Handlers are sometimes tricky in this regard but ill take a look later today.ive found some db things dont get initialized until ondesktop init which can drive you nuts.
    Last edited by SilentRuin; March 30th, 2024 at 19:19.
    Free(Forums/Forge) Extension(FGU 5E):
    Paid (Forge) Extension(FGU 5E):

  5. #465
    Ok in regards to your handler issue. Your solution is fine - but in the end the cause is that onDead function is put into the handler (the pointer) BEFORE you override it. This means while you did override the function its not the pointer (I'm guessing here) that was added into the handler trigger.

    Your solution is one way to address this - another is to move the add handler code into the onDesktopInit (or whatever they changed it to these days I still use my original definitions). Personally, I'd stick with your solution though as either way your going to have to remove the handler I made so that your onDead override is the one that gets added into the handler.

    Its all in the weird way that onInit and onDesktopInit have different things intializing in them. If you have other of my extensions you can see where I've done some pretty wild things to get around these type of issues.

    But gist is - you hack/slash/burn the code till it works "good enough" and call it a day.

    Perfect is not my goal - nor understanding why I had to do the worst workarounds imaginable to get things to work (think polymorphism). Nor will I try to to figure it out.

    Good enough. As is your solution.
    Free(Forums/Forge) Extension(FGU 5E):
    Paid (Forge) Extension(FGU 5E):

  6. #466
    Clear - thanks for the explanation. I suspected the reason might be something like that (order of things, and thus timing) but hoped there would be a more elegant way. But as you said: good enough
    Will likely look into what you did in Polymorphism nevertheless to learn more options to “work-around” things.
    Reminds me: many thanks to keep things out of the vault - this helps a lot! Still trying to sync MNM’s downtime manager to progress with ClockAdjuster, which is a pain as it sits in the vault. Different story (does not belong here); but again - many thanks to ease access to your code!

  7. #467
    Quote Originally Posted by SilentRuin View Post
    You have my permission to use post whatever - that you find useful. Im not territorial like some devs - we are all building on someone else's work - through example or unique effort - feel free to use what helps. Ill look later today if i can figure out what your talking about but you should always try to override and call the original code if you can as many share the same code space and you don't want to stomp on their changes if you can help it. Ive posted on this in these forums if you can look it up.
    Thanks for your permission. Extension is attached and adds an option (in MapParcel section) to switch transferring the content of the "[RESULT] <CT name>" parcel on or off. It also respects to delete then empty [RESULT] parcels.

    Updated: moved to Forge, hence attachment removed.
    Last edited by Arnagus; April 6th, 2024 at 14:29. Reason: Moved to Forge

  8. #468
    Quote Originally Posted by Arnagus View Post
    Thanks for your permission. Extension is attached and adds an option (in MapParcel section) to switch transferring the content of the "[RESULT] <CT name>" parcel on or off. It also respects to delete then empty [RESULT] parcels.
    Feel free to drop it in forge if you wish to maintain it for anyone else - I warn you - that can lead to being a pain in the you know where though.
    Free(Forums/Forge) Extension(FGU 5E):
    Paid (Forge) Extension(FGU 5E):

  9. #469
    V1.53 - Bug - The following was fixed - weapon and armor drops into NPC will now only apply bonus if ID'ed - shield will now respect bonus (if ID'ed) - dexterity bonus will now be applied properly based on "dexbonus" yes/no text and limited to max if present.

    As usual dropping weapons/armor onto an NPC is just to help build the NPC easier. For armor, as it always has been, there is no way backwards to recalculate the previous AC it can only move forward as you add new armor in or manually edit the fields. Same if you have EE (equip/unequip armor) it will only update the AC with the new equipped item - never reset AC back to some previous setting. As its always been this is just a tool to make editing an NPC main page easier with drag/drop of item onto it. Its not magic. You still have to pay attention.
    Free(Forums/Forge) Extension(FGU 5E):
    Paid (Forge) Extension(FGU 5E):

  10. #470

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
DICE PACKS BUNDLE

Log in

Log in