Author Topic: Two questions  (Read 4036 times)

Legacy_Cursed Eclipse

  • Full Member
  • ***
  • Posts: 132
  • Karma: +0/-0
Two questions
« on: February 03, 2014, 11:43:33 am »


               nr.#1
  I've never seen use the event OnExhausted present in the encounter.


In the lexicon it says:
The script attached to this event fires when the last member of a party
of creatures spawned by an encounter dies, and can be used to open a
previously unopenable door or signal another event.


never seen a script like this, and I can not imagine how it could be done.
Could someone give me some examples?


nr.#2

  I tried to run my pw from my PC,i noticed  that when the server has no players in it ,there is an infinite increase of the usage of RAM.
How i can fix this?
               
               

               
            

Legacy_Squatting Monk

  • Hero Member
  • *****
  • Posts: 776
  • Karma: +0/-0
Two questions
« Reply #1 on: February 03, 2014, 02:04:43 pm »


               That event is pretty simple. If you wanted a door to open when all the monsters are dead, just put this script in:

void main()
{
    object oDoor = GetObjectByTag("MyDoor");
    SetLocked(oDoor, FALSE);
    AssignCommand(oDoor, ActionOpenDoor(oDoor));
}

               
               

               


                     Modifié par Squatting Monk, 03 février 2014 - 02:04 .
                     
                  


            

Legacy_MerricksDad

  • Hero Member
  • *****
  • Posts: 2105
  • Karma: +0/-0
Two questions
« Reply #2 on: February 03, 2014, 06:37:05 pm »


               

Cursed Eclipse wrote...

nr.#2

  I tried to run my pw from my PC,i noticed  that when the server has no players in it ,there is an infinite increase of the usage of RAM.
How i can fix this?


search your custom scripts for any loop that creates objects, including objects not actually seen in the game. Check also for any looping pattern that might accidentally be storing a local or pw variable incrementally instead of incrementing its value. without seeing any of your code, no clues beyond that.

If you are on win7, I know there are some programs that let you peek into what processes are resident inside your executable. Look for something like that online and it might show you a leaky 3d model, or a process tree that is expanding in size.
               
               

               
            

Legacy_Cursed Eclipse

  • Full Member
  • ***
  • Posts: 132
  • Karma: +0/-0
Two questions
« Reply #3 on: February 04, 2014, 11:00:07 am »


               @Thanks S.Monk
could you provide me an example with signal event?

MerricksDad wrote...

Cursed Eclipse wrote...

nr.#2

  I tried to run my pw from my PC,i noticed  that when the server has no players in it ,there is an infinite increase of the usage of RAM.
How i can fix this?


search your custom scripts for any loop that creates objects, including objects not actually seen in the game. Check also for any looping pattern that might accidentally be storing a local or pw variable incrementally instead of incrementing its value. without seeing any of your code, no clues beyond that.

If you are on win7, I know there are some programs that let you peek into what processes are resident inside your executable. Look for something like that online and it might show you a leaky 3d model, or a process tree that is expanding in size.

That bug has nothing to do with my script or the OS  where you're hosting the module.
  In fact, even with the other modules the problem persists.

After some research i found this
http://www.nwnx.org/...opic.php?t=1803

The plugin also fixes a bug in the server where
CPU and memory usage when the server has no players in it gradually
increases over time until a player logs in.


Now the question is:  how should I use it? ...it seems to me that it is not for nwn 1.




               
               

               


                     Modifié par Cursed Eclipse, 04 février 2014 - 11:09 .
                     
                  


            

Legacy_Squatting Monk

  • Hero Member
  • *****
  • Posts: 776
  • Karma: +0/-0
Two questions
« Reply #4 on: February 05, 2014, 01:27:48 am »


               

Cursed Eclipse wrote...

@Thanks S.Monk
could you provide me an example with signal event?

You'd use SignalEvent(), probably to call an OnUserDefined event. For example, you could create a userdefined event that tells that door to open:

// OnExhausted
void main()
{
    object oDoor = GetObjectByTag("my_door");
    SignalEvent(oDoor, EventUserDefined(20000));
}

// OnUserDefined for the door
void main()
{
    int nEvent = GetUserDefinedEventNumber();

    if (nEvent == 20000)
    {
        SetLocked(OBJECT_SELF, FALSE);
        ActionOpenDoor(OBJECT_SELF);
    }
}

This is a really bad example. There's much better uses for OnUserDefined, though I don't have the time to explain just now. I'll try to work up a better explanation and examples later tonight.
               
               

               


                     Modifié par Squatting Monk, 05 février 2014 - 01:28 .
                     
                  


            

Legacy_Cursed Eclipse

  • Full Member
  • ***
  • Posts: 132
  • Karma: +0/-0
Two questions
« Reply #5 on: February 05, 2014, 11:56:50 am »


               np Squatting Monk,is enough for me. Ty vm '<img'>