# TrainPhysical

Objects
Status
4.9.6.0 CR
bool
string physical Name of property to be changed.
int train_by 0-100000: added training value
int max_train Maximum training value. In no case, the physical property of the clonk will be modified, even if its value is lower than the value specified here.
Increases the physical property of an object by train_by. This function will train permanent physicals as well as temporary and temporarily stacked physicals. This function can be used e.g. to enhance magic capabilities after casting spells.
// Globaler Aufruf, wenn ein Zauber erfolgreich war: Magie trainieren global func OnClonkSucceededSpell(id spell, object clonk) { if (!clonk) if (!(clonk = this())) return(_inherited(spell)); // Zauberkraft trainieren (plus 1/10 des Zauberwerts) if (!ObjectCount(NMGE)) { var max_train, info; // Maximales Training bei Infoobjekten: Nach Ursprungsdefinition richten if (info = clonk->GetObjectInfoCoreVal("id", "ObjectInfo")) max_train = info->~MaxMagicPhysical(); // Infodefinition hat kein MaxMagicPhysical (d.h., kein Zauberclonk) oder kein Infoobjekt vorhanden: // Training wird eh nicht permanent gesichert; nach aktueller Definition richten if (!max_train) max_train = clonk->~MaxMagicPhysical(); // Trainieren clonk->TrainPhysical("Magic", Value(spell)/MCLK_ManaTrainRate, max_train); } // Gegebenenfalls weitere Hooks erlauben return (_inherited(spell, clonk)); }
Example from System.c4g: improves the sorcerer's magic physical value after each successfull spell. It is ensured that the physical value will not surpass the maximum limit specified in MaxMagicPhysical() of the definition.
DefCore.txt, [Physical]
GetPhysical
SetPhysical
ResetPhysical
Sven2
2003-06