PDA

View Full Version : FGII modifiers ike FGI's modifier types



Tokuriku
April 30th, 2007, 02:41
Ok, I've been trying to wrap my head around this but I can't seem to be able to do it alone.
FGII's programmation changed quite a bit from FGI.
I need a numbertype that acts like the past "modifier" type.
I.E:
-accept sources
-display the modifier after modifying
-accept resets (wich would reset the modifier, not the source)

Goblin-King
April 30th, 2007, 10:38
Look into the templates linkednumber and modifiernumber. They are used using <linkednumber> and <modifiernumber> tags. There are several examples in the character sheet.

Tokuriku
April 30th, 2007, 13:42
Thanks, I've found it and I've been able to make them accept sources and while playing with the LUA script for modifiers, I made it possible to drop and add on modifiers (I use it for HP for the players to know where there are from full HP):


function onDrop(x, y, draginfo)
if draginfo.getType() == "number" then
setModifier(getModifier() + draginfo.getNumberData());
end
return true;
end

Resets (middle button to put at 0) are accepted also but they reset the number and not the modifier (I've been able to look into the DB to confirm it). I still need to reset the modifier (to put the HP to full) wich seems to be imbeded into the LUA scripts and unfortunatly, the LUA stuff seems more elevated stuff. Can't make head or tails of them yet. :confused:

Goblin-King
April 30th, 2007, 13:55
If I understand you correctly, you need to register an onUpdate event to the field that is getting reset. Unfortunately I can't give you a concrete example as I'm not quite sure what the fields involved are.

The basic structure would be something like this in your control:



window[monitoredcontrolname].getDatabaseNode().onUpdate = myUpdateFunction;

That would cause myUpdateFunction in your control to be called whenever the value is changed. Alternatively, if you know just the direct name of the field you're looking at, you can also say:



window.getDatabaseNode().createChild(fieldname, "number").onUpdate = myUpdateFunction;

Tokuriku
May 1st, 2007, 10:13
Thanks for the quick response, I'll try it as soon as possible :)