These wiki pages should help you a bit with your understanding of clientside/serverside:
http://wiki.graal.net/index.php/Clientside
http://wiki.graal.net/index.php/Serverside
http://www.graal.net/index.php/Creat...Starting_Guide
http://wiki.graal.net/index.php/Crea.../Script/Client (explains how to communicate between serverside and clientside)
Quote:
Originally Posted by Raelyn
This confuses the piss out of me, doesn't it just make more sense to reference the index directly than to try calling a variable pointing to the index?
|
What?
Quote:
Any specific reason? Functionally is bad? Or some "purist" idealism?
|
Not sure exactly, but Stefan said at several times not to, so that suggests to me that perhaps he checks what the script is in and decides how to parse it or something like that could be added later.
And yeah, GS1 just uglifies a beautiful script. GS2 is also considerably more efficient than GS1.
Quote:
So basically, it's not needed to join a class?
|
Haha yes, correct.
Quote:
I thought anything behind // isn't read by the system, so how does tagging //serverside produce a difference in the code?
|
It doesn't, the only time the parser reads anything that starts with "//" is when it is
//#CLIENTSIDE. The ones I placed after the join were just labels.
Quote:
Originally Posted by Raelyn
Ok, so join() works like putnpc, but it called from a class instead of a text file, and inserts all commands in the class in order below the join() command.. Gotcha..
|
You should always use putnpc2 now anyway; just put the code in a class rather than a text file.
Quote:
Originally Posted by Raelyn
Inserting //#CLIENTSIDE at the top seems to have removed the errors. Thanks. But now won't my player's stats be vulnerable to cheap string editng kiddies? :P
|
Only if you used 'client.' vars. You should always use clientr (or serverside player. vars) for storing sensitive information.
Quote:
Originally Posted by Raelyn
Ok, so I have inserted my baddy script into a class, if I wanted to place baddies on the map with the baddie class as their script, would I be able to do something like a weapon with a trigger and some sort of putnpc script referencing back to the class? How would I do that serverside? I want the baddie to be seen the same by all players... would putnpc work with a class?
|
If you want them to be dynamic (randomly placed), you should use a database NPC with something like the following
PHP Code:
function onCreated() {
// init vars
this.mapSize = {3, 3}; // width, height in levels
this.classesToDrop = {"baddy"};
onTimeOut();
}
function onTimeOut() {
temp.tries = 0;
while (tries < 5 ) {
temp.dpos = {random(0, this.mapSize[0] * 64), random(0, this.mapSize[1] * 64)};
if (! onwall2(dpos[0] - 3, dpos[1] - 3, 6, 6)) {
// should improve the above checks, it's just an example.
temp.classToJoin = this.classesToDrop[int(random(0, this.classesToDrop.size()))];
temp.drop = putnpc2(dpos[0], dpos[1], "");
drop.join(classToJoin);
}
tries ++;
}
setTimer(360); // could also add a way to check how many baddies there are.
}
Otherwise, if you want them in static locations, just make a level NPC (with level editor) with this:
PHP Code:
join("baddy"); // or the other class