[G1] Jak zrobić by bonusy z mikstur i pierścieni nie wliczały się do nauki? 114 2

O temacie

Autor Kirgo2

Zaczęty 22.01.2026 roku

Wyświetleń 114

Odpowiedzi 2

Kirgo2

Kirgo2

Użytkownicy
posty52
Propsy7
ProfesjaGracz
  • Użytkownicy
Czołem!
Zaimplementowałem do Gothica I system nauki wzorowany na Nocy Kruka wzięty stąd: http://themodders.org/index.php?topic=25808.msg1385525#msg1385525

Mam jednak problem bo próbuję zrobić by bonusy z mikstur stałych, pierścieni i takie bonusy jak ten od Horacego nie wliczały się do progów nauki.

Bardzo prosiłbym o pomoc.
 

|-Aragnis-|

|-Aragnis-|

Użytkownicy
posty17
Propsy18
Profesjabrak
  • Użytkownicy
W Story_Globals.d dodaj sobie nowe zmienne np:

Spoiler
var int Learned_STRENGTH;
var int Learned_DEXTERITY;
var int Learned_MANA;
var int Learned_1H;
var int Learned_2H;
var int Learned_BOW;
var int Learned_CROSSBOW;

Później w funkcji B_GetLearnCostAttribute zamień umiejętności na te nowe zmienne:

Spoiler
Przykładowo siła:

   if(attribut == ATR_STRENGTH)
   {
      if(Learned_STRENGTH >= 150)
      {
         kosten = 5;
      }
      else if(Learned_STRENGTH  >= 100)
      {
         kosten = 4;
      }
      else if(Learned_STRENGTH  >= 50)
      {
         kosten = 3;
      }
      else if(Learned_STRENGTH  >= 1) 
      {
         kosten = 2;
      }
      else
      {
         kosten = 1;
      };
   };


Później w funkcji B_TeachAttributePoints:

Zamieniasz:

Spoiler
   if(attrib == ATR_STRENGTH)
   {
      realAttribute = oth.attribute[ATR_STRENGTH];
   }

na:

Spoiler
   if(attrib == ATR_STRENGTH)
   {
      realAttribute = Learned_Strength;
   }

I na końcu funkcji przed return true;  dodajesz:

 
Spoiler
   if (attrib == ATR_STRENGTH)
    {
        Learned_STRENGTH = Learned_STRENGTH + points;
    };

I analogicznie dla zręczności i many.

Jeśli chodzi o walkę bronią to podobnie jak w przypadku atrybutów tylko w funkcji B_GetLearnCostTalent oraz  B_TeachFightTalentPercent.

Spoiler
Przykładowo w funkcji B_TeachFightTalentPercent powinno to wyglądać tak, na przykładzie 1h:

   if(talent == NPC_TALENT_1H)
   {
      realHitChance = Learned_1H;
   }

i trochę niżej:

   if(talent == NPC_TALENT_1H)
   {
      B_RaiseFightTalent(oth,NPC_TALENT_1H,percent);
        Learned_1H = Learned_1H + percent;

      if(oth.aivar[REAL_TALENT_1H] >= (oth.aivar[REAL_TALENT_2H] + 30))
      {
         B_RaiseFightTalent(oth,NPC_TALENT_2H,percent);
             Learned_2H = Learned_2H + percent;
         PrintScreen(PRINT_Learn1H_and_2H,-1,-1,FONT_Screen,2);
      }
      else
      {
         PrintScreen(PRINT_Learn1H,-1,-1,FONT_Screen,2);
      };
      return TRUE;
   };

Działa to jak w g2, czyli dostajesz punkty władania 2H po nauczeniu władania 1H od pewnego poziomu, jeśli tego nie chcesz możesz to zmienić.

Później w dialogach możesz sobie też zmienić, aby nauczyciele nie brali pod uwagę całej ogólnej umiejętności w limicie nauczania, tylko samą wyuczoną:

Spoiler
Na przykładzie łuku u Niclasa:

func void DIA_Niclas_Teach_Info()
{
   AI_Output(other,self,"DIA_Niclas_Teach_15_00");   //Pokaż mi proszę, jak się posługiwać łukiem.
   if(Learned_BOW >= 60)
   {
      AI_Output(self,other,"DIA_Niclas_Teach_03_01");   //Nauczyłem cię już wszystkiego, co sam umiałem. Musisz sobie poszukać innego nauczyciela.
   }
   else
   {
      Info_ClearChoices(DIA_Niclas_Teach);
      Info_AddChoice(DIA_Niclas_Teach,Dialog_Back,DIA_Niclas_Teach_Back);
      Info_AddChoice(DIA_Niclas_Teach,B_BuildLearnString(PRINT_LearnBow1,B_GetLearnCostTalent(other,NPC_TALENT_BOW,1)),DIA_Niclas_Teach_BOW_1);
      Info_AddChoice(DIA_Niclas_Teach,B_BuildLearnString(PRINT_LearnBow5,B_GetLearnCostTalent(other,NPC_TALENT_BOW,1) * 5),DIA_Niclas_Teach_BOW_5);
   };
};

Mam nadzieję że niczego nie pominąłem xD

Z zablokowaniem przeskakiwania progów u nauczycieli jeszcze nie kombinowałem ale pewnie wystarczyło by przerobić samą funkcje B_GetLearnCostTalent i B_GetLearnCostAttribute.
 

Kirgo2

Kirgo2

Użytkownicy
posty52
Propsy7
ProfesjaGracz
  • Użytkownicy
Naprawdę ogromne dzięki za pomoc. Bardzo mi zależało, żeby załatwić kwestię bonusów do siły, zręczności i w mniejszym stopniu do many. Z tymi trzema statystykami wszystko ładnie śmiga.

Trochę gorzej jest z umiejętnościami bojowymi.

Wkleiłem ten kod:

if(talent == NPC_TALENT_1H)
   {
      B_RaiseFightTalent(oth,NPC_TALENT_1H,percent);
        Learned_1H = Learned_1H + percent;

      if(oth.aivar[REAL_TALENT_1H] >= (oth.aivar[REAL_TALENT_2H] + 30))
      {
         B_RaiseFightTalent(oth,NPC_TALENT_2H,percent);
             Learned_2H = Learned_2H + percent;
         PrintScreen(PRINT_Learn1H_and_2H,-1,-1,FONT_Screen,2);
      }
      else
      {
         PrintScreen(PRINT_Learn1H,-1,-1,FONT_Screen,2);
      };
      return TRUE;
   };

do funkcji B_TeachFightTalentPercent.

Tylko, że w Gothic 1 funkcji B_RaiseFightTalent nie ma i w swoim skrypcie @bgb też go nie dodawał więc go nie ma.

@bgb w swoim skrypcie (na którym ja bazuję) zastąpił:

B_RaiseFightTalent(oth,NPC_TALENT_1H,percent);
czymś takim:

Npc_SetTalentValue(hero, NPC_TALENT_1H, Npc_GetTalentValue(hero, NPC_TALENT_1H)+percent);


Może więc po prostu wkleję wszystkie rzeczy, które dotyczą nauki umiejętności bojowych z tego skryptu to będzie łatwiej wychwycić co poszło nie tak:

//////////////////////////////////////////////////////////////////////////
// NOTR learning weapon and atrribute system
// ===============
//
//////////////////////////////////////////////////////////////////////////

func int B_GetLearnCostTalent(var C_Npc oth,var int talent,var int skill)
{
   var int kosten;
   kosten = 0;
   if(talent == NPC_TALENT_1H)
   {
      if(Npc_GetTalentValue(hero,NPC_TALENT_1H) >= 90)
      {
         kosten = 4;
      }
      else if(Npc_GetTalentValue(hero,NPC_TALENT_1H) >= 60)
      {
         kosten = 3;
      }
      else if(Npc_GetTalentValue(hero,NPC_TALENT_1H) >= 30)
      {
         kosten = 2;
      }
      else
      {
         kosten = 1;
      };
      kosten = kosten * skill;
   };
   if(talent == NPC_TALENT_2H)
   {
      if(Npc_GetTalentValue(hero,NPC_TALENT_2H) >= 90)
      {
         kosten = 4;
      }
      else if(Npc_GetTalentValue(hero,NPC_TALENT_2H) >= 60)
      {
         kosten = 3;
      }
      else if(Npc_GetTalentValue(hero,NPC_TALENT_2H) >= 30)
      {
         kosten = 2;
      }
      else
      {
         kosten = 1;
      };
     
      kosten = kosten * skill;
   };
   if(talent == NPC_TALENT_BOW)
   {
      if(Npc_GetTalentValue(hero,NPC_TALENT_BOW) >= 90)
      {
         kosten = 4;
      }
      else if(Npc_GetTalentValue(hero,NPC_TALENT_BOW) >= 60)
      {
         kosten = 3;
      }
      else if(Npc_GetTalentValue(hero,NPC_TALENT_BOW) >= 30)
      {
         kosten = 2;
      }
      else
      {
         kosten = 1;
      };
     
      kosten = kosten * skill;
   };
   if(talent == NPC_TALENT_CROSSBOW)
   {
      if(Npc_GetTalentValue(hero,NPC_TALENT_CROSSBOW) >= 90)
      {
         kosten = 4;
      }
      else if(Npc_GetTalentValue(hero,NPC_TALENT_CROSSBOW) >= 60)
      {
         kosten = 3;
      }
      else if(Npc_GetTalentValue(hero,NPC_TALENT_CROSSBOW) >= 30)
      {
         kosten = 2;
      }
      else
      {
         kosten = 1;
      };
     
      kosten = kosten * skill;
   };   
   return kosten;
};

func void B_SetFightSkill(var C_Npc slf,var int talent,var int percent)
{
   if(talent == NPC_TALENT_1H)
   {
      if(Npc_GetTalentValue(hero,NPC_TALENT_1H) >= 0)
      {
         Npc_SetTalentSkill(slf,NPC_TALENT_1H,0);
      };
      if(Npc_GetTalentValue(hero,NPC_TALENT_1H) >= 30)
      {
         Npc_SetTalentSkill(slf,NPC_TALENT_1H,1);
      };
      if(Npc_GetTalentValue(hero,NPC_TALENT_1H) >= 60)
      {
         Npc_SetTalentSkill(slf,NPC_TALENT_1H,2);
      };
   };
   if(talent == NPC_TALENT_2H)
   {
      if(Npc_GetTalentValue(hero,NPC_TALENT_2H) >= 0)
      {
         Npc_SetTalentSkill(slf,NPC_TALENT_2H,0);
      };
      if(Npc_GetTalentValue(hero,NPC_TALENT_2H) >= 30)
      {
         Npc_SetTalentSkill(slf,NPC_TALENT_2H,1);
      };
      if(Npc_GetTalentValue(hero,NPC_TALENT_2H) >= 60)
      {
         Npc_SetTalentSkill(slf,NPC_TALENT_2H,2);
      };
   };
   if(talent == NPC_TALENT_BOW)
   {
      if(Npc_GetTalentValue(hero,NPC_TALENT_BOW) >= 0)
      {
         Npc_SetTalentSkill(slf,NPC_TALENT_BOW,0);
      };
      if(Npc_GetTalentValue(hero,NPC_TALENT_BOW) >= 30)
      {
         Npc_SetTalentSkill(slf,NPC_TALENT_BOW,1);
      };
      if(Npc_GetTalentValue(hero,NPC_TALENT_BOW) >= 60)
      {
         Npc_SetTalentSkill(slf,NPC_TALENT_BOW,2);
      };
   };
   if(talent == NPC_TALENT_CROSSBOW)
   {
      if(Npc_GetTalentValue(hero,NPC_TALENT_CROSSBOW) >= 0)
      {
         Npc_SetTalentSkill(slf,NPC_TALENT_CROSSBOW,0);
      };
      if(Npc_GetTalentValue(hero,NPC_TALENT_CROSSBOW) >= 30)
      {
         Npc_SetTalentSkill(slf,NPC_TALENT_CROSSBOW,1);
      };
      if(Npc_GetTalentValue(hero,NPC_TALENT_CROSSBOW) >= 60)
      {
         Npc_SetTalentSkill(slf,NPC_TALENT_CROSSBOW,2);
      };
   };
};

func int B_TeachFightTalentPercent(var C_Npc slf,var C_Npc oth,var int talent,var int percent,var int teacherMAX)
{
   var string concatText;
   var int kosten;
   var int realHitChance;
   kosten = B_GetLearnCostTalent(oth,talent,1) * percent;
   if((talent != NPC_TALENT_1H) && (talent != NPC_TALENT_2H) && (talent != NPC_TALENT_BOW) && (talent != NPC_TALENT_CROSSBOW))
   {
      Print("*** Błąd: Zły parametr ***");
      return FALSE;
   };
   if(talent == NPC_TALENT_1H)
   {
            realHitChance = Learned_1H; /// nie wiem czy dobrze
   }
   else if(talent == NPC_TALENT_2H)
   {
      realHitChance = Learned_2H; /// nie wiem czy dobrze
   }
   else if(talent == NPC_TALENT_BOW)
   {
      realHitChance = Learned_Bow; /// nie wiem czy dobrze
   }
   else if(talent == NPC_TALENT_CROSSBOW)
   {
      realHitChance = Learned_CrossBow; /// nie wiem czy dobrze
   };
   if(realHitChance >= teacherMAX)
   {
      concatText = ConcatStrings("Maksimum dla tego nauczyciela wynosi ",IntToString(teacherMAX));
      PrintScreen(concatText,-1,-1,"FONT_OLD_20_WHITE.TGA",2);
      B_Say(slf,oth,"$NOLEARNYOUREBETTER");
      return FALSE;
   };
   if((realHitChance + percent) > teacherMAX)
   {
      concatText = ConcatStrings("Maksimum dla tego nauczyciela wynosi ",IntToString(teacherMAX));
      PrintScreen(concatText,-1,-1,"FONT_OLD_20_WHITE.TGA",2);
      B_Say(slf,oth,"$NOLEARNOVERPERSONALMAX");
      return FALSE;
   };
   if(oth.lp < kosten)
   {
      PrintScreen("Za mało Punktów Nauki!",-1,-1,"FONT_OLD_20_WHITE.TGA",2);
      B_Say(slf,oth,"$NOLEARNNOPOINTS");
      return FALSE;
   };
   oth.lp = oth.lp - kosten;
   if(talent == NPC_TALENT_1H)
   {
      Npc_SetTalentValue(hero, NPC_TALENT_1H, Npc_GetTalentValue(hero, NPC_TALENT_1H)+percent);
      if(Npc_GetTalentValue(hero,NPC_TALENT_1H) >= (Npc_GetTalentValue(hero,NPC_TALENT_2H) +30))
      {
         Npc_SetTalentValue(hero, NPC_TALENT_2H, Npc_GetTalentValue(hero, NPC_TALENT_2H)+percent);
         PrintScreen("Trening: posługiwanie się bronią jedno- i dwuręczną", -1,10,"FONT_OLD_20_WHITE.TGA",2);
         B_SetFightSkill(hero,NPC_TALENT_2H,percent);
      }
      else
      {
         PrintScreen("Trening: posługiwanie się bronią jednoręczną", -1,10,"FONT_OLD_20_WHITE.TGA",2);
      };
      B_SetFightSkill(hero,talent,percent);
      return TRUE;
   };
   if(talent == NPC_TALENT_2H)
   {
      Npc_SetTalentValue(hero, NPC_TALENT_2H, Npc_GetTalentValue(hero, NPC_TALENT_2H)+percent);   
      if(Npc_GetTalentValue(hero,NPC_TALENT_2H) >= (Npc_GetTalentValue(hero,NPC_TALENT_1H) +30))   
      {
         Npc_SetTalentValue(hero, NPC_TALENT_1H, Npc_GetTalentValue(hero, NPC_TALENT_1H)+percent);
         B_SetFightSkill(hero,NPC_TALENT_1H,percent);
         PrintScreen   ("Trening: posługiwanie się bronią dwu- i jednoręczną", -1,10,"FONT_OLD_20_WHITE.TGA",2);
      }
      else
      {
         PrintScreen   ("Trening: posługiwanie się bronią dwuręczną", -1,10,"FONT_OLD_20_WHITE.TGA",2);
      };
      B_SetFightSkill(hero,talent,percent);
      return TRUE;
   };
   if(talent == NPC_TALENT_BOW)
   {
      Npc_SetTalentValue(hero, NPC_TALENT_BOW, Npc_GetTalentValue(hero, NPC_TALENT_BOW)+percent);
      if(Npc_GetTalentValue(hero,NPC_TALENT_BOW) >= (Npc_GetTalentValue(hero,NPC_TALENT_CROSSBOW) +30))   
      {
         Npc_SetTalentValue(hero, NPC_TALENT_CROSSBOW, Npc_GetTalentValue(hero, NPC_TALENT_CROSSBOW)+percent);
         PrintScreen   ("Trening: posługiwanie się łukiem i kuszą", -1,10,"FONT_OLD_20_WHITE.TGA",2);
         B_SetFightSkill(hero,NPC_TALENT_CROSSBOW,percent);
      }
      else
      {
         PrintScreen   ("Trening: posługiwanie się łukiem", -1,10,"FONT_OLD_20_WHITE.TGA",2);
      };
      B_SetFightSkill(hero,talent,percent);
      return TRUE;
   };
   if(talent == NPC_TALENT_CROSSBOW)
   {
      Npc_SetTalentValue(hero, NPC_TALENT_CROSSBOW, Npc_GetTalentValue(hero, NPC_TALENT_CROSSBOW)+percent);
      if(Npc_GetTalentValue(hero,NPC_TALENT_CROSSBOW) >= (Npc_GetTalentValue(hero,NPC_TALENT_BOW) +30))   
      {
         Npc_SetTalentValue(hero, NPC_TALENT_BOW, Npc_GetTalentValue(hero, NPC_TALENT_BOW)+percent);
         B_SetFightSkill(hero,NPC_TALENT_BOW,percent);
         PrintScreen   ("Trening: posługiwanie się kuszą i łukiem", -1,10,"FONT_OLD_20_WHITE.TGA",2);         
      }
      else
      {
         PrintScreen   ("Trening: posługiwanie się kuszą", -1,10,"FONT_OLD_20_WHITE.TGA",2);
      };
      B_SetFightSkill(hero,talent,percent);
      return TRUE;
   };
};

W pliku PC_Hero.d na próbę zrobiłem też żeby było
Npc_SetTalentValue(self, NPC_TALENT_1H,10);
Learned_1H = 90;
Npc_SetTalentValue(self, NPC_TALENT_2H,10);
Learned_2H = 90;

bo chciałem zobaczyć czy zostanie to uwzględnione u nauczycieli broni jednoręcznej. Cord dalej jednak przeliczał tak jakby nie widział "Learned_1H = 90".

Podrzucam też dla pewności przykładowy dialog z nauką broni jednoręcznej u Corda:

Spoiler
// **************************************************
// TRAIN 1H - NOTR
// **************************************************

instance Cord_Training_NotRCombat(C_Info)
{
npc = SLD_709_Cord;
condition = Cord_Training_NotRCombat_Condition;
information = Cord_Training_NotRCombat_Info;
important = 0;
permanent = 1;
description = "Naucz mnie walczyć bronią jednoręczną";
};


func int Cord_Training_NotRCombat_Condition()
{
if (Npc_KnowsInfo(hero,SLD_709_Cord_TRAINOFFER))
{
return 1;
};
};

func void Cord_Training_NotRCombat_Info()
{
Info_ClearChoices(Cord_Training_NotRCombat);
Info_AddChoice(Cord_Training_NotRCombat,"Wróć",Cord_Training_NotRCombat_BACK);

Info_AddChoice(Cord_Training_NotRCombat,B_BuildLearnString("Broń jednoręczna +5 (20 bryłek za każdy 1 PN)",B_GetLearnCostTalent(other,NPC_TALENT_1H,5),0),Cord_Training_NotRCombat_1H_5);

};

func void Cord_Training_NotRCombat_1H_5()
{
      if(Npc_GetTalentValue(hero,NPC_TALENT_1H) >= 100) && (Npc_HasItems(other,itminugget) >= 400)
{
PrintScreen ("Ale Ty już osiągnąłeś 100% tej umiejętności!", -1,-1,"font_old_20_white.tga",3);
Info_ClearChoices(Cord_Training_NotRCombat);
Info_AddChoice(Cord_Training_NotRCombat,Dialog_Back,Cord_Training_NotRCombat_Back);
}
 
  else if(Npc_GetTalentValue(hero,NPC_TALENT_1H) >= 90) && (Npc_HasItems(other,itminugget) >= 400)
{
B_TeachFightTalentPercent(self,other,NPC_TALENT_1H,5,100);
B_GiveInvItems(other,self,itminugget,400);
Info_ClearChoices(Cord_Training_NotRCombat);
Info_AddChoice(Cord_Training_NotRCombat,Dialog_Back,Cord_Training_NotRCombat_Back);

Info_AddChoice(Cord_Training_NotRCombat,B_BuildLearnString("Broń jednoręczna +5 (20 bryłek za każdy 1 PN)",B_GetLearnCostTalent(other,NPC_TALENT_1H,5),0),Cord_Training_NotRCombat_1H_5);

}
      else if(Npc_GetTalentValue(hero,NPC_TALENT_1H) >= 60) && (Npc_HasItems(other,itminugget) >= 300)
{
B_TeachFightTalentPercent(self,other,NPC_TALENT_1H,5,100);
B_GiveInvItems(other,self,itminugget,300);
Info_ClearChoices(Cord_Training_NotRCombat);
Info_AddChoice(Cord_Training_NotRCombat,Dialog_Back,Cord_Training_NotRCombat_Back);

Info_AddChoice(Cord_Training_NotRCombat,B_BuildLearnString("Broń jednoręczna +5 (20 bryłek za każdy 1 PN)",B_GetLearnCostTalent(other,NPC_TALENT_1H,5),0),Cord_Training_NotRCombat_1H_5);

}
      else if(Npc_GetTalentValue(hero,NPC_TALENT_1H) >= 30) && (Npc_HasItems(other,itminugget) >= 200)
{
B_TeachFightTalentPercent(self,other,NPC_TALENT_1H,5,100);
B_GiveInvItems(other,self,itminugget,200);
Info_ClearChoices(Cord_Training_NotRCombat);
Info_AddChoice(Cord_Training_NotRCombat,Dialog_Back,Cord_Training_NotRCombat_Back);

Info_AddChoice(Cord_Training_NotRCombat,B_BuildLearnString("Broń jednoręczna +5 (20 bryłek za każdy 1 PN)",B_GetLearnCostTalent(other,NPC_TALENT_1H,5),0),Cord_Training_NotRCombat_1H_5);

}
      else if(Npc_GetTalentValue(hero,NPC_TALENT_1H) >= 0) && (Npc_HasItems(other,itminugget) >= 100)
{
B_TeachFightTalentPercent(self,other,NPC_TALENT_1H,5,100);
B_GiveInvItems(other,self,itminugget,100);
Info_ClearChoices(Cord_Training_NotRCombat);
Info_AddChoice(Cord_Training_NotRCombat,Dialog_Back,Cord_Training_NotRCombat_Back);

Info_AddChoice(Cord_Training_NotRCombat,B_BuildLearnString("Broń jednoręczna +5 (20 bryłek za każdy 1 PN)",B_GetLearnCostTalent(other,NPC_TALENT_1H,5),0),Cord_Training_NotRCombat_1H_5);

}
       else
{
AI_Output (self,other,"DIA_Cord_TRAIN_2h_NoOre_01_00"); //Wróć, gdy będziesz miał wystarczająco dużo rudy.
};
};

func void Cord_Training_NotRCombat_BACK()
{
Info_ClearChoices(Cord_Training_NotRCombat);
};

 


0 użytkowników i 1 Gość przegląda ten wątek.
0 użytkowników
Do góry