DICE PACKS BUNDLE
  1. #1

    Automatically add NPC to combat tracker

    I want to have an NPC added to the combat tracker automatically when a certain spell is cast.

    So I outputted the contents of the "tCustom" data table from a random NPC which it is dragged into the combat tracker and I got this:

    { s'sTargetPath' = s'combattracker.list.id-00018'
    , s'sRecordType' = s'npc'
    , s'nodeRecord' = databasenode
    = { npc.id-00438 }
    , s'sClass' = s'npc'
    , s'sRecord' = s'npc.id-00438'
    , s'draginfo'
    = dragdata
    = { type = s'shortcut'
    , desc = s'NPC: Ape'
    , #slots = #1
    , slot = #1
    , string = s''
    , num = #0
    , diceexpr = {}
    , shortcut = {npc:npc.id-00438}, asset = {, instance = }, custom = nil }
    }

    So how would I construct this tCustom data table manually? I assume that I need to manually create the "TargetPath" node, probably by getting the max node number in the combat tracker and adding 1? Also, how would I get the node of the NPC I want to add?

    Thanks!

  2. #2
    Where are you pulling that from? It seems like you're trying to inject in a place that's going to be hard to add to/from.

    I would probably start with something similar to what the Encounters use:
    Code:
    CombatRecordManager.onRecordTypeEvent("npc", { sClass = "npc", nodeRecord = <databasenode of creature to add> });
    You would just have to have it trigger in the code that "summons" the creature.

    Regards,
    JPG

  3. #3
    Quote Originally Posted by Moon Wizard View Post
    Where are you pulling that from? It seems like you're trying to inject in a place that's going to be hard to add to/from.

    I would probably start with something similar to what the Encounters use:
    Code:
    CombatRecordManager.onRecordTypeEvent("npc", { sClass = "npc", nodeRecord = <databasenode of creature to add> });
    You would just have to have it trigger in the code that "summons" the creature.

    Regards,
    JPG
    That's much easier, thank you!

  4. #4
    Quote Originally Posted by Moon Wizard View Post
    Where are you pulling that from? It seems like you're trying to inject in a place that's going to be hard to add to/from.

    I would probably start with something similar to what the Encounters use:
    Code:
    CombatRecordManager.onRecordTypeEvent("npc", { sClass = "npc", nodeRecord = <databasenode of creature to add> });
    You would just have to have it trigger in the code that "summons" the creature.

    Regards,
    JPG
    Ok, so based on the debug info, the NPC node I chose is this { npc.id-00438 }

    So how do I get the node of the NPC based on the name? Thanks!

  5. #5
    What is the type of the variable you are looking at? If it's a databasenode, you are done. If it's a string, then use DB.findNode(sPath).

    Regards,
    JPG

  6. #6
    Quote Originally Posted by Moon Wizard View Post
    What is the type of the variable you are looking at? If it's a databasenode, you are done. If it's a string, then use DB.findNode(sPath).

    Regards,
    JPG
    Basically I will make copies of NPCs and add "summon" to the end, so for instance "Wolf Summon". I want to be able to find the database node of this NPC based on its name and then pass to the function. Thanks.

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
  •  
TALES of the VALIANT

Log in

Log in