Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   putnpc/putnpc2 (https://forums.graalonline.com/forums/showthread.php?t=21257)

mikepg 01-16-2002 06:41 AM

putnpc/putnpc2
 
I know how to use these, but what player do the playerattributes pertain to? like, playerx, playermp, playerhearts, ect.

does it go to the player that is the 1st in the level, or the player that had the script that placed it?

LiquidIce00 01-16-2002 06:58 AM

depends if its clientsided/server sided
putnpc2 is only p2p
putnpc is both ..
and free scripts are always client sided

mikepg 01-16-2002 07:17 AM

hmm
 
okay, so, if it's clientside, it affects the player that placed it, if it's server side, it affects the 1st player in the level?

What about join? If you call an NPC using putnpc2, and use join, while in client side, will that not function, or will it work fine and effect the caller of the npc.

ex:
//#CLIENTSIDE
if (this.blah = 0) {
putnpc2 {join scriptname.txt};
}

or does join ONLY work if it's in a server side section?

grim_squeaker_x 01-17-2002 12:16 AM

Re: hmm
 
Quote:

Originally posted by mikepg
okay, so, if it's clientside, it affects the player that placed it, if it's server side, it affects the 1st player in the level?

What about join? If you call an NPC using putnpc2, and use join, while in client side, will that not function, or will it work fine and effect the caller of the npc.

ex:
//#CLIENTSIDE
if (this.blah = 0) {
putnpc2 {join scriptname.txt};
}

or does join ONLY work if it's in a server side section?

putnpc2 only works on the serverside. But you can do stuff like:
NPC Code:
if (actionserverside) {
putnpc2 playerx,playery,{join whatever;};
with (npcs[npcscount-1]) {
this.playerx=playerx;
this.playery=playery;
}
}
//#CLIENTSIDE
if (weaponfired) triggeraction x,y,serverside,WeaponName,;

The setting of the variables is performed before the created of the NPC put wih putnpc2.

Faheria_GP2 01-17-2002 06:47 AM

when

"playerx" and such is in an event, the default index is the player that triggered the event.

if it is in a timeout event, I think playerx would be the 1st player in the level, but I am not sure if this is the case.

for example

if (playertouchsme) playermp=100; //Player that touched
if (washit) playermp=100; //Player that hit
if (playerchats) {
putnpc2 blah blah blah {
if (created) playermp=100 //Player that caused the creation by chatting
}
}

BocoC 01-17-2002 12:18 PM

Ok. Clientside NPC's are activated and ran from the client's computer. Basically, the client recieves a "copy" of the NPC. In serverside, the NPC's are on the server; each client does not receive a copy. So, that way, all clients can access the NPC and use it "together".

mikepg 01-19-2002 07:23 AM

ok
 
thanx. Even though its a little more complicated idea than you guys think, these basic ideas helped a lot ;).

:)


All times are GMT +2. The time now is 12:36 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.