PDA

View Full Version : Skills and the CT



S Ferguson
November 13th, 2014, 19:09
I'm trying to make a skills line in the CT, similar to the one in Castles and Crusades except only for NPCs (PCs aren't important to me :D). I've got the code to a semi-working state and was wondering how to go about (1) Having only NPCs have this skills line; & (2) Having itself hide until the combat icon is clicked. I've basically cloned the entry for another combat line in the ct_host.xml code I'm modifying but it breaks rules (1) & (2) I was wondering if anyone could help me out on this one.

Regards,
SF

damned
November 13th, 2014, 23:45
I cant help you Scott - but would love to see the finished code.

S Ferguson
November 13th, 2014, 23:47
You will if I can get someone to help.

Trenloe
November 14th, 2014, 02:18
Have a look at the effects list in the CoreRPG ruleset. It is a <windowlist> control defined in ct\ct_host.xml and a couple of other associated controls, do a search for the comment "Effect subsection" in that xml file.

Whether it is visible or not is controlled by the setEffectsVisible() function in the ct\scripts\ct_entry.lua script which uses the <controlname>.setVisible method to either show or hide the controls related to effects. This is called from the "activateeffects" button (to just show the effects for one entry) or the window.list.toggleEffects method from the "button_global_effects" button (both of these buttons are in ct\host.xml.


Copy the XML sections related to effects and rename them appropriately for your skills (I'm guessing you've done this already).
In ct\scripts\ct_entry.lua copy function setEffectsVisible() to something like setSkillsVisible() and edit it for your new skills controls.
If you have a global button to show/hide skills: in ct\scripts\ct.lua copy toggleEffects to something like toggleSkills and edit it appropriately to your new controls.
You'll need to add some code to your setSkillsVisible() function so that it only activates if it is an NPC. local sClass,_ = link.getValue(); will return in sClass the classname of the entry in the CT - this will be "charsheet" for a PC and "npc" for a NPC. Do a check for sClass == "npc" in your new setSkillsVisible() function to only set the skills controls visible if sClass == "npc".

damned
November 14th, 2014, 02:56
Seriously Trenloe... you da man.

dulux-oz
November 14th, 2014, 04:21
I cant help you Scott - but would love to see the finished code.

As would I :)

S Ferguson
November 14th, 2014, 15:07
Thanks Trenloe, I owe you another.