Proste tworzenie nauczycieli 3331 4

O temacie

Autor Siemekk

Zaczęty 16.07.2017 roku

Wyświetleń 3331

Odpowiedzi 4

Siemekk

Siemekk

Złote Wrota
Untersturmfuhrer
posty2143
Propsy1151
ProfesjaProgramista
  • Złote Wrota
  • Untersturmfuhrer

Siemekk
Złote Wrota

Proste tworzenie nauczycieli
2017-07-16, 20:54(Ostatnia zmiana: 2017-08-23, 23:06)
Teachers Maker
Platforma gry: Gothic 2 (Wkrótce Gothic 1)
Wymagany jest NetFramework 4.5
Na potrzeby modyfikacji: Złote Wrota 2 Królestwo Elei
Twórca programu: Siemekk
Wersja programu: 1.1
Testerzy:
Carelion
Fabiosek

Opis:
Jako, iż napisałem nowy system nauki, gdzie możemy podać trochę więcej argumentów takich jak np.:(maksymalna ilość punktów którą nauczyciel może nas nauczyć, bądź mnożnik ceny jaką zażyczy) postanowiłem napisać swój pierwszy program, który w łatwy sposób tworzyłby dialog dla nauczyciela. Program ma dwie możliwości zapisu - Do pliku bądź jako plik. Podczas zapisu do pliku należy podać plik, jak wyskoczy, że nastąpi zastąpienie pliku kliknij zapisz, a program dopisze skrypt do pliku. Do właściwego działania programu potrzebny jest ten skrypt:
/*
Funkcje odpowiedzialne za:
Naukę i budowanie tekstu!
Budowane są przez Teachers Maker.exe
// -------------------------------------------------------------------------------------;
Teach_GetLearnCost i TeachHitchance_GetCost w tej funkcji ustala się progi punktowe.
// -------------------------------------------------------------------------------------;
*/

const string Currency_Name = "szt. złota";
//Jeżeli nie masz LeGo odkomentuj tą funkcję
//func int RGBA(var int a, var int b, var int c, var int d)
//{
// return 0;
//};

func void PutMsg(var string msg, var int color, var int duration)
{
PrintScreen (msg, -1, -1, "font_old_20_white.tga", 3);
};


func void Teach_AivarHandle  (var C_NPC oth,var int attrib,var int points)
{
if(attrib == ATR_STRENGTH)
{
oth.aivar[REAL_STRENGTH] = oth.aivar[REAL_STRENGTH] + points;
}
else if(attrib == ATR_DEXTERITY)
{
oth.aivar[REAL_DEXTERITY] = oth.aivar[REAL_DEXTERITY] + points;
}
else if(attrib == ATR_MANA_MAX)
{
oth.aivar[REAL_MANA_MAX] = oth.aivar[REAL_MANA_MAX] + points;
};
};

func int Teach_GetLearnCost  (var C_NPC oth,var int attribut)
{
var int kosten;
kosten = 0;
if(attribut == ATR_STRENGTH)
{
if(oth.aivar[REAL_STRENGTH] >= 200)
{
kosten = 5;
}
else if(oth.aivar[REAL_STRENGTH] >= 150)
{
kosten = 4;
}
else if(oth.aivar[REAL_STRENGTH] >= 100)
{
kosten = 3;
}
else if(oth.aivar[REAL_STRENGTH] >= 50)
{
kosten = 2;
}
else
{
kosten = 1;
};
};
if(attribut == ATR_DEXTERITY)
{
if(oth.aivar[REAL_DEXTERITY] >= 200)
{
kosten = 5;
}
else if(oth.aivar[REAL_DEXTERITY] >= 150)
{
kosten = 4;
}
else if(oth.aivar[REAL_DEXTERITY] >= 100)
{
kosten = 3;
}
else if(oth.aivar[REAL_DEXTERITY] >= 50)
{
kosten = 2;
}
else
{
kosten = 1;
};
};
if(attribut == ATR_MANA_MAX)
{
if(oth.aivar[REAL_MANA_MAX] >= 300)
{
kosten = 5;
}
else if(oth.aivar[REAL_MANA_MAX] >= 200)
{
kosten = 4;
}
else if(oth.aivar[REAL_MANA_MAX] >= 120)
{
kosten = 3;
}
else if(oth.aivar[REAL_MANA_MAX] >= 60)
{
kosten = 2;
}
else
{
kosten = 1;
};
};

return kosten;
};

func void Teach_Raise (var C_NPC oth,var int attrib,var int points)
{
var string msg;
if(attrib == ATR_STRENGTH)
{
oth.attribute[ATR_STRENGTH] = oth.attribute[ATR_STRENGTH] + points;
msg=ConcatStrings("Siła + ",IntToString(points));
msg=ConcatStrings(msg, " = ");
msg=ConcatStrings(msg, IntToString(oth.attribute[ATR_STRENGTH]));
PutMsg(msg, RGBA(255,255,100,255), 6);
};
if(attrib == ATR_DEXTERITY)
{
oth.attribute[ATR_DEXTERITY] = oth.attribute[ATR_DEXTERITY] + points;
msg=ConcatStrings("Zręczność + ",IntToString(points));
msg=ConcatStrings(msg, " = ");
msg=ConcatStrings(msg, IntToString(oth.attribute[ATR_DEXTERITY]));
PutMsg(msg, RGBA(100,255,100,255), 6);
};
if(attrib == ATR_MANA_MAX)
{
oth.attribute[ATR_MANA_MAX] = oth.attribute[ATR_MANA_MAX] + points;
msg=ConcatStrings("Maks. Mana + ",IntToString(points));
msg=ConcatStrings(msg, " = ");
msg=ConcatStrings(msg, IntToString(oth.attribute[ATR_MANA_MAX]));
PutMsg(msg, RGBA(100,100,255,255), 6);
};
if(attrib == ATR_HITPOINTS_MAX)
{
oth.attribute[ATR_HITPOINTS_MAX] = oth.attribute[ATR_HITPOINTS_MAX] + points;
msg=ConcatStrings("Punkty trafień + ",IntToString(points));
msg=ConcatStrings(msg, " = ");
msg=ConcatStrings(msg, IntToString(oth.attribute[ATR_HITPOINTS_MAX]));
PutMsg(msg, RGBA(100,100,255,255), 6);
};
Teach_AivarHandle(oth,attrib,points);
};

func void B_TeachAttribute (var C_NPC slf, var C_NPC oth, var int attrib, var int points, var int teacherMAX, var int Gold_Multipler)
{
var string msg;

var int kosten; kosten = (Teach_GetLearnCost (oth, attrib) * points);

if (attrib!=ATR_STRENGTH) && (attrib!=ATR_DEXTERITY) && (attrib!=ATR_MANA_MAX)
{
Print ("*** Błąd: Zły parametr ***");
return;
};

// ------ Lernen NICHT über teacherMax ------
var int realAttribute;
if (attrib == ATR_STRENGTH) { realAttribute = oth.attribute[ATR_STRENGTH]; }
else if (attrib == ATR_DEXTERITY) { realAttribute = oth.attribute[ATR_DEXTERITY]; }
else if (attrib == ATR_MANA_MAX) { realAttribute = oth.attribute[ATR_MANA_MAX]; };

if (realAttribute >= teacherMAX)
{
msg = ConcatStrings ("Maksimum tego nauczyciela wynosi ", IntToString(teacherMAX));
PutMsg(msg, RGBA(180,0,0,255), 6);
B_Say (slf, oth, "$NOLEARNYOUREBETTER");
return;
};

if ((realAttribute + points) > teacherMAX)
{
msg = ConcatStrings ("Maksimum tego nauczyciela wynosi ", IntToString(teacherMAX));
PutMsg(msg, RGBA(180,0,0,255), 6);
B_Say (slf, oth, "$NOLEARNOVERPERSONALMAX");
return;
};

if (oth.lp < kosten)
{
B_Say (slf, oth, "$NOLEARNNOPOINTS");
PutMsg("Za mało Punktów Nauki!",RGBA(180,0,0,255), 6);
return;
};

var int Need_Gold; Need_Gold = kosten * Gold_Multipler;
if(Npc_HasItems(oth,itmi_gold)< Need_Gold)
{
B_Say (slf, oth, "$SHITNOGOLD");
PutMsg("Nie masz wystarczającej ilości pieniędzy!",RGBA(180,0,0,255), 6);
return;
};


oth.lp = oth.lp - kosten;
B_GiveInvItems(oth,slf, itmi_gold, Need_Gold);
Npc_RemoveInvItems(slf,itmi_gold,Need_Gold);
Teach_Raise (oth, attrib, points);
return;
};

func string B_BuildAttribute (var int attrib, var int points, var int multipler)
{
var int kosten; kosten = (Teach_GetLearnCost(hero,attrib) * points);
var string att;
if (attrib == ATR_STRENGTH) { att = "Siła + "; }
else if (attrib == ATR_DEXTERITY) { att = "Zręczność + "; }
else if (attrib == ATR_MANA_MAX || attrib == ATR_MANA) { att = "Maks. Mana + "; };

var string msg; msg = ConcatStrings(att, IntToString(points));

msg = ConcatStrings(msg," (Koszt: ");
msg = ConcatStrings(msg, IntToString(kosten));
msg = ConcatStrings(msg," Punktów Nauki, ");
msg = ConcatStrings(msg,IntToString(kosten* multipler));
msg = ConcatStrings(msg,Currency_Name);
msg = ConcatStrings(msg,")");

return msg;
};

func void TeachHitHance_Aivar(var C_NPC oth,var int attrib,var int points)
{
if(attrib == 1)
{
oth.aivar[REAL_TALENT_1H] = oth.aivar[REAL_TALENT_1H] + points;
}
else if(attrib == 2)
{
oth.aivar[REAL_TALENT_2H] = oth.aivar[REAL_TALENT_2H] + points;
}
else if(attrib == 3)
{
oth.aivar[REAL_TALENT_BOW] = oth.aivar[REAL_TALENT_BOW] + points;
}
else if(attrib == 4)
{
oth.aivar[REAL_TALENT_CROSSBOW] = oth.aivar[REAL_TALENT_CROSSBOW] + points;
};
};

func int TeachHitchance_GetCost(var C_NPC oth,var int attribut)
{
var int kosten;
kosten = 0;
if(attribut == 1)
{
if(oth.aivar[REAL_TALENT_1H] >= 90)
{
kosten = 4;
}
else if(oth.aivar[REAL_TALENT_1H] >= 60)
{
kosten = 3;
}
else if(oth.aivar[REAL_TALENT_1H] >= 30)
{
kosten = 2;
}
else
{
kosten = 1;
};
};
if(attribut == 2)
{
if(oth.aivar[REAL_TALENT_2H] >= 90)
{
kosten = 4;
}
else if(oth.aivar[REAL_TALENT_2H] >= 60)
{
kosten = 3;
}
else if(oth.aivar[REAL_TALENT_2H] >= 30)
{
kosten = 2;
}
else
{
kosten = 1;
};
};
if(attribut == 3)
{
if(oth.aivar[REAL_TALENT_BOW] >= 90)
{
kosten = 4;
}
else if(oth.aivar[REAL_TALENT_BOW] >= 60)
{
kosten = 3;
}
else if(oth.aivar[REAL_TALENT_BOW] >= 30)
{
kosten = 2;
}
else
{
kosten = 1;
};
};

if(attribut == 4)
{
if(oth.aivar[REAL_TALENT_CROSSBOW] >= 90)
{
kosten = 4;
}
else if(oth.aivar[REAL_TALENT_CROSSBOW] >= 60)
{
kosten = 3;
}
else if(oth.aivar[REAL_TALENT_CROSSBOW] >= 30)
{
kosten = 2;
}
else
{
kosten = 1;
};
};

return kosten;
};

func void Raise_Hitchance(var C_NPC oth,var int attrib,var int points)
{
var string msg;
if(attrib == 1)
{
oth.hitchance[1] = oth.hitchance[1] + points;
msg=ConcatStrings("Broń jednoręczna + ",IntToString(points));
msg=ConcatStrings(msg, " = ");
msg=ConcatStrings(msg, IntToString(oth.hitchance[1]));
PutMsg(msg,RGBA(255,255,100,255), 6);
};
if(attrib == 2)
{
oth.hitchance[2] = oth.hitchance[2] + points;
msg=ConcatStrings("Broń dwuręczna + ",IntToString(points));
msg=ConcatStrings(msg, " = ");
msg=ConcatStrings(msg, IntToString(oth.hitchance[2]));
PutMsg(msg,RGBA(100,255,100,255), 6);
};
if(attrib == 3)
{
oth.hitchance[3] = oth.hitchance[3] + points;
msg=ConcatStrings("Łuk + ",IntToString(points));
msg=ConcatStrings(msg, " = ");
msg=ConcatStrings(msg, IntToString(oth.hitchance[3]));
PutMsg(msg,RGBA(100,100,255,255), 6);
};

if(attrib == 4)
{
oth.hitchance[4] = oth.hitchance[4] + points;
msg=ConcatStrings("Kusza + ",IntToString(points));
msg=ConcatStrings(msg, " = ");
msg=ConcatStrings(msg, IntToString(oth.hitchance[4]));
PutMsg(msg,RGBA(100,100,255,255), 6);
};

TeachHitHance_Aivar(oth,attrib,points);
};

func void B_TeachHitchance(var C_NPC slf, var C_NPC oth, var int attrib, var int points, var int teacherMAX, var int Gold_Multipler)
{
var string msg;

var int kosten; kosten = (TeachHitchance_GetCost (oth, attrib) * points);

if (attrib!=1) && (attrib!=2) && (attrib!=3) && (attrib!=4)
{
Print ("*** Błąd: Zły parametr ***");
return;
};

// ------ Lernen NICHT über teacherMax ------
var int realAttribute;
if (attrib == 1) { realAttribute = oth.hitchance[1]; }
else if (attrib == 2) { realAttribute = oth.hitchance[2]; }
else if (attrib == 3) { realAttribute = oth.hitchance[3]; }
else if (attrib == 4) { realAttribute = oth.hitchance[4]; };

if (realAttribute >= teacherMAX)
{
msg = ConcatStrings ("Maksimum tego nauczyciela wynosi ", IntToString(teacherMAX));
PutMsg(msg,RGBA(180,0,0,255), 6);
B_Say (slf, oth, "$NOLEARNYOUREBETTER");
return;
};

if ((realAttribute + points) > teacherMAX)
{
msg = ConcatStrings ("Maksimum tego nauczyciela wynosi ", IntToString(teacherMAX));
PutMsg(msg,RGBA(180,0,0,255), 6);
B_Say (slf, oth, "$NOLEARNOVERPERSONALMAX");
return;
};

if (oth.lp < kosten)
{
B_Say (slf, oth, "$NOLEARNNOPOINTS");
PutMsg("Za mało Punktów Nauki!",RGBA(180,0,0,255), 6);
return;
};

var int Need_Gold; Need_Gold = kosten * Gold_Multipler;
if(Npc_HasItems(oth,itmi_gold)< Need_Gold)
{
B_Say (slf, oth, "$SHITNOGOLD");
PutMsg("Nie masz wystarczającej ilości pieniędzy!",RGBA(180,0,0,255), 6);
return;
};


oth.lp = oth.lp - kosten;
B_GiveInvItems(oth,slf, itmi_gold, Need_Gold);
Npc_RemoveInvItems(slf,itmi_gold,Need_Gold);
Raise_Hitchance (oth, attrib, points);
return;
};

func string B_BuildHitchance(var int attrib, var int points, var int multipler)
{
var int kosten; kosten = (TeachHitchance_GetCost(hero,attrib) * points);
var string att;
if (attrib   == 1) { att = "Broń jednoręczna + "; }
else if (attrib == 2) { att = "Broń dwuręczna + "; }
else if (attrib == 3) { att = "Łuk + "; }
else if (attrib == 4) { att = "Kusza + "; };

var string msg; msg = ConcatStrings(att,IntToString(points));

        msg = ConcatStrings(msg,"%");
msg = ConcatStrings(msg," (Koszt: ");
msg = ConcatStrings(msg, IntToString(kosten));
msg = ConcatStrings(msg," Punktów Nauki, ");
msg = ConcatStrings(msg,IntToString(kosten* multipler));
msg = ConcatStrings(msg, Currency_Name);
msg = ConcatStrings(msg,")");

return msg;
};
Należy parsować to po Story\G_Functions\. Jeżeli użyjesz tego w swoim modzie, warto by było poinformować o tym w napisach końcowych.
Screen z okna programu. Nie wiem po co :F
Spoiler

 

P.S A Splash w szafie i nie ma psychy by mi dać bana.

paweu

paweu

Użytkownicy
posty64
Propsy4
Profesjabrak
  • Użytkownicy
Dobry specyfik :D
 

Siemekk

Siemekk

Złote Wrota
Untersturmfuhrer
posty2143
Propsy1151
ProfesjaProgramista
  • Złote Wrota
  • Untersturmfuhrer
Zmiana linku - teraz pobieramy nową wersję 1.1.
Co nowego?
- Zapisz do pliku zastąpiono przyciskiem "Kopiuj" oraz "Zaznacz", jest to wygodniejsze
- Dodano możliwość dodawania warunku za pomocą nowego pola (Warunek może być funkcją lub zmienną), w kodzie zapis wygląda tak:
return (Warunek_LubFunkcja > 0);
Jest to spowodowane tym, że jest to krótszy zapis :) Warunki można łączyć!
- Naprawiono poważny błąd z choiceboxami mianowicie choiceboxy odpowiedzialne za "Kuszę, Łuk, 2H" nie generowały kodu, kod dla całej czwórki generował tylko choicebox "1H".
To wszystko, w razie znalezienia błędu pisać tutaj postaram się go szybko naprawić :)
P.S Program nie ma ikonki, ponieważ nie chciało mi się znowu z nią kombinować :P
 

P.S A Splash w szafie i nie ma psychy by mi dać bana.

Siemekk

Siemekk

Złote Wrota
Untersturmfuhrer
posty2143
Propsy1151
ProfesjaProgramista
  • Złote Wrota
  • Untersturmfuhrer
Powstaje nowa wersja programu.  Będzie on teraz dostępny z poziomu przeglądarki. Więc nie będzie trzeba pobierać go na dysk. W późniejszych etapach sama strona przerodzi się w duże narzędzie pozwalające tworzyć:
NPC, Dialogi, Itemy i coś jeszcze (sam nie wiem co xD) Tak więc radzę czekać :)
 

P.S A Splash w szafie i nie ma psychy by mi dać bana.

Kefor97

Kefor97

Użytkownicy
posty38
ProfesjaGracz
  • Użytkownicy

Kefor97

Proste tworzenie nauczycieli
#4 2019-02-13, 19:47(Ostatnia zmiana: 2019-02-13, 20:29)
mam komunikat, nieznana funkcja BuildHitChance, to dlatego, że wrzuciłem tego skryptu? gdzie go wpisać?

Post połączony: 2019-02-13, 20:29
że nie wrzuciłem tego skryptu*?
 


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