5E Product Walkthrough Playlist
  1. #1

    5e Initiative rolling

    Maybe someone here can help me out....
    I've been chasing my tail for hours trying to figure out what function in what script is called to roll NPC initiative when the NPC is 1st dropped onto the combat tracker.
    Any help would be appreciated

    Cheers, Steve.

  2. #2
    Is it "addNPC" in scripts/manager_combat2.lua?

  3. #3
    I'll take a look. I'll be annoyed if it is 'cos I'm sure I looked there :P

    Cheers, Steve.

  4. #4
    Yeah Gamerhawaii, that looks about right, I must've looked at that a hundred times and missed it completely.
    Thanks for the push in the right direction

    Cheers, Steve.

  5. #5
    O.K., next question... why isn;t the following working to override the addNPC function ?

    in the onInit function I have this :

    oldaddNPC=CombatManager2.addNPC
    CombatManager2.addNPC=addNPC

    And this as a function

    function addNPC(sClass, nodeNPC, sName)
    Debug.console("Before old addNPC")
    oldaddNPC(sClass,nodeNPC,sName)
    end

    But the Debug doesn't fire.

    This one is really messing with me :P

    Cheers, Steve.


  6. #6
    My prorgramming skills are very limited. But you may have to initialize the function. For fun, try adding:

    local oldaddNPC = null;

    before the onInit function.

    I can't tell you why. I don't understand it. But in my extension, I had to do that to get it to work.

    No promises it'll help, but it's an easy test.
    Fantasy Grounds Unity may be official now, but its release may take a while yet.

  7. #7
    Tried that but no difference. Thanks for replying though
    I think I'm going to come back to this after some sleep, it's been a long day and odd behaviour seems to be happening

    Cheers, Steve.

  8. #8
    Infact, I think the problem is that that is not the funtion that delas with the initiative when an NPC is 1st dropped onto the tracker :O
    I hope I'm right, so I can just keep looking ^^
    I appreciate everybodies input so far, thank you all.

    Cheers, Steve.

  9. #9
    Aaaaannnnddd anf FYI for those that may need to do this themselves, I missed this in the onInit as I'm an idiot.

    CombatManager.setCustomAddNPC(addNPC)

    Again, thanks for the help guys.

    Cheers, Steve.

Thread Information

Users Browsing this Thread

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Starfinder Playlist

Log in

Log in