Aller au contenu

Photo

Two questions


  • Veuillez vous connecter pour répondre
5 réponses à ce sujet

#1
Cursed Eclipse

Cursed Eclipse
  • Members
  • 70 messages
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?

#2
Squatting Monk

Squatting Monk
  • Members
  • 446 messages
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 .


#3
MerricksDad

MerricksDad
  • Members
  • 1 620 messages

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.

#4
Cursed Eclipse

Cursed Eclipse
  • Members
  • 70 messages
@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 .


#5
Squatting Monk

Squatting Monk
  • Members
  • 446 messages

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 .


#6
Cursed Eclipse

Cursed Eclipse
  • Members
  • 70 messages
np Squatting Monk,is enough for me. Ty vm :)