PDA

View Full Version : Trying to get NPC node from CT



alloowishus
June 21st, 2023, 04:40
I am using a custom modded Rolemaster Classic ruleset, but I think it still applies. In the Combat tracker there is a ct_host_entry_section.xml with a <script> tag. I was able to get to the PC from the window using this:

local rActor = ActorManager.resolveActor(window.getDatabaseNode() );

local nodeCreature = ActorManager.getCreatureNode(rActor);

nodeCTAttacker = ActorManager.getCTNode(nodeCreature);

local sClass, sNodeName = DB.getValue(nodeCTAttacker, "link", "", "");
local sActorType = ActorManager.getRecordType(rActor);
local nodeChar = DB.findNode(sNodeName);

However this doesn't work for an NPC, I am trying to find a piece of data (called "maxpace") on their character sheet, if I run the above code I can't seem to go any further than the CT entry, whereas I want the master NPC data sheet. Any ideas? Thank you in advance!

Moon Wizard
June 21st, 2023, 06:59
For NPCs, the CT node is the same as the creature node, because NPCs in the combat tracker are full copies of the original record.

Regards,
JPG

alloowishus
June 21st, 2023, 15:59
For NPCs, the CT node is the same as the creature node, because NPCs in the combat tracker are full copies of the original record.

Regards,
JPG

Ok thanks, so are you saying this code should work to get the NPC "maxpace" attribute?

local rActor = ActorManager.resolveActor(window.getDatabaseNode() );

local nodeCreature = ActorManager.getCreatureNode(rActor);

nodeCT = ActorManager.getCTNode(nodeCreature);

local sMaxPace = DB.getValue(nodeCT,"maxpace","");

Trenloe
June 21st, 2023, 16:03
nodeCreature is the same as nodeCT in your code - as mentioned by Moon Wizard creatures in the CT are their own unique record, so their base database node is the same as their CT node.

Also, depending where you run the code, window.getDatabaseNode() might be all you need to get the base node of the creature in the CT.

alloowishus
June 23rd, 2023, 22:58
nodeCreature is the same as nodeCT in your code - as mentioned by Moon Wizard creatures in the CT are their own unique record, so their base database node is the same as their CT node.

Also, depending where you run the code, window.getDatabaseNode() might be all you need to get the base node of the creature in the CT.

Got and it works! thanks.

YAKO SOMEDAKY
June 24th, 2023, 00:26
Forgive my ignorance, but what would this be for?

damned
June 24th, 2023, 02:27
Forgive my ignorance, but what would this be for?

applying damage mostly