Problem ze skrzynią 4171 9

O temacie

Autor chicken

Zaczęty 8.09.2013 roku

Wyświetleń 4171

Odpowiedzi 9

chicken

chicken

RaveN Studio
posty1230
Propsy559
ProfesjaNierób
  • RaveN Studio
Moglby mi ktos pomoc bo mam taki problem, ze znalazlem skrypt ktory polega na tym, ze gdy skrzynka jest pusta to skrzynkia zmiena nazwe na pusta skrzynia tak jak w gothic 3 ale gdy naceluje na skrzynie to wyskakuje dostack (wywoluje w tick tocku) wiec w czym problem?
Tutaj rowniez nasuwa mi się pytanie czy ten skrypt powinien byc wywolywany z tick tocka czy z init swiata w startupie? Oczywiscie nie hookuje tego skryptu.

Adanos

Adanos

Administrator
Szara eminencja
posty5204
Propsy3870
ProfesjaProgramista
  • Administrator
  • Szara eminencja
Pewnie przepełniasz stos. Jak wygląda ta funkcja i jak często jest wywoływana?

chicken

chicken

RaveN Studio
posty1230
Propsy559
ProfesjaNierób
  • RaveN Studio

chicken
RaveN Studio

Problem ze skrzynią
#2 2013-09-08, 19:44(Ostatnia zmiana: 2013-09-09, 18:52)
Funkcja wyglada tak(jesli masz na mysli skrypty):
Cytuj
func void ChestRename() {
  var oCMob Mob;
  var oCMobContainer Skrzynia;
  var oCNpc her; her = Hlp_GetNpc(pc_hero);
  var string newName; newName = "Pusta Skrzynia";
  var int NameSymbIndex;
  var string OldName; OldName = "Skrzynia";
  if(her.focus_vob)
  {
 if(MEM_ReadInt(her.focus_vob)==oCMobContainer_vtbl)
 {
MEM_AssignContentInst (Mob,her.focus_vob);
MEM_AssignContentInst (Skrzynia,her.focus_vob);
if (MEM_ReadInt(MEM_InstToPtr(Skrzynia)+604) == 0)
{
  MEM_ReinitParser();
  NameSymbIndex = MEM_FindParserSymbol("CHESTRENAME.NEWNAME"); // NAME OF THE VARIABLE!
  Mob.focusNameIndex = NameSymbIndex;
 } else {
  MEM_ReinitParser();
  NameSymbIndex = MEM_FindParserSymbol("CHESTRENAME.OLDNAME"); // NAME OF THE VARIABLE!
  Mob.focusNameIndex = NameSymbIndex;
 };
 };
  };
};

A tick tock jest na 0.009 ale spacer zmienia na 0.00899999961
Dawalem tez na 0.125 i tez to samo
Do gothic.src dodalem _INTERN\ChestRename.D
A tick_tock tak wyglada:
Cytuj
func void tick_tock()
{
ChestRename();
};
W startupie w init_world dodalem zeby aktywowal triggera

Lehona

Lehona

Użytkownicy
posty196
Propsy190
  • Użytkownicy
What is the exact error-message? Do you still get the error message when you don't start the trigger in the startup? Does the script work if it's only called once (e.g. in a dialog for a set chest)? What exactly is ptr+604, are you checking oCMobContainer.containList_next?
 
Unless specified otherwise, my posts are always about Gothic 2 Night of the Raven.

chicken

chicken

RaveN Studio
posty1230
Propsy559
ProfesjaNierób
  • RaveN Studio

chicken
RaveN Studio

Problem ze skrzynią
#4 2013-09-09, 14:42(Ostatnia zmiana: 2013-09-09, 18:11)
Here is new script
Cytuj
func void ChestRename()
{
        var oCMob Mob;
        var oCMobContainer Skrzynia;
        var oCNpc her; her = Hlp_GetNpc(pc_hero);
      var int NameSymbIndex;
      var string newName;
      var string OldName;
        if(her.focus_vob)
        {
    MEM_AssignContentInst (Mob,her.focus_vob);
    MEM_AssignContentInst (Skrzynia,her.focus_vob);

if (Skrzynia.containList_next == 0)
{
MEM_ReinitParser();
newName = "Pusta Skrzynia";
NameSymbIndex = MEM_FindParserSymbol("NEWNAME");
Mob.focusNameIndex = NameSymbIndex;
}
else
{
MEM_ReinitParser();
OldName = "Skrzynia";
NameSymbIndex = MEM_FindParserSymbol("OLDNAME");
Mob.focusNameIndex = NameSymbIndex;
};
};
};
Without these functions(red color) i never get dostack! but without these functions chest never change name.

Lol my retarded english

Lehona

Lehona

Użytkownicy
posty196
Propsy190
  • Użytkownicy
Don't worry about your English.

You need to use "CHESTRENAME.NEWNAME" (as you did in your old script) because you're accessing local variables (ie variables created within a function). But even an invalid parameter should not trigger a DoStack-Error. I might test this for you during this week if I can bother myself to start up the Spacer and create a chest in my world...
 
Unless specified otherwise, my posts are always about Gothic 2 Night of the Raven.

chicken

chicken

RaveN Studio
posty1230
Propsy559
ProfesjaNierób
  • RaveN Studio
tick tick 0.125 is enough or it should be 0.009?(for scripts in my posts)
Pisze po angielsku zeby lehona tez zrozumial/zrozumiala. Mysle, ze kazdy bedzie wiedzial o co chodzi.

Lehona

Lehona

Użytkownicy
posty196
Propsy190
  • Użytkownicy
0.125 seconds might be a noticeable delay, you probably want to test that. The best way would probably be to use a frame trigger (you can either use LeGo for an easy interface for FrameFunctions or use an Ikarus script to speed your trigger up so it fires every single frame) or hack the engine code completely. The latter will probably be impossible for you (it requires a lot (!) of knowledge), but the first option requires only LeGo (if you use it anyway) or you add the following code into your trigger:
func void meineSchleifenFunktion() {
 // Wld_SendTrigger ("MEIN_SCHLEIFEN_TRIGGER"); // You don't need this because your trigger keeps itself running
 
/* Your code comes here - whatever it is that should be executed every frame */
 var oCTriggerScript Mein_Schleifen_Trigger;
 Mein_Schleifen_Trigger = MEM_PtrToInst (MEM_SearchVobByName ("MEIN_SCHLEIFEN_TRIGGER"));
 Mein_Schleifen_Trigger._zCVob_nextOnTimer = MEM_Timer.totalTimeFloat;
};
MEIN_SCHLEIFEN_TRIGGER is the name of your trigger in the Spacer.
This will create a trigger that is called every single frame, ie there is no way a player can notice the delay. 
That being said, 0.009s will probably be small enough. This is only "more elegant" :)

 
Unless specified otherwise, my posts are always about Gothic 2 Night of the Raven.

chicken

chicken

RaveN Studio
posty1230
Propsy559
ProfesjaNierób
  • RaveN Studio

chicken
RaveN Studio

Problem ze skrzynią
#8 2013-09-12, 15:12(Ostatnia zmiana: 2013-09-12, 16:42)
Can you help me with creating new bar in g1? if yes (i dont want readied scripts because i like challenges!)
Edit: Lehona now its working! Thank you, you're rly helpful! but when I get out of the game im getting mem_bad_pointer but i think that it isnt important error... can i ignore it?

Lehona

Lehona

Użytkownicy
posty196
Propsy190
  • Użytkownicy
I'm pretty sure you can ignore the MEM_BAD_POINTER. It still appears in Gothic 2 (at least to my knowledge), PB just removed the actual pop up :p
Creating a new bar is... Well. LeGo doesn't work with Gothic 1 and without LeGo it's tough to render textures on the screen. I have, however, helped someone to make very old LeGo-Scripts usable with Gothic 1, including the Views-Package (which is responsible for textures). I don't have it myself but I'll drop him a message and see if I can get them. I'm not sure how hard it will to include them in your system, it's just an ugly hack so they work with G1. 

I'll try to give a brief documentation in case I find them.
 
Unless specified otherwise, my posts are always about Gothic 2 Night of the Raven.


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