PDA

View Full Version : Combat Tracker - Deleting an oponent



Oberoten
February 2nd, 2009, 16:33
Would it be possible to make the combat tracker actually delete the token or at the least turn it invisible when you delete the combat tracker entry ... or maybe the other way around as to delee the entry when you delete the token?

We just tried a 40+ combatant battle and it was easy enough to keep track off except for this minor annoyance.

- Obe

Tenian
February 2nd, 2009, 16:46
Tokens do have .setVisible() and .delete() as methods.

I think I see how I would do it in the 4E_JPG combat tracker but I think it would have to be a very ruleset specific change.

Oberoten
February 3rd, 2009, 00:15
In the basic ruleset I see that in the basic

combattracker_token.lua

there is a function for when a token is deleted... It doesn't work.




function refDeleted(deleted)
ref = nil;
end


Any chance to get this fixed? I have tried adding a ref.delete() and a few other ideas. But no luck so far.

I even tried to set it so that it'd make the token invisible.... but that didn't really work either.

Foen
February 3rd, 2009, 06:04
I think that function does work, it just doesn't do what you want it to do!

In the standard tracker, the ref variable points to the token and is used to draw the red/yellow/green shading (underlay) when the friend/foe status changes. This function is called when the token is deleted, and is sets the ref variable to nil so that the tracker doesn't try to update the underlay for a token that no longer exists.

It may be possible to use this function to delete the combat tracker entry as well, although I'm not sure if the function is also called when the map is closed (for example), in which case you might not want to delete the tracker entries.

Foen

Oberoten
February 3rd, 2009, 07:52
So where would I go about setting the delete() event to make it properly remove the tokens when I remove the entry or the other way around? (Either would be fine really.... I just hate having to hunt down the relevant Nurgling when it goes SPLAT )

- Obe

Tenian
February 3rd, 2009, 11:19
I would do it in the function that applies damage to the entry. Again I've never looked at the basic tracker so I don't know what it's called.

Oberoten
February 3rd, 2009, 15:43
Sounds like I need to DL the 4th Ed Ruleset to see how they do it there. :)

- Obe

Tenian
February 3rd, 2009, 16:16
4E_JPG doesn't do this, I just looked at where/what would need to be changed to make it happen. I'll see if I can poke around with it in the next few days and get something that works.

In 4E you'd have to test to make sure it's an NPC that you are removing as player's can often go negative HPs and you wouldn't want to remove them.

Oberoten
February 5th, 2009, 08:12
I'd be happy enough to be able to just add a bloodsplatch underlay to them.

- Obe

Moon Wizard
February 5th, 2009, 19:00
I just put together some code to do this, and it seems to work. Basically, I just put in a catch for whenever the menu option to delete a CT entry is activated, and then make a call to delete the token reference that is tracked with the CT entry.

To do that, you can either:
* Remove the allowdelete tag from the list, and implement your own menu option in the combattracker_entry.lua, which calls the function below and deletes the entry.
* Use the onCheckDeletePermission(window) function to capture when the default delete request is made, and call the below function. (Not sure how supported this is, since it's only in the beta refdoc)

Also, make sure that you check that the "type" field on the entry is "npc", so that you don't delete the "pc" tokens.

In combattracker_token.lua:


function deleteReference()
if ref then
ref.delete();
ref = nil;
end
end


Cheers,
JPG