ToME: the Tales of Maj'Eyal

Everything about ToME
It is currently Fri Aug 18, 2017 11:55 pm

All times are UTC




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Tue May 30, 2017 7:19 pm 
Offline
Wyrmic

Joined: Sat Dec 13, 2014 3:38 pm
Posts: 277
How do I edit the Race Text and XP penalties for a particular race and subrace? I have located where newBirthDescriptor is defined, but I'm not sure how to replace the text and the xp penalty if the addon is running. I'd rather just edit it after it is defined rather than superloading it. Also, it would be great to know how to edit or add just part of the text string, but that's not essential.

For example, this is what I want the description to be for Shalore:

Code:
desc = {
      "Shaloren elves have close ties with the magic of the world, and produced in the past many great mages.",
      "Yet they remain quiet and try to hide their magic from the world, for they remember too well the Spellblaze - and the Spellhunt that followed.",
      "They possess the #GOLD#Grace of the Eternals#WHITE# talent which allows them a boost of speed every once in a while.",
      "#GOLD#Stat modifiers:",
      "#LIGHT_BLUE# * -2 Strength, +1 Dexterity, +0 Constitution",
      "#LIGHT_BLUE# * +2 Magic, +3 Willpower, +1 Cunning",
      "#GOLD#Life per level:#LIGHT_BLUE# 9",
      "#GOLD#Experience penalty:#LIGHT_BLUE# 35%",
   }


and for Thalore:

Code:
desc = {
      "Thaloren elves have spent most of the ages hidden within their forests, seldom leaving them.",
      "The ages of the world passed by and yet they remained unchanged.",
      "Their affinity for nature and their reclusion have made them great protectors of the natural order, often opposing their Shaloren cousins.",
      "They possess the #GOLD#Wrath of the Woods#WHITE# talent, which allows them a boost to the damage both inflicted and resisted once in a while.",
      "#GOLD#Stat modifiers:",
      "#LIGHT_BLUE# * +2 Strength, +3 Dexterity, +1 Constitution",
      "#LIGHT_BLUE# * -2 Magic, +1 Willpower, +0 Cunning",
      "#GOLD#Life per level:#LIGHT_BLUE# 11",
      "#GOLD#Experience penalty:#LIGHT_BLUE# 25%",
   }


And of course the experience penalty field is just:

experience = 1.35,

or

experience = 1.25

respectively.


Based on my persistent dungeons addon that I made for Zizzo's T2 remake, my current hooks code is this:

Code:
local Zone = require "engine.Zone"                       -> These need to
local GameOptions = require "mod.dialogs.GameOptions"  -> be replaced

class:bindHook("TOME:load", function(self, data)
   if  type(config.settings.tome.xppenaltytweak) == 'nil' then
    config.settings.tome.xppenaltytweak = true
   end
   Birther?:edit?Definition('/data-xppenaltytweak/elf.lua') etc.
end)


Top
 Profile  
 
PostPosted: Wed May 31, 2017 3:00 am 
Offline
Sher'Tul

Joined: Thu Jan 23, 2003 8:13 pm
Posts: 1379
Location: A shallow water area south of Bree
Once you're inside the ToME:load hook, you don't really need to do anything elaborate; you can just modify the descriptor definition in place. You'll want something like:
Code:
class:bindHook("TOME:load", function(self, data)
  local Birther = require 'engine.Birther'
  local shalore = Birther:getBirthDescriptor('subrace', 'Shalore')
  shalore.experience = 1.35
  shalore.desc[8] = "#GOLD#Experience penalty:#LIGHT_BLUE# 35%"
end)

(This code is untested, of course; caveat emptor.) I've done this sort of thing before to modify talent definitions.

_________________
"Blessed are the yeeks, for they shall inherit Arda..."


Top
 Profile  
 
PostPosted: Wed May 31, 2017 11:20 am 
Offline
Wyrmic

Joined: Sat Dec 13, 2014 3:38 pm
Posts: 277
I tested it, and even when I put the require line at the top it didn't show any change in the New Game screen. So there must be something else stopping it (I don't know whether it would still do the experience change if it didn't do the text change, but if I had to guess I would say no).


Top
 Profile  
 
PostPosted: Thu Jun 01, 2017 3:25 am 
Offline
Sher'Tul

Joined: Thu Jan 23, 2003 8:13 pm
Posts: 1379
Location: A shallow water area south of Bree
Steven Aus wrote:
I tested it, and even when I put the require line at the top it didn't show any change in the New Game screen.

[sound F/X: source diving] Ah, sorry, Birther:newBirthDescriptor() folds the desc{} table into a single string during the loading process, so table access won't work (I'm surprised it didn't throw an error, actually…). You could modify the field in place with string.gsub(), I suppose (or just replace it wholesale with another string).

_________________
"Blessed are the yeeks, for they shall inherit Arda..."


Top
 Profile  
 
PostPosted: Thu Jun 01, 2017 4:55 am 
Offline
Wyrmic

Joined: Sat Dec 13, 2014 3:38 pm
Posts: 277
I tried replacing the whole string, and using string.gsub, however it still shows the old text. Is there anything preventing the text I'm trying to edit from being edited? And I wonder if the experience change is working? I tried starting a Thalore character but I couldn't see any place where the experience penalty was listed.


Top
 Profile  
 
PostPosted: Fri Jun 02, 2017 3:35 am 
Offline
Sher'Tul

Joined: Thu Jan 23, 2003 8:13 pm
Posts: 1379
Location: A shallow water area south of Bree
[sound F/X: testing] Well, the attached quick mockup addon appears to successfully modify the description of Shaloren in the character creation dialog (for testing, I made the word "Shaloren" blue and changed the described exp penalty to 42%).


Attachments:
tome-birth_test.zip [951 Bytes]
Downloaded 8 times

_________________
"Blessed are the yeeks, for they shall inherit Arda..."
Top
 Profile  
 
PostPosted: Fri Jun 02, 2017 8:27 am 
Offline
Wyrmic

Joined: Sat Dec 13, 2014 3:38 pm
Posts: 277
I found the main reason it wasn't working.

I had:

class:bindHook('TOME:load', function(self, data)

instead of:

class:bindHook('ToME:load', function(self, data)

So obviously lua is case sensitive. :)


Question: why do other mods register on the character sheet online, but when I create a new game using this mod, it doesn't? Does it need to be marked by a dev or get some votes or something?

https://te4.org/games/addons/tome/racexptweak


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group