OpenXcom Forum
Modding => Help => Topic started by: Nirran on February 08, 2021, 02:20:46 pm
-
why doesnt this work?ive tried many variations,none do anything
im trying to remove the engine added stats and use my own
this is available commands i read(is this wrong?)
#statPrevious - original stats before mission (read only)
#statChange - stats change from exp (read only)
#soldier.Stats - current stats of geoscape soldier, if you change it it will permanently change stats of soldier
#unit.Stats - stats of battle soldier, changed by armor. Only affect current battle.
#unit.Exp - exp grain during battle (read only)
and this is what i have so far
#arbitrary value
#unit.Exp.getTimeUnits changeTimeUnits;
#statChange.getTimeUnits changeTimeUnits;
statPrevious.getTimeUnits prevTimeUnits;
soldier.Stats.getTimeUnits origTimeUnits;
sub origTimeUnits prevTimeUnits;
soldier.Stats.getTimeUnits currTimeUnits;
#battle_game.randomRange value valueMin valueMax;
sub currTimeUnits origTimeUnits; #remove engine added
#add origTimeUnits value; #add 1-3 to old stat
soldier.Stats.setTimeUnits currTimeUnits; #overwrite stat +1-3
-
What you mean by "why doesnt this work"? what you tried exactly and what exact result was.
-
it seems these arent valid,got them off a forum post here,all 4 produce errors in .log
#statPrevious - original stats before mission (read only)
#statChange - stats change from exp (read only)
#soldier.Stats - current stats of geoscape soldier, if you change it it will permanently change stats of soldier
#unit.Stats - stats of battle soldier, changed by armor. Only affect current battle.
#unit.Exp - exp grain during battle (read only)
does a list of scripting commands exist?
-
This is not commands, this is hints where here find data you need.
Operation would look like `soldier.Stats.getTimeUnits tu;`.
If you want to know full list of operations in script you need enable verbose logging in config, with this script will dump all meta information about every script hook to logs.
beside when you get error in any program you should post it in your question, because it is critical to understand what go wrong.
-
thank you,i got the list of synthax,how are these declared?
#Name: soldier ptre GeoscapeSoldier
#Name: statChange ptr StatAdjustment
#Name: statPrevious ptr StatAdjustment
#Name: unit ptre BattleUnit
this way errors in .log
var ptr StatAdjTime statChange;
var ptr StatPrev statPrevious;
-
ok did some testing these throw errors :
code is
statChange.getTimeUnits incTimeUnits;
error is
[ERROR] Error in parsing script 'returnFromMissionUnit' for 'Global Event Script': invalid operation name 'statChange.getTimeUnits'
code is
statPrevious.getTimeUnits origTimeUnits;
error is
[ERROR] Error in parsing script 'returnFromMissionUnit' for 'Global Event Script': invalid operation name 'statPrevious.getTimeUnits'
code is
unit.Exp.getTimeUnits changeTimeUnits;
error is
[ERROR] Error in parsing script 'returnFromMissionUnit' for 'Global Event Script': invalid operation name 'unit.Exp.getTimeUnits'
however this is in the 'verboseLogging' dump
Name: rules ptr RuleMod
Name: soldier ptre GeoscapeSoldier
Name: statChange ptr StatAdjustment
Name: statPrevious ptr StatAdjustment
Name: unit ptre BattleUnit
-
`getTimeUnits` do not exists for this types. This is because game handle them differently in exp grains (this is this stas you can see on main battle scape screen).
if you use `getBravery`(or other similar) this should work.
-
ok :( thnx
-
any way of coding or using rule settings for all stats for override ?
i want to make each gain small while having a large stat cap,and engine increases individual gains with higher stat caps
-
Ok, after digging to code I saw that I make mistake, I handled `statChange` same as `unit.Exp`,
but at end of mission there is special code that update base stats too (like TU) if you have any exp (and this is different to other stats that each have own exp).
This mean I block access info how this stats changed.
Beside that, you still have access to `soldier.Stats.setTimeUnits` etc. (previously I was referring only to types that give you errors).
If you want to know what what limits there are you can use e.g.
var ptr RuleSoldier rule;
soldier.getRuleSoldier rule;
rule.StatsCap.getTimeUnits temp;
rule.StatsMin.getTimeUnits temp;
rule.StatsMax.getTimeUnits temp;