PDA

View Full Version : 5e Initiative rolling



Stv
May 25th, 2020, 21:48
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.

gamerhawaii
May 25th, 2020, 22:00
Is it "addNPC" in scripts/manager_combat2.lua?

Stv
May 25th, 2020, 22:00
I'll take a look. I'll be annoyed if it is 'cos I'm sure I looked there :P

Cheers, Steve.

Stv
May 25th, 2020, 22:03
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.

Stv
May 25th, 2020, 22:35
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.

Three of Swords
May 25th, 2020, 23:00
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.

Stv
May 25th, 2020, 23:12
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 :D

Cheers, Steve.

Stv
May 25th, 2020, 23:18
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.

Stv
May 25th, 2020, 23:36
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.