PDA

View Full Version : Combat Tracker...



Oberoten
August 24th, 2008, 13:52
Once again it is that time of the month... where the clueless sit down and try to code.

My current victim is the combat-tracker. We are using a rather... non-standard to say the least resolution of time segments not the combat round but actions take more floating time. AKA, if you have a certain initiative it will mean that an attack takes n segments (half-seconds) to complete.

I'd love to rebuild the combat tracker to handle this.

I know that MOD should be able to handle it... but I don't get it.

I also know that the code I need to modify is probably in utility_combattracker.xml

Foen
August 24th, 2008, 16:04
It would be really helpful to have a clear understanding of the problem and the objective.

Stuart

Oberoten
August 24th, 2008, 16:57
Example then :

Danel has a Act-Level of 7, this means he will act at every 7 segments, I want the combat tracker to count up when I click the normal "next" button and show the people with the current initative go in order of Initiative value.
Initiative Act
Goblin 12 8
Danel 16 7
Peasant 10 8


Segment 0 - Start of Counter.
Segment 1 - Nothing
Segment 2 - Nothing
Segment 3 - Nothing
..
..
Segment 7 - Danel acts
Segment 8 - Goblin acts, followed by Peasant
..
..
Segment 14 - Danel Acts again.
..
Segment 16 - Goblin, Peasant
..
Segment 21 - Danel acts
..
Segment 24 - Gobbo, Peasant
..
Seg 28 - Danel

etc etc.

Foen
August 26th, 2008, 22:36
I've not forgotten you Obe, and I think this is doable, but I'm just focusing on the Call of Cthulhu ruleset at the moment.

Stuart

Oberoten
August 27th, 2008, 06:45
No worries. :) I am looking forward to that one so...

Lysander
August 27th, 2008, 13:17
Sounds a lot like the HERO system initiative process, where a turn is 12 segments, and depending on your SPEED, you go 'n' # of segments of the 12. If there is a HERO system ruleset worker out there, they might be able to help you as well...

Good Luck... :)

Tenian
August 27th, 2008, 14:57
Essentially in your system, initiative is composed of two numbers instead of one. You have a value you titled 'Act-Level' and something you're calling initiative. For the sake of clarity I am going to call this 'Init-Level'.

What you could do is combine these in such a way that you make an initiative that works in the traditional way. I'm making the assumption here that the Init-Level value can never exceed 100
Consider the following formula for initiative:


initiative = actlevel * 100 - initlevel
From your example this gives:

Goblin 8 * 100 -12 = 788
Danel 7 * 100 - 16 = 684
Peasant 8 * 100 - 10 = 790

Which places them in the correct order....

It should just be a matter of populating the init field on the combat tracker with the correct value.

If you need to know the segment number...that'd be more complex

Oberoten
August 27th, 2008, 17:06
This would work if the initiative was still running in rounds.

It isn't. The Act-Level is a cost in half-seconds for an action. What I wanty is basically a script that will let me click up time, show WHO gets to act, then compare Initiative of those who gets to act.

Foen
August 28th, 2008, 06:42
I haven't looked at this yet, but I think that pressing the 'next actor' button should advance a segment counter; tracker oredering is based on next-segment values for each combatant (that is in descending order of when they act next); and each combatant has its next-segment counter incremented by its act-level once its turn is complete.

Some extra coding should try to catch orphaned combatants (that have somehow fallen behind the current segment counter) and also skip segments that have no combatants available to act (so you don't have tedious clicking to do between turns).

Just an initial guess.

Stuart

Oberoten
August 28th, 2008, 08:59
Exactly, and then all that one'd have to consider is a delay field. To see if someone comes in later in the action. (Like the fellow who is running towards them and will be there in 30 sec or so. )

Foen
August 30th, 2008, 07:00
Hi Obe

Do you have any skeleton code you have started work on, or are you staring at the default d20 stuff at the moment?

Cheers

Stuart

Oberoten
August 30th, 2008, 07:03
I am still poking at the D20 stuff in confusion for now. And even worse? I have barely managed to figure out which side is head and which is arse of it.

- Obe

Oberoten
September 2nd, 2008, 08:47
The part I'd need to see most of is just what code sends the "Your turn now" part. I can probably do the rest on my own.

I am figuring that
math.fmod (x, y)

Returns the remainder of the division of x by y that rounds the quotient towards zero.

Means I should be able to send the combat tracker into a loop when repeating over the entries and finding any zeroes with math.fmod (Segment, ActValue_of_character) and then check over their Init for those acting.

Foen
September 3rd, 2008, 06:42
OK, very sorry about the delay on this one.

The problem with using fmod is that it won't allow you to let a combatant deliberately pause for a few segments, and it won't sort the entries properly. So I think you need a 'next acts' field which counts upwards and shows on which segment a combatant next is allowed to act.

The combat tracker code is spread over a number of files, the most notable being:
combattracker.lua - manages the list within the tracker
combattracker_entry.lua - manages each combatant's window in the list
combattracker_effects.lua - manages the list of effects for each entry

In addition, the utility_combattracker.xml file contains inline script for other elements of the tracker, such as the next actor button.

I think the rough outline of what needs doing is:
- create a 'next acts' numbercontrol on the individual combat tracker entry windowclasses. This will be used to sort (in ascending order) each combatant and control who goes next. For the time being we can ingore what happens when two combatants have the same 'next acts' value and address that later. You could re-use the initiative control for this purpose, but you will have to change onSort to reverse the comparison so lower values appear before higher ones.
- amend the description of the next round button to label it a 'nest segment' button. This will advance the round counter (which is now a segment counter) by one only.
- amend the nextround method in combtatracker.lua to do nothing except increment the round counter for now (just comment the rest of the code out)
- amend the nextactor method in combattracker.lua to add the act-level value to the current combatant's 'next acts' value and invoke applySort() to rearrange the combatants. It should then grab the 'next acts' value of the first entry in the (re-sorted) list and set the roundcounter value equal to the this next acts value. It should set the first combatant to be 'active'.

This approach will allow you to advance play between combatants. it won't be fully functional, but it should give you something that is starting to look like what you need.

Stuart

Foen
September 9th, 2008, 06:39
Hi Obe, did you get any further on this one?

Stuart

Oberoten
September 9th, 2008, 07:20
Not terribly, no. But that is mostly due to lack of time. Found and changed the sorting order, went and switched the name from round to segments and then fell asleep at the keyboard litterarely.

- Obe