[G2nk] Jak zrobić tarczę 18081 34

O temacie

Autor inż. Avallach

Zaczęty 7.02.2011 roku

Wyświetleń 18081

Odpowiedzi 34

inż. Avallach

inż. Avallach

Administrator
posty7661
Propsy5239
NagrodyV
ProfesjaProgramista
  • Administrator
Hi, using english is not a problem.

The part about using aivars was advice on how to allow players equip both crossbow and shield (more advanced version). Alone, idea of creating a crossbow that looks and is used like a shield is quite simple.

Your problem is probably caused by overlay mds not being restored after loading the saved game. To confirm that, please run command "apply overlaymds humans_shield.mds" when shield is not working and let me know if it helps.

BTW, we are not the only ones still playing and modding this old game :D There is quite big community at worldofgothic.de. One of its members, Lehona, created a better system of shields for G2NotR - however much more complicated. He sometimes visits our forum too and has much better knowledge of the engine than us.

Ktokolwiek z was kojarzy problemy z overlay mds nie przywracającym się przy wczytywaniu gry?

Vic7im

Vic7im

Użytkownicy
posty84
Propsy92
Profesjabrak
  • Użytkownicy
Yes that's exactly my problem, the overlay isn't restored after loading the saved game, but only on NPC's. If I unequip then re-equip a shield, everything works out just fine, the problem is that NPCS don't.

If you want, I can send you my scripts or post them here, so that we can work out a solution together. Let me know!

ps I've already pm'd Lehona XD
 

bgb

bgb

Użytkownicy
posty848
Propsy593
Profesjabrak
  • Użytkownicy
Tutaj Zucklov miał podobny problem tyle, że funkcja była wywoływana w dialogu (i nie dotyczyła npc-ow, tylko postaci gracza):
http://themodders.org/index.php?topic=17193.0

Tam generalnie stanęło na tym, że rozwiązaniem będzie Tick tock, tylko niestety to raczej odpada w przypadku wielu npc-ów.
Poza tym jest jeszcze coś. W L'hiverze na 99% procent nie ma tick tocka, a zmiana mdsu  stylu chodzenia także odbywa się przez dialog i o dziwo po wczytaniu zapisu dalej działa nowo ustawiony mds. Niestety nie byłem w stanie znaleźć przyczyny takiego stanu rzeczy. Nie wiem też czy nawet gdyby udało się to rozgryźć miało by to zastosowanie wprzyadku npc i funkcji OnEquip na itemie.

inż. Avallach

inż. Avallach

Administrator
posty7661
Propsy5239
NagrodyV
ProfesjaProgramista
  • Administrator
This is a problem.

If you had a constant list of npcs wearing shields, you could use a function called by engine after the world is loaded (even from saved game) - it was Init_Global or Startup_Global, I don't remember which one.

I understand that in your mod shield can be used by ANY npc, so such function wouldn't help anyway (because there is no way to iterate on all NPCs (nor iterate on anything other (in fact, make any normal loop)). Instead, you need to use callback that is ran on every npc, for time of its execution storing that npc in global variable "self".
Such simple solution would be to use function called at PERC_ASSESSPLAYER. Assuming that npc's are starting fights mainly after they see a player, its sufficient to check from it if "self" wears a shield, and if yes, apply overlay mds on him (it's quite easy, I can help with it).

The only drawback would be that if npc starts a fight AFTER savegame is loaded, but BEFORE he has any chance to see a player, he wouldn't use a shield. But such condition should be very, very rare. And it can be fixed with use of other PERCs (but I'm not sure if it's worth it).

Have you heard about npc perceptions and know how to use them?

Sawik

Sawik

Moderator działu
Rebel
posty4772
Propsy3197
ProfesjaNierób
  • Moderator działu
  • Rebel
Avallach, nie prościej przerobić WLD_INSERTNPC? Wtedy wrzucając npc'ta ma podany jego instance, dzięki czemu może sprawdzić AIVar'a. 
 
Życzę wam seksu analnego po stronie biernej.
Dropbox +500 mb na start
LowPoly
Wykonanie modelu niskopoligonowego to sztuka kompromisu. Nie jest to jedynie uproszczenie modelu wysokopoligonowego, ale głęboka modyfikacja oraz podejmowanie decyzji często zmieniających wygląd pierwotny obiektu, tak by przy najmniejszej ilości trójkątów uzyskać jak najwierniej odwzorowany kształt oryginału. Nie można też zapomnieć o tym iż musi nadal wyglądać przekonywająco i tak balansować by uzyskać efekt optymalny.

Podstawowym założeniem jest, że model nie powinien mieć zbędnych, niewidocznych dla gracza detali włączonych w geometrie. Większość obiektów jakie znajdują się w grze powinna prezentować się najlepiej z odległości około 3-5 metrów. Wszelkie detale, które zanikają, wydają się płaskie lub zlewają się z bryłą modelu należy uznać za zbędne i pozostawić je na normal mapie.

Fakt, iż gracz będzie w stanie podejść bliżej do obiektu i zobaczyć go z mniejszej niż 3m odległości nie powinno stanowić większego problemu, gdyż większą rolę odgrywają wtedy tekstury oraz dodatkowy detal zależny od materiału obiektu. To właśnie kompromis między wydajnością, a szczegółowością otoczenia.

Detal, którego nie widać z 3-5 metrów nie powinnien istnieć w geometrii modelu.
Krawędzie znajdujące się blisko siebie, które zlewają się z większej odległości należy uprościć do wspólnej płaszczyzny

inż. Avallach

inż. Avallach

Administrator
posty7661
Propsy5239
NagrodyV
ProfesjaProgramista
  • Administrator
Co to ma do rzeczy? xD
Po co chcesz przerabiać wld_insertnpc? Jak chcesz to przerabiać? Po co ci instance wrzucanych npc? Po co spawdzać jakieś aivary? 

To jest bardzo prosty skrypt itemu z prostą funkcją on_equip. Nie ma tu żadnej "magii" w formie Ikarusa czy innych hacków. Wykorzystanie perc_assessplayer to prosty fix na nie odświeżający się po wczytaniu gry overlay mds.

Vic7im

Vic7im

Użytkownicy
posty84
Propsy92
Profesjabrak
  • Użytkownicy
This is a problem.

If you had a constant list of npcs wearing shields, you could use a function called by engine after the world is loaded (even from saved game) - it was Init_Global or Startup_Global, I don't remember which one.

I understand that in your mod shield can be used by ANY npc, so such function wouldn't help anyway (because there is no way to iterate on all NPCs (nor iterate on anything other (in fact, make any normal loop)). Instead, you need to use callback that is ran on every npc, for time of its execution storing that npc in global variable "self".
Such simple solution would be to use function called at PERC_ASSESSPLAYER. Assuming that npc's are starting fights mainly after they see a player, its sufficient to check from it if "self" wears a shield, and if yes, apply overlay mds on him (it's quite easy, I can help with it).

The only drawback would be that if npc starts a fight AFTER savegame is loaded, but BEFORE he has any chance to see a player, he wouldn't use a shield. But such condition should be very, very rare. And it can be fixed with use of other PERCs (but I'm not sure if it's worth it).

Have you heard about npc perceptions and know how to use them?

I've tried messing up with perceptions, but to no avail.
 

inż. Avallach

inż. Avallach

Administrator
posty7661
Propsy5239
NagrodyV
ProfesjaProgramista
  • Administrator
First of all, you have to find out which function is called when given perception is activated. You can do it by searching for calls of Npc_PercEnable or (even better) ocurrences of identifier of that perception (e.g. PERC_ASSESSPLAYER). When you already are inside that function, add there Mdl_ApplyOverlayMDS(self, "humans_shield.mds"); and maybe some print, like print(ConcatStrings("mds applied for: ", self.name));. Reparse scripts and check if there is any effect (working shields and appearing message). If it works, remove print and add appropriate conditional block (there are few possible solutions).

Vic7im

Vic7im

Użytkownicy
posty84
Propsy92
Profesjabrak
  • Użytkownicy
First of all, you have to find out which function is called when given perception is activated. You can do it by searching for calls of Npc_PercEnable or (even better) ocurrences of identifier of that perception (e.g. PERC_ASSESSPLAYER). When you already are inside that function, add there Mdl_ApplyOverlayMDS(self, "humans_shield.mds"); and maybe some print, like print(ConcatStrings("mds applied for: ", self.name));. Reparse scripts and check if there is any effect (working shields and appearing message). If it works, remove print and add appropriate conditional block (there are few possible solutions).
Nope, doesn't work.

if((self.id != 0) && (Npc_HasItems(self,ItAr_Paladinshield)))
{
Mdl_ApplyOverlayMds(self,"HUM_SHIELD2.mds");
};

put into B_AssessPlayer and in the startup.d (game_init())
 

inż. Avallach

inż. Avallach

Administrator
posty7661
Propsy5239
NagrodyV
ProfesjaProgramista
  • Administrator
Try this:
func void refreshShield()
{
   if((self.id != 0) && (Npc_HasItems(self,ItAr_Paladinshield)))
   {
      Mdl_RemoveOverlayMds(self,"HUM_SHIELD2.mds");           
      Mdl_ApplyOverlayMds(self,"HUM_SHIELD2.mds");
      print(ConcatStrings("mds applied for: ", self.name));
   };
};

Put refreshShield() in B_AssessPlayer and in prototype of all npcs, NPC_DEFAULT. Remember to reparse scripts and start new game. Make sure that the message appears when you are coming close to any npc.
If works, you can remove the call from either B_AssessPlayer or NPC_DEFAULT (depending from which one it worked).

Vic7im

Vic7im

Użytkownicy
posty84
Propsy92
Profesjabrak
  • Użytkownicy

Vic7im

[G2nk] Jak zrobić tarczę
#30 2014-12-12, 10:25(Ostatnia zmiana: 2014-12-12, 10:48)
Try this:
func void refreshShield()
{
   if((self.id != 0) && (Npc_HasItems(self,ItAr_Paladinshield)))
   {
      Mdl_RemoveOverlayMds(self,"HUM_SHIELD2.mds");           
      Mdl_ApplyOverlayMds(self,"HUM_SHIELD2.mds");
      print(ConcatStrings("mds applied for: ", self.name));
   };
};

Put refreshShield() in B_AssessPlayer and in prototype of all npcs, NPC_DEFAULT. Remember to reparse scripts and start new game. Make sure that the message appears when you are coming close to any npc.
If works, you can remove the call from either B_AssessPlayer or NPC_DEFAULT (depending from which one it worked).

It worked, cheers man. Thanks, a lot!

Edit: That wasn't enough: THANKS THANKS THANKS THANKS THANK YOUUUU!!!!!
 

inż. Avallach

inż. Avallach

Administrator
posty7661
Propsy5239
NagrodyV
ProfesjaProgramista
  • Administrator
But which one?
If I had to guess, it was a bug in Mdl_ApplyOverlayMds - which is only partially restored after save, and has to be removed and re-applied. But it would be nice to know that for sure for sake of future generations :D

Vic7im

Vic7im

Użytkownicy
posty84
Propsy92
Profesjabrak
  • Użytkownicy
But which one?
If I had to guess, it was a bug in Mdl_ApplyOverlayMds - which is only partially restored after save, and has to be removed and re-applied. But it would be nice to know that for sure for sake of future generations :D

unfortunately, only the PERC_Assessplayer one works, the other doesn't.
To be sure, I kept both because the NPC_Default call was not doing anything to anyone xD

The only minor bug is that paladins doing their TA_PracticeSword animation will alternate standing still and starting to exercise everytime they see the player, but that's not a problem :D
 

Sawik

Sawik

Moderator działu
Rebel
posty4772
Propsy3197
ProfesjaNierób
  • Moderator działu
  • Rebel
Co to ma do rzeczy? xD
Po co chcesz przerabiać wld_insertnpc? Jak chcesz to przerabiać? Po co ci instance wrzucanych npc? Po co spawdzać jakieś aivary?
Być może przekombinowałem.
Jednak pisząc WLD_InsertNpc2 możesz tak samo wywołać funkcję refreshShield którą napisałeś.
 
Życzę wam seksu analnego po stronie biernej.
Dropbox +500 mb na start
LowPoly
Wykonanie modelu niskopoligonowego to sztuka kompromisu. Nie jest to jedynie uproszczenie modelu wysokopoligonowego, ale głęboka modyfikacja oraz podejmowanie decyzji często zmieniających wygląd pierwotny obiektu, tak by przy najmniejszej ilości trójkątów uzyskać jak najwierniej odwzorowany kształt oryginału. Nie można też zapomnieć o tym iż musi nadal wyglądać przekonywająco i tak balansować by uzyskać efekt optymalny.

Podstawowym założeniem jest, że model nie powinien mieć zbędnych, niewidocznych dla gracza detali włączonych w geometrie. Większość obiektów jakie znajdują się w grze powinna prezentować się najlepiej z odległości około 3-5 metrów. Wszelkie detale, które zanikają, wydają się płaskie lub zlewają się z bryłą modelu należy uznać za zbędne i pozostawić je na normal mapie.

Fakt, iż gracz będzie w stanie podejść bliżej do obiektu i zobaczyć go z mniejszej niż 3m odległości nie powinno stanowić większego problemu, gdyż większą rolę odgrywają wtedy tekstury oraz dodatkowy detal zależny od materiału obiektu. To właśnie kompromis między wydajnością, a szczegółowością otoczenia.

Detal, którego nie widać z 3-5 metrów nie powinnien istnieć w geometrii modelu.
Krawędzie znajdujące się blisko siebie, które zlewają się z większej odległości należy uprościć do wspólnej płaszczyzny

inż. Avallach

inż. Avallach

Administrator
posty7661
Propsy5239
NagrodyV
ProfesjaProgramista
  • Administrator
Ale to nie ma żadnego związku z problemem. Polega on na tym że przy wczytywaniu gry overlay nie jest w pełni poprawnie nałożony (jest nałożony "teoretycznie"). Nie ma to związku z tworzeniem npc.


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