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 3 von 3
  1. Homepage besuchen Beiträge anzeigen #1 Zitieren
    Team Velen
    Registriert seit
    Aug 2015
    Beiträge
    952
     
    Bloodfly91 ist offline

    Problem mit überarbeiteten Lehrer-Dialogen

    Hey,
    für Velen schrieb ich vor einiger Zeit mal das komplette B_BuildLearnString-Skript um. Alles funktionierte soweit wunderbar, leider stellte sich gestern aber dann doch heraus, dass es ein etwas größeres Problem damit gibt...

    Code:
    func string DIV_BuildTeachTalentString (var string text, var int talent, var int value, var int maxTeach)
    {
        var C_NPC her; her = Hlp_GetNpc(PC_Hero);
    
    
    
    
        var string concatText1;
        var string concatText2;
        var string concatText3;
        
        var string concatText_P1;
        var string concatText_P2;
        var string concatText_P3;
        var string concatText_P4;
        var string concatText_P5;
        var string concatText_P6;
        var string concatText_P7;
        
        var string concatText_All;
    
    
        concatText1 = ConcatStrings ("(", text);
        
        if (talent == ATR_DEXTERITY) { concatText2 = ConcatStrings (" +", IntToString(value));
                                       concatText3 = ConcatStrings (" = ",IntToString(her.Attribute[ATR_DEXTERITY]+value));
        
        } else
        
        if (talent == ATR_STRENGTH) {  concatText2 = ConcatStrings (" +", IntToString(value));
                                       concatText3 = ConcatStrings (" = ",IntToString(her.Attribute[ATR_STRENGTH]+value));
                                       
        } else
        
        if (talent == NPC_TALENT_1H) { concatText2 = ConcatStrings (" +", IntToString(value));
                                       concatText3 = ConcatStrings (" = ",IntToString(her.HitChance[NPC_TALENT_1H]+value));
        
        } else
        
        if (talent == NPC_TALENT_2H) { concatText2 = ConcatStrings (" +", IntToString(value));
                                       concatText3 = ConcatStrings (" = ",IntToString(her.HitChance[NPC_TALENT_2H]+value));
        
        } else
        
        if (talent == NPC_TALENT_BOW)        { concatText2 = ConcatStrings (" +", IntToString(value));
                                             concatText3 = ConcatStrings (" = ",IntToString(her.HitChance[NPC_TALENT_BOW]+value));
        
        } else
        
        if (talent == NPC_TALENT_CROSSBOW) { concatText2 = ConcatStrings (" +", IntToString(value));
                                             concatText3 = ConcatStrings (" = ",IntToString(her.HitChance[NPC_TALENT_CROSSBOW]+value));
        };
    
    
    
    
        if ((talent == NPC_TALENT_1H) 
        ||  (talent == NPC_TALENT_2H) 
        ||  (talent == NPC_TALENT_BOW) 
        ||  (talent == NPC_TALENT_CROSSBOW))
        
        && (talent != ATR_DEXTERITY)
        && (talent != ATR_STRENGTH)
        {
            concatText_P1  = ConcatStrings (concatText1, concatText2);
            concatText_P2  = ConcatStrings (concatText3, " / ");
            
            concatText_P3  = ConcatStrings (concatText_P1, concatText_P2);
            concatText_P4  = ConcatStrings (concatText_P3, IntToString(maxTeach));
            concatText_P5  = ConcatStrings (concatText_P4, " - ");
            concatText_P6  = ConcatStrings (concatText_P5, PRINT_DIV_Points);
            concatText_P7  = ConcatStrings (IntToString(B_GetLearnCostTalent(her, talent, value)), ")");    
            
            concatText_All = ConcatStrings (concatText_P6, concatText_P7);
        
        } else if ((talent == ATR_DEXTERITY) || (talent == ATR_STRENGTH)) {
        
            concatText_P1  = ConcatStrings (concatText1, concatText2);
            concatText_P2  = ConcatStrings (concatText3, " / ");
            
            concatText_P3  = ConcatStrings (concatText_P1, concatText_P2);
            concatText_P4  = ConcatStrings (concatText_P3, IntToString(maxTeach));
            concatText_P5  = ConcatStrings (concatText_P4, " - ");
            concatText_P6  = ConcatStrings (concatText_P5, PRINT_DIV_Points);
            concatText_P7  = ConcatStrings (IntToString(B_GetLearnCostAttribute(her, talent)*value), ")");
            
            concatText_All = ConcatStrings (concatText_P6, concatText_P7);
        
        } else {    // ALLES ANDERE (Z.B.: SCHILDKAMPF, TRÄNKE BRAUEN, ...)
        
            concatText_P1  = ConcatStrings (concatText1, " - ");
            concatText_P2  = ConcatStrings (concatText_P1, PRINT_DIV_Points);
            concatText_P3  = ConcatStrings (IntToString(B_GetLearnCostTalent(her, talent, value)), ")");
            
            concatText_All = ConcatStrings (concatText_P2, concatText_P3);
        };
        
        return concatText_All;
    };
    Dieses Skript sorgt dafür, dass in den Dialogfenstern sämtlicher Lehrer das Talent angezeigt wird, das man erlernen will, und dahinter wie hoch der Talent-Wert des Helden wäre, wenn er zum Beispiel +5 erlernt, außerdem stehen die benötigten Lernpunkte dort. Für alle Talente funktioniert das, nur leider nicht für das Armbrustschießen. Denn dieses fragt aus irgendeinem Grund den Stärke-Wert ab, obwohl dort eindeutig IntToString(her.HitChance[NPC_TALENT_CROSSBOW]+value steht. Auch die Lernpunktkosten des Stärke-Wertes werden verwendet, bedeutet also, dass man ab zum Beispiel 40 Stärke 10 Lernpunkte in Armbrust investieren muss, selbst wenn das Armbrust-Talent noch weit von irgendeiner Lernpunkt-Kostenerhöhung entfernt ist. Ich habe herausgefunden, dass das Armbrust-Talent nicht auf auf den ersten Teil, also:

    Code:
        if ((talent == NPC_TALENT_1H) 
        ||  (talent == NPC_TALENT_2H) 
        ||  (talent == NPC_TALENT_BOW) 
        ||  (talent == NPC_TALENT_CROSSBOW))
        
        && (talent != ATR_DEXTERITY)
        && (talent != ATR_STRENGTH)
        {
            concatText_P1  = ConcatStrings (concatText1, concatText2);
            concatText_P2  = ConcatStrings (concatText3, " / ");
            
            concatText_P3  = ConcatStrings (concatText_P1, concatText_P2);
            concatText_P4  = ConcatStrings (concatText_P3, IntToString(maxTeach));
            concatText_P5  = ConcatStrings (concatText_P4, " - ");
            concatText_P6  = ConcatStrings (concatText_P5, PRINT_DIV_Points);
            concatText_P7  = ConcatStrings (IntToString(B_GetLearnCostTalent(her, talent, value)), ")");    
            
            concatText_All = ConcatStrings (concatText_P6, concatText_P7);
    zugreift, sondern auf diesen Teil:

    Code:
        } else if ((talent == ATR_DEXTERITY) || (talent == ATR_STRENGTH)) {    
            concatText_P1  = ConcatStrings (concatText1, concatText2);
            concatText_P2  = ConcatStrings (concatText3, " / ");
            
            concatText_P3  = ConcatStrings (concatText_P1, concatText_P2);
            concatText_P4  = ConcatStrings (concatText_P3, IntToString(maxTeach));
            concatText_P5  = ConcatStrings (concatText_P4, " - ");
            concatText_P6  = ConcatStrings (concatText_P5, PRINT_DIV_Points);
            concatText_P7  = ConcatStrings (IntToString(B_GetLearnCostAttribute(her, talent)*value), ")");
            
            concatText_All = ConcatStrings (concatText_P6, concatText_P7);
    Aber warum tut es das? Alle anderen Talente greifen doch auch auf den korrekten Teil im Skript zu. Ich habe auch schon versucht diesen unteren Teil umzuschreiben:

    Code:
        if ((talent == NPC_TALENT_1H)     ||  (talent == NPC_TALENT_2H) 
        ||  (talent == NPC_TALENT_BOW) 
        ||  (talent == NPC_TALENT_CROSSBOW))
        
        && (talent != ATR_DEXTERITY)
        && (talent != ATR_STRENGTH)
        {
            concatText_P1  = ConcatStrings (concatText1, concatText2);
            concatText_P2  = ConcatStrings (concatText3, " / ");
            
            concatText_P3  = ConcatStrings (concatText_P1, concatText_P2);
            concatText_P4  = ConcatStrings (concatText_P3, IntToString(maxTeach));
            concatText_P5  = ConcatStrings (concatText_P4, " - ");
            concatText_P6  = ConcatStrings (concatText_P5, PRINT_DIV_Points);
            concatText_P7  = ConcatStrings (IntToString(B_GetLearnCostTalent(her, talent, value)), ")");    
            
            concatText_All = ConcatStrings (concatText_P6, concatText_P7);
        };
        
        if ((talent == ATR_DEXTERITY)
        ||  (talent == ATR_STRENGTH))
        
        && (talent != NPC_TALENT_1H) 
        && (talent != NPC_TALENT_2H) 
        && (talent != NPC_TALENT_BOW) 
        && (talent != NPC_TALENT_CROSSBOW)
        {
            concatText_P1  = ConcatStrings (concatText1, concatText2);
            concatText_P2  = ConcatStrings (concatText3, " / ");
            
            concatText_P3  = ConcatStrings (concatText_P1, concatText_P2);
            concatText_P4  = ConcatStrings (concatText_P3, IntToString(maxTeach));
            concatText_P5  = ConcatStrings (concatText_P4, " - ");
            concatText_P6  = ConcatStrings (concatText_P5, PRINT_DIV_Points);
            concatText_P7  = ConcatStrings (IntToString(B_GetLearnCostAttribute(her, talent)*value), ")");
            
            concatText_All = ConcatStrings (concatText_P6, concatText_P7);
        };
        
        if (talent != ATR_DEXTERITY)
        && (talent != ATR_STRENGTH)
        && (talent != NPC_TALENT_1H) 
        && (talent != NPC_TALENT_2H) 
        && (talent != NPC_TALENT_BOW) 
        && (talent != NPC_TALENT_CROSSBOW)
        {
            concatText_P1  = ConcatStrings (concatText1, " - ");
            concatText_P2  = ConcatStrings (concatText_P1, PRINT_DIV_Points);
            concatText_P3  = ConcatStrings (IntToString(B_GetLearnCostTalent(her, talent, value)), ")");
            
            concatText_All = ConcatStrings (concatText_P2, concatText_P3);
        };
        
        return concatText_All;
    };
    Nur dann gerät bei den Strings alles komplett durcheinander.


    Edit: Ich habe nun noch ein bisschen herumprobiert, das Skript etwas umgeschrieben. Armbrust-Talent wurde nun plötzlich korrekt angezeigt, das Spiel erkennt nun auch, dass Armbrust zu Teil 1 gehört. Problem gelöst, dachte ich, denn nun denkt stattdessen die Stärke, sie würde ebenfalls zu Teil 1 gehören. und das Spiel zeigt statt dem Stärke-Wert des Helden den Armbrust-Talent-Wert an. Sehr merkwürdig. Hoffe, jemand weiß, wo das Problem liegt. Hier nochmal das aktuelle Skript:

    Code:
    func string DIV_BuildTeachTalentString (var string text, var int talent, var int value, var int maxTeach)
    {
        // var C_NPC hero; hero = Hlp_GetNpc(PC_heroo);
    
    
    
    
        var string concatText1;
        var string concatText2;
        var string concatText3;
        
        var string concatText_P1;
        var string concatText_P2;
        var string concatText_P3;
        var string concatText_P4;
        var string concatText_P5;
        var string concatText_P6;
        var string concatText_P7;
        
        var string concatText_All;
    
    
        concatText1 = ConcatStrings ("(", text);
        
        if (talent == ATR_DEXTERITY) 
        { 
            concatText2 = ConcatStrings (" +", IntToString(value));
            concatText3 = ConcatStrings (" = ",IntToString(hero.Attribute[ATR_DEXTERITY] + value));
        };
        
        if (talent == ATR_STRENGTH) 
        {
            concatText2 = ConcatStrings (" +", IntToString(value));
            concatText3 = ConcatStrings (" = ",IntToString(hero.Attribute[ATR_STRENGTH] + value));
        };
        
        if (talent == NPC_TALENT_1H) 
        { 
            concatText2 = ConcatStrings (" +", IntToString(value));
            concatText3 = ConcatStrings (" = ",IntToString(hero.HitChance[NPC_TALENT_1H] + value));
        };
        
        if (talent == NPC_TALENT_2H) 
        { 
            concatText2 = ConcatStrings (" +", IntToString(value));
            concatText3 = ConcatStrings (" = ",IntToString(hero.HitChance[NPC_TALENT_2H] + value));
        };
        
        if (talent == NPC_TALENT_BOW) 
        {
            concatText2 = ConcatStrings (" +", IntToString(value));
            concatText3 = ConcatStrings (" = ",IntToString(hero.HitChance[NPC_TALENT_BOW] + value));
        };
        
        if (talent == NPC_TALENT_CROSSBOW) 
        {
            concatText2 = ConcatStrings (" +", IntToString(value));
            concatText3 = ConcatStrings (" = ",IntToString(hero.HitChance[NPC_TALENT_CROSSBOW] + value));
        };
    
    
    
    
        if  (talent == NPC_TALENT_1H) 
        ||  (talent == NPC_TALENT_2H) 
        ||  (talent == NPC_TALENT_BOW) 
        ||  (talent == NPC_TALENT_CROSSBOW)
        {
            concatText_P1  = ConcatStrings (concatText1, concatText2);
            concatText_P2  = ConcatStrings (concatText3, " / ");
            
            concatText_P3  = ConcatStrings (concatText_P1, concatText_P2);
            concatText_P4  = ConcatStrings (concatText_P3, IntToString(maxTeach));
            concatText_P5  = ConcatStrings (concatText_P4, " - ");
            concatText_P6  = ConcatStrings (concatText_P5, PRINT_DIV_Points);
            concatText_P7  = ConcatStrings (IntToString(B_GetLearnCostTalent(hero, talent, value)), ")");
            
            concatText_All = ConcatStrings (concatText_P6, concatText_P7);
        
        } else
        
        if  (talent == ATR_DEXTERITY)
        ||  (talent == ATR_STRENGTH)
        {
            concatText_P1  = ConcatStrings (concatText1, concatText2);
            concatText_P2  = ConcatStrings (concatText3, " / ");
            
            concatText_P3  = ConcatStrings (concatText_P1, concatText_P2);
            concatText_P4  = ConcatStrings (concatText_P3, IntToString(maxTeach));
            concatText_P5  = ConcatStrings (concatText_P4, " - ");
            concatText_P6  = ConcatStrings (concatText_P5, PRINT_DIV_Points);
            concatText_P7  = ConcatStrings (IntToString(B_GetLearnCostAttribute(hero, talent)*value), "PartII)");
            
            concatText_All = ConcatStrings (concatText_P6, concatText_P7);
            
        } else
        {
            concatText_P1  = ConcatStrings (concatText1, " - ");
            concatText_P2  = ConcatStrings (concatText_P1, PRINT_DIV_Points);
            concatText_P3  = ConcatStrings (IntToString(B_GetLearnCostTalent(hero, talent, value)), "PartIII)");
            
            concatText_All = ConcatStrings (concatText_P2, concatText_P3);
        };
        
        return concatText_All;
    };
    Im Lehrer-Dialog sieht das übrigens zum Beispiel so aus:

    Info_AddChoice (DIA_Martin_Teach, DIV_BuildTeachTalentString (PRINT_DIV_LearnDEX, ATR_DEXTERITY, 5, 40), DIA_Martin_Teach_DEX_5);
    Geändert von Bloodfly91 (11.08.2019 um 21:30 Uhr)

  2. Beiträge anzeigen #2 Zitieren
    Knight
    Registriert seit
    Aug 2009
    Ort
    Hessen
    Beiträge
    1.487
     
    Cryp18Struct ist offline
    Code:
    const int NPC_TALENT_CROSSBOW			= 4;
    [...]
    const int ATR_STRENGTH				=  4;
    Wenn in einer Variable eine 4 gespeichert ist, dann ist es unmöglich festzustellen was gemeint ist.
    Talente und Attrubute gleichzeitig zu behandeln ist eher nicht sinnvoll. Du könntest einen zusätzlichen parameter in die Funktion einbauen und dort einen Wert übergeben der "markiert" ob ein Attribut oder ein Talent behandelt werden soll. Oder halt 2 unterschiedliche Funktionen.

  3. Homepage besuchen Beiträge anzeigen #3 Zitieren
    Team Velen
    Registriert seit
    Aug 2015
    Beiträge
    952
     
    Bloodfly91 ist offline
    Zitat Zitat von Cryp18Struct Beitrag anzeigen
    Code:
    const int NPC_TALENT_CROSSBOW            = 4;
    [...]
    const int ATR_STRENGTH                =  4;
    Wenn in einer Variable eine 4 gespeichert ist, dann ist es unmöglich festzustellen was gemeint ist.
    Talente und Attrubute gleichzeitig zu behandeln ist eher nicht sinnvoll. Du könntest einen zusätzlichen parameter in die Funktion einbauen und dort einen Wert übergeben der "markiert" ob ein Attribut oder ein Talent behandelt werden soll. Oder halt 2 unterschiedliche Funktionen.
    Oh Mann, da hätte ich vermutlich noch ewig nach dem Problem gesucht...
    Ich habe nun zwei separate Funktionen und so scheint perfekt zu funktionieren, vielen Dank!

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