Portal-Zone Gothic-Zone Gothic II-Zone Gothic 3-Zone Gothic 4-Zone Modifikationen-Zone Download-Zone Foren-Zone RPG-Zone Almanach-Zone Spirit of Gothic

 

Ergebnis 1 bis 9 von 9
  1. Beiträge anzeigen #1 Zitieren
    Apprentice
    Registriert seit
    Oct 2012
    Beiträge
    33
     
    dorumia ist offline

    [G2]Change const to var?

    Hello. It's possible(with using Ikarus/Lego or just basic Daedalus) to change during game a original string from Text.d and Constants.d? Example, during dialoge with Xardas, we set "Name_Currency" = "something", and after save/loading game that new string exist on game?

  2. Beiträge anzeigen #2 Zitieren
    Ritter Avatar von Kirides
    Registriert seit
    Jul 2009
    Ort
    Norddeutschland
    Beiträge
    1.780
     
    Kirides ist offline
    Gothic does not have "const".
    A "const" is basically a "var" that is re-initialized every time the game is restarted.
    You can always re-assign a "const" and the new value will be instantly reflected.

    A "const" is not stored in the savegame.

  3. Beiträge anzeigen #3 Zitieren
    Apprentice
    Registriert seit
    Oct 2012
    Beiträge
    33
     
    dorumia ist offline
    So, if i want change 3 const string from Text and Constants, how i should try it? Because i don't think this is easy like "Name_Currency is original set as Gold", so i can during dialoge add "Name_Currency = other text".
    Geändert von dorumia (30.08.2021 um 18:40 Uhr)

  4. Beiträge anzeigen #4 Zitieren
    Apprentice
    Registriert seit
    Oct 2012
    Beiträge
    33
     
    dorumia ist offline
    Or it's impossible?

  5. Beiträge anzeigen #5 Zitieren
    Ritter Avatar von Kirides
    Registriert seit
    Jul 2009
    Ort
    Norddeutschland
    Beiträge
    1.780
     
    Kirides ist offline
    Zitat Zitat von dorumia Beitrag anzeigen
    So, if i want change 3 const string from Text and Constants, how i should try it? Because i don't think this is easy like "Name_Currency is original set as Gold", so i can during dialoge add "Name_Currency = other text".
    Some things are hard-coded into the engine, and only looked up once (e.g. TRADE_CURRENCY or smth like that, that one thing that says gold), other things can be set in initGlobal to apply on load or in specific dialog options etc.

    Zitat Zitat von dorumia Beitrag anzeigen
    Or it's impossible?
    What do you try to accomplish?

    No one can really help you with the information you gave us until now.

  6. Beiträge anzeigen #6 Zitieren
    Apprentice
    Registriert seit
    Oct 2012
    Beiträge
    33
     
    dorumia ist offline
    Zitat Zitat von Kirides Beitrag anzeigen
    Some things are hard-coded into the engine, and only looked up once (e.g. TRADE_CURRENCY or smth like that, that one thing that says gold), other things can be set in initGlobal to apply on load or in specific dialog options etc.



    What do you try to accomplish?

    No one can really help you with the information you gave us until now.
    What i try accomplish? I try get two different trade currency during game. For example - basic currency from my script are Magic Ore. And what i want? I want change them during game(not on start, but ex. in moment, when we meet specific NPC) to original Gold.

  7. Beiträge anzeigen #7 Zitieren
    Ritter Avatar von Kirides
    Registriert seit
    Jul 2009
    Ort
    Norddeutschland
    Beiträge
    1.780
     
    Kirides ist offline
    Zitat Zitat von dorumia Beitrag anzeigen
    What i try accomplish? I try get two different trade currency during game. For example - basic currency from my script are Magic Ore. And what i want? I want change them during game(not on start, but ex. in moment, when we meet specific NPC) to original Gold.
    You can try the following code (Gothic 2 only)
    It requires Ikarus to work

    Code:
    func void UpdateCurrency() {
        // Set these two values and then call UpdateCurrency
        // TRADE_CURRENCY_INSTANCE = "ITMI_PAN";
        // NAME_Currency = "Pfanne(n): ";
        // TRADE_VALUE_MULTIPLIER = 60.0;
        const int idx = 0; idx = MEM_FindParserSymbol(TRADE_CURRENCY_INSTANCE);
    
        const int GetCurrencyInstance_CurrencyInstance_G2         =  9137116; // 008b6bdc
        const int GetCurrencyInstanceName_CurrencyInstanceName_G2 = 11210948; // 00ab10c4
        const int GetCategorySelfPlayerPrefix_CategoryPrefix_G2   = 11210556; // 00ab0f3c
        const int GetValueMultiplier_ValueMultiplier_G2           = 11211032; // 00ab1118
    
        // Set the trade value multiplier.
        MEM_WriteInt(GetValueMultiplier_ValueMultiplier_G2, castToIntf(TRADE_VALUE_MULTIPLIER));
        // Sets the used item for trade
        MEM_WriteInt(GetCurrencyInstance_CurrencyInstance_G2, idx);
        MEM_WriteString(GetCurrencyInstanceName_CurrencyInstanceName_G2, TRADE_CURRENCY_INSTANCE);
        // Sets the prefix that is used for display in the players inventory
        MEM_WriteString(GetCategorySelfPlayerPrefix_CategoryPrefix_G2, NAME_Currency);
    };
    Geändert von Kirides (01.09.2021 um 08:37 Uhr)

  8. Beiträge anzeigen #8 Zitieren
    Apprentice
    Registriert seit
    Oct 2012
    Beiträge
    33
     
    dorumia ist offline
    Zitat Zitat von Kirides Beitrag anzeigen
    You can try the following code (Gothic 2, as you didn't mention which gothic version you're using...)
    It requires Ikarus to work

    Code:
    func void UpdateCurrency() {
        // Set these two values and then call UpdateCurrency
        // TRADE_CURRENCY_INSTANCE = "ITMI_PAN";
        // NAME_Currency = "Pfanne(n): ";
        // TRADE_VALUE_MULTIPLIER = 60.0;
        const int idx = 0; idx = MEM_FindParserSymbol(TRADE_CURRENCY_INSTANCE);
    
        const int GetCurrencyInstance_CurrencyInstance_G2         =  9137116; // 008b6bdc
        const int GetCurrencyInstanceName_CurrencyInstanceName_G2 = 11210948; // 00ab10c4
        const int GetCategorySelfPlayerPrefix_CategoryPrefix_G2   = 11210556; // 00ab0f3c
        const int GetValueMultiplier_ValueMultiplier_G2           = 11211032; // 00ab1118
    
        // Set the trade value multiplier.
        MEM_WriteInt(GetValueMultiplier_ValueMultiplier_G2, castToIntf(TRADE_VALUE_MULTIPLIER));
        // Sets the used item for trade
        MEM_WriteInt(GetCurrencyInstance_CurrencyInstance_G2, idx);
        MEM_WriteString(GetCurrencyInstanceName_CurrencyInstanceName_G2, TRADE_CURRENCY_INSTANCE);
        // Sets the prefix that is used for display in the players inventory
        MEM_WriteString(GetCategorySelfPlayerPrefix_CategoryPrefix_G2, NAME_Currency);
    };
    Yeah sorry, im stupid. Of course i mean G2. This code work perfect(i create another Update_Currency to check if i can back to early value), but i have question to future research. How i can get that address?
    Code:
    const int GetCurrencyInstance_CurrencyInstance_G2         =  9137116; // 008b6bdc
    

    Because i can give any name to const, but how i can find needed address and other stuff? Anyway, big thanks for that. Really.
    Geändert von dorumia (31.08.2021 um 22:58 Uhr)

  9. Beiträge anzeigen #9 Zitieren
    Ritter Avatar von Kirides
    Registriert seit
    Jul 2009
    Ort
    Norddeutschland
    Beiträge
    1.780
     
    Kirides ist offline
    Zitat Zitat von dorumia Beitrag anzeigen
    Yeah sorry, im stupid. Of course i mean G2. This code work perfect(i create another Update_Currency to check if i can back to early value), but i have question to future research. How i can get that address?
    Code:
    const int GetCurrencyInstance_CurrencyInstance_G2         =  9137116; // 008b6bdc
    

    Because i can give any name to const, but how i can find needed address and other stuff? Anyway, big thanks for that. Really.
    This is a bit difficult.
    I used a decompiler (Ghidra) and looked up references to "TRADE_CURRENCY_INSTANCE", found GetCurrencyInstance, looked around to find some static variable (denoted by "DAT_0000000" where the "0" is some hexadecimal value. Now i had to do some guess work to find out where the string value started, because i didn't know what part of the string is being accessed.
    Once i found that out, i looked up NAME_Currency (as that was another string, so i kinda knew what to expect) and the others, which were int and float values respectively - a lot easier to find out, as they're just a single 4 byte value.

    To find all of this, i looked up every function that contained something with "currency" in hope to find everything.

    Luckily, the refactor for Gothic 2 made all of this configurable through script values. I tried to lookup something simmilar for G1, but found nothing. The only ITMINUGGET reference i found, was for cheat codes ^^

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
Impressum | Link Us | intern
World of Gothic © by World of Gothic Team
Gothic, Gothic 2 & Gothic 3 are © by Piranha Bytes & Egmont Interactive & JoWooD Productions AG, all rights reserved worldwide