Author Sticky: Post Working Scripts Here
ForgottenSoul Posted: Friday, 26 July 12:35PM
Quote: Posted 07/26/02 12:07:26 (GMT) by Luminous

I believe to accomplish this you have to 'destroy' the merchant each night and 'create' them each morning. I use a script someone wrote and posted earlier in this forum to create Watchmen at night and when dawn comes, they all head to their barracks, the barracks door opens and they disappear (destroyed) but when night falls, the door opens and they stumble to their posts.

You wouldn't want to waste processor time monitoring an NPC that the player isn't interacting with, far better to destroy the NPC and recreate it when needed.

Quote: Posted 07/26/02 06:47:06 (GMT) by Griffhawk

At the fear of sounding like a brokenrecord, i am still looking for a script to help me with my problem. I have had some awsome replys from some excellent scriters. However I think my messagfe on what I'm looking for is missed. I'f anyone can help me i would apperate it..Its getting frustrating.

Ok this is what i want to have happen.
Each night the people will leave the city streets to return home. That means going into a new area, that wont be visited by a PC. This also means that my outdoor shopkeeps will in effect close shop for the night.
Now i got them to go to houses once dusk is reached Np (with thanks to some clever scritors). Hoever they wont return from there homes to go to there posts, UNLESS a PC enters there house ( or area).
Now I now about "POST_tag", I enabled the default scribt to get people to reconize time ( day/ night). The proble arries in trying to get the NPC's to react without a PC triggering them.
Can anyone help me with this problem?..plaese. I have been searching for awhile and have come closer but it still wont work well enough to get the effect I'm looking for( dont want the merchants to go home lock there doors never to be seen again..not good)

Despertly waiting advice..."bowing"


If you destroy the NPC and recreate a new one in the morning, be sure to be careful were you store your local vars for if you store them on the NPC they will be gone. An Example:

I have a sub quest in my adventure to help a little child find her lost doll. Upon finding the doll, I set a local var on the NPC called "dollFound" to 1, so now any other NPC who comes up to here wont get the sad story of a missing doll, but will get the "Yippi. <character so and so> is the bravest of all for he/she found my doll!" (might be good for some jokes among the party. .... In our party we have "Stave - Slayer of Dragons, John - Killer of orcs. And Tim finder of lost dolls.":) )

Now if you destroy the child at night and recreate her in the morning, the local var will be gone.

Solutions?
1 - Only destory generic NPCs that don't store local vars. Handle the others seperately.
OR
2 - Have an object seperate from all the NPCs that you don't destroy. Set all your local vars on that. Then when the character is recreated it can check the inv object instead of itself.

Example from above the following functions would be needed:

NWScript:
void main()

{

    // Doll found. Set inv object with dollFound to true.

    object oInvVarObject = GetObjectByTag("varObject001");

    SetLocalInt(oInvVarObject,"dollFound",1);

}

int checkForDollFound()

{

    object oInvVarObject = GetObjectByTag("varObject001");

    if(GetLocalInt(oInvVarObject,"dollFound") == 1)

    {

    // Doll found

       return TRUE;

    }

    return FALSE; // doll not found

}



Just something to think about. (Any your probally already have  )

_________________
Forgotten Soul
“You stand on the shoulders of giants and claim you are tall.”

And finally 3 - an alternative

If for instance you have created a small area where your PC's cannot get to you could transite (new word?) them from a waypoint in front of their house to this area at night and transite them back again in the morning to a starting Waypoint with an instruction to resume WalkWaypoints.

Anyway - just a thought.