-
April 6th, 2025, 18:57 #1
- Join Date
- Feb 2021
- Posts
- 460
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!
-
April 6th, 2025, 20:15 #2
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 22,197
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> });
Regards,
JPG
-
April 7th, 2025, 03:45 #3
- Join Date
- Feb 2021
- Posts
- 460
-
April 7th, 2025, 04:31 #4
- Join Date
- Feb 2021
- Posts
- 460
-
April 7th, 2025, 05:03 #5
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 22,197
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
-
April 7th, 2025, 14:36 #6
- Join Date
- Feb 2021
- Posts
- 460
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks