PDA

View Full Version : Combat Tracker



Oberoten
November 10th, 2008, 14:53
Having finally managed to wrap my head around the combat tracker... (barely at that)

I wonder this : I want to ADD a value to another whenever the combat tracker hits a character. Like the count-down of special effects mainly.

(( What I do is that I have a combat tracker that counts seconds and when an action is done it should add seconds to the base initiative value of the entry... I just need to know WHERE to dump the code for this to make it work. ))

Tarostar
November 10th, 2008, 15:02
I think you are looking for function nextActor() in combattracker.lua.

I've added some code in there to keep track of the current initiative value and I don't think you should have any difficulty figuring out where to put your code.

In fact in the original d20 ruleset v.effects.progressEffects(activeinit, nextactorinit) is being called in this function to count down the effects. Adjusting the initiative should be even easier.

Oberoten
November 10th, 2008, 16:54
Next silly question?
How do I pull a value from the tracker? It isn't in the Database?

- Obe

Tarostar
November 10th, 2008, 17:25
Next silly question?
How do I pull a value from the tracker? It isn't in the Database?

- Obe

Nope, that's why I changed the combattracker to store its data in the database (see my thread here (https://www.fantasygrounds.com/forums/showthread.php?t=9261)).

By default the combattracker data is stored in the CampaignRegistry.lua.

PneumaPilot
November 10th, 2008, 17:31
What kind of data are you wanting to pull from the tracker? We're not talking about updating something simple like hp are we?

Oberoten
November 10th, 2008, 18:29
I have two numbers in the tracker... one is called ActValue and the other is initiativeresult I want add the ActValue to the initiative result when the entry gets hit by the tracker OR when I press next segment. Preferably when I press next actually.

PneumaPilot
November 10th, 2008, 21:09
Oh I see, for a game that measures actions by the amount of time they take? Doesn't Exalted do something like that?

Oberoten
November 10th, 2008, 21:27
To be honest? I don't know. :) But my houseruled version of Ars Magica does and it'd be a lot easier to do it on a tracker than in my head.

- Obe

PneumaPilot
November 10th, 2008, 22:00
Are there only so many different choices for the amount of act time? If so, could you put buttons on each element of the tracker that you just click each time that character acts and it adds the number to the init total and updates?

Oberoten
November 10th, 2008, 22:22
It is actually a value depending on the action... but chosen at initiative at former phase.

Initiative decides how much of an action-cost something has.

Say Rudolph von Hoenheim has an initiative of 15 he'd have a base act of seven (seven half-seconds actually)... At 0 he declares first action, which happends in segment seven, where he declares his next intention, all the time adding the cost for the new action to the time-tracker.

... with most combat actions that'd be :
Delcare at 0, Act at 7 declare for next, Act again at 14; declare, Act and declare for next at 21.

Someone slightly faster say act six does the same at 0, 6, 12, 18

- Obe

Foen
November 10th, 2008, 22:38
How do I pull a value from the tracker? It isn't in the Database?
Sorry to sound stupid, but that depends on where you are making the reference from, and where it is referring to. If the reference is from a control or sub-window of the tracker, to somewhere else on the tracker, it is possibly easier. If it is from an independent window (such as a character or NPC sheet) to the tracker, it might be quite tough.

Cheers

Stuart

Oberoten
November 11th, 2008, 00:12
It is all inside the same entry. Each entry contains both the numbers and I am sure it is actually almost ridicolously easy... but I am not getting it. :)

Foen
November 11th, 2008, 06:05
The tracker entries aren't stored in the database, but you can instead use the window/control hierarchy to access values. Say you have a window class (combattracker_entry) with two controls in it (hits and wounds) then you can access the controls from script in the window class directly:


local h = hits.getValue();
local w = wounds.getValue();
print("Remaining hits = "..(h-w));

You can access the 'wounds' control from the 'hits' script block by referencing it via the parent window:


local h = getValue(); --[[ from 'hits' this is the control value ]]
local w = window.wounds.getValue(); --[[ 'window' is a reference to the containing window class, of which 'wounds' is a reference to the other control ]]
print("Remaining hits = "..(h-w));

Hope that helps.

Stuart

Oberoten
November 11th, 2008, 07:58
It helps immensely. :) I was on the right track at the least.

- Obe

Oberoten
November 11th, 2008, 08:26
entry.initresult.getValue() was the key actually. :) Well well.. live and learn. Now it works like a charm.

- Obe

Oberoten
November 11th, 2008, 08:27
Why is it called "Working like a charm" by the way? I mean aren't MOST charms quite ... well non-working? Or do they mean like charming someone?

Tenian
November 11th, 2008, 11:42
The older meaning of charm is a chant, incantation or verse that was magic. So works like a charm is the as saying "Works like magic"

In modern times, few people believe in magic so this phrase makes little sense. However "magic" is often used to describe things that defy explanation, even in the modern era. So the phrase could be interpreted as: "works so well it defies explanation"

Oberoten
November 11th, 2008, 13:47
The older meaning of charm is a chant, incantation or verse that was magic. So works like a charm is the as saying "Works like magic"

In modern times, few people believe in magic so this phrase makes little sense. However "magic" is often used to describe things that defy explanation, even in the modern era. So the phrase could be interpreted as: "works so well it defies explanation"
In other words automagically then. I were more thinking along the lines of poking fun at the cheap amulets and trinkets sold by tv shop and the like that doesn't work. sorry about format of the post. sending from cellphone