Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs

Strive for Power

Fantasy Slave Management/RPG Erotic Game · By Strive4Power

Question with error while modding.

A topic by Jethreuel created 85 days ago Views: 211 Replies: 5
Viewing posts 1 to 3

I am trying to mod some abilities so that their durations are also affected by the stats of the character (whether player or slave).  The first several attempts and saved games would not load, but now at least game and saved games load with the following errors:

SCRIPT ERROR: _init: Invalid get index 'person' (on base: 'Nil').
          At: res://files/scripts/abilities.gd:644
SCRIPT ERROR: _init: Invalid get index 'player' (on base: 'Nil').
          At: res://files/scripts/combatdata.gd:306

Here is an example of a modified ability:

sedationeffect = {
icon = load("res://files/buttons/abils/Sedation.png"),
duration = rand_range(1,5)*globals.person.stats.smaf,
name = 'Sedation',
code = 'sedationeffect',
type = 'debuff',
stats = [['speed', '-(3+,caster.magic,)']],
},

This is actually lines 681-688.  The error at 644 actually refers to:

var effects = { 

Which covers all the abilities.

SCRIPT ERROR: _init: Invalid get index 'player' (on base: 'Nil').
          At: res://files/scripts/combatdata.gd:306

refers to starting

var enemypool = {


With the first entry following:
wolf = {
name = 'Wolf',
code = 'wolf',
faction = 'animal',
icon = load("res://files/images/enemies/wolf.png"),
special = null,
capture = null,
level = 2,
rewardpool = {bestialessenceing = (10 + (globals.player.stats.smaf*10))},
rewardgold = 0,
rewardexp = 10,
stats = {health = 25, power = 12, speed = 12, energy = 50, armor = 0, magic = 0, abilities = ['attack']},
skills = [],
},


Is there something I am missing?

If the compiler cannot evaluate a value, possibly because of an error, it assigns it the value null/nil and continues. This can create secondary errors of this type Invalid get index 'player' (on base: 'Nil'). 

It would be easier to look at a properly numbered section of code to fix this rather than your choice of code fragments. Does this error happen at run time compilation or mid game?

It occurs at compilation, with game breaking errors occuring if I get into combat.

(1 edit) (+1)

These statements:

duration = rand_range(1,5)*globals.person.stats.smaf,
rewardpool = {bestialessenceing = (10 + (globals.player.stats.smaf*10))},

must be evaluated at runtime: I don't think you can put them in a dictionary like that.
I guess they have to be surrounded by quotation marks ("...") and passed as arguments to globals.evaluate(). See for instance the job parameter "unlockreqs" in jobs&specs.gd,, which is evaluated in joblist.gd:

if globals.evaluate(i.unlockreqs) == true:

It is possible to define things like that if they are in the local scope of a function that is called at run time. These expressions are presumably being evaluated when ability.gd is loaded and at that time globals.player may have no assigned value.

I will try that.  Thank you.