• Уважаемые гости и новички, приветствуем Вас на нашем форуме
    Здесь вы можете найти ответы практически на все свои вопросы о серии игр «Готика» (в том числе различных модах на нее), «Ведьмак», «Ризен», «Древние свитки», «Эра дракона» и о многих других играх. Можете также узнать свежие новости о разработке новых проектов, восхититься творчеством наших форумчан, либо самим показать, что вы умеете. Ну и наконец, можете обсудить общие увлечения или просто весело пообщаться с посетителями «Таверны».

    Чтобы получить возможность писать на форуме, оставьте сообщение в этой теме.
    Удачи!

Готика 2: НВ Gothic weird behaviour

Aeternitas

Участник форума
Регистрация
1 Июл 2010
Сообщения
125
Благодарности
174
Баллы
185
Hi,

I have a big problem. I would like to create Endurance into my modification. In fact, I already did and it functions good and without problems if you don't save-load the game. Then come problems. First I describe the problem.

I start the game and play and the endurance (let say maximum is 100) falls slowly. I save the game (endurance be for example 75). Then I play on. After a while I stop playing (endurance is now 50) and load the saved position. Looking on the endurance I realized it has weird values. It should have the value from time of saving (75) but it has the still new value (50). Ok, I try again and load it again. The value is then 45. Load again. 43 ... etc. After some time, the loading of the position saved at endurance 75 still gives to endurance value 0. If I restart the game (leave it and then start again) and load the save position at endurance 75, it gives the right value 75.

Now I describe, how I create it. First I create the variables.
Код:
var int enduranceh_max;
var int enduranceh;

Help function:
Код:
func void EndurancehInc(var int x)
{
  enduranceh = enduranceh + x;
 
  if (enduranceh < 0)
  { enduranceh = 0; }
  else if (enduranceh > enduranceh_max)
  { enduranceh = enduranceh_max; };
};

Definition of the endurance function:
Код:
func void BeHungryStart()
{
  var int tmp;
 
  tmp = hunger_index - (setNiveau*6000);
 
  if (be_hungry_alive==1)
  {
    tmp = tmp / 2;
  };
 
  if (tmp < 1000)
  { tmp = 1000; };
 
  FF_ApplyOnceExt(BeHungryLoop,tmp,-1);
};
 
func void BeHungryLoop()
{
  if (enduranceh > 0)
  {
    EndurancehInc(-1);
  }
  else
  {
    EndurancehInc(-1);
 
    var int tmp;
 
    tmp = hero.attribute[ATR_HITPOINTS_MAX] / 40;
 
    if (tmp<1) { tmp=1; };
 
    tmp=hero.attribute[ATR_HITPOINTS]-tmp;
 
    if (tmp<1)
    {
      if (be_hungry_alive==1)
      {
        tmp=1;
      }
      else
      {
        tmp=0;
      };
    };
 
    hero.attribute[ATR_HITPOINTS] = tmp;
  };
};

In Init_Global function:
Код:
BeHungryStart();

Of course, Ikarus and LeGo is initialized.

I have one more question. I realized the Init_Global function is not called any time by loading the world. I tried this. I started new game (Init_Global is called), then saved it. Then load the saved position (Init_Global is called). Then start new game (Init_Global is NOT called). By the last start is Init_Global not called. It should be but it's not. Why?

Can you help me with it? Thanx in advance.
 

НастасьСанна

Участник форума
Регистрация
6 Дек 2012
Сообщения
350
Благодарности
521
Баллы
325
Testing your script I've found two problems, both in FrameFunctions. The first is that cycle continues working while the game is paused (in menu, while saving etc.). The second is that after loading saves it continues previous cycle instead of creating new. You can see in zSpy, what I mean, adding in the end of BeHungryLoop:
MEM_Debug(ConcatStrings("Endurance = ", IntToString(enduranceh)));

The decision for the second problem is given here: http://forum.worldofplayers.de/foru...plyOnceExt?p=20534753&viewfull=1#post20534753. And I think it is included in new LeGo2.3.0a.

As for the first I don't know any proper decision right now. Maybe it is simpler to use traditional trigger-cycle.

About init_global, yes, I've noticed it too. You should duplicate all initialization in startup_global or instead write it in init_... for every ZEN (as I can remember, they work always).
 
Сверху Снизу