PDA

View Full Version : my door broke X.x


theHAWKER
10-01-2006, 12:46 AM
// NPC made by theHAWKER
if (created) {
blockagain;
}
if (compsdead) {
hide;
dontblock;
show;
}
its so simple but it wont work... anyone know how to fix this? ^.^

Luigi203
10-01-2006, 03:28 AM
Besides the fact that compsdead is a flag, and just putting if (compsdead) with no event will do nothing, but in the same instant that the npc hides, it just reappears again. Try using the sleep command, although it won't be the best thing to use later on.

xXziroXx
10-01-2006, 03:50 AM
Why is this in the GS2 forum? And if I recall correctly, its "compusdead".

Draenin
10-01-2006, 03:58 AM
Why is this in the GS2 forum?
It can be here now. :p

//#CLIENTSIDE

//This part will make the NPC automatically block for the character. You'll want this to be clientside, unless you're wanting the door to be opened for every person at once.
function onCreated(){
blockagain;
show;
}

//This will check to see if the player has killed all of the NPCs. However, I'd urge you to try something harder, like a key requirement or something similar.
function onCompusdead(){
dontblock;
hide;
}

Also, here's an example door that uses multiple keys to open:
//#CLIENTSIDE

//This function is used on the actual door itself. The door requires 7 keys to unlock. That's pretty ridiculous, but it's also hilarious.
function onCreated()
{
if(doorkeys==7)
{
dontblock;
hide;
}
else
{
block;
show;
}
}

//Call this function on every Key NPC you make that corresponds with this door. This should not be used in conjunction with the above code.

//#CLIENTSIDE

function onPlayertouchsme()
{
//Add whatever function you use to add stuff to your inventory / mudlib here.
doorkeys+=1;
destroy;
}

theHAWKER
10-03-2006, 01:38 AM
//#CLIENTSIDE

//This part will make the NPC automatically block for the character. You'll want this to be clientside, unless you're wanting the door to be opened for every person at once.
function onCreated(){
blockagain;
show;
}

//This will check to see if the player has killed all of the NPCs. However, I'd urge you to try something harder, like a key requirement or something similar.
function onCompusdead(){
dontblock;
hide;
}

i tryed this and i killed the grey soldier and the door just stayed there.... and i couldn't walk through it x.x:cry: :cry:

theHAWKER
10-03-2006, 01:45 AM
douse that mean it only works on a server? because im trying it on a surver!

xXziroXx
10-03-2006, 03:15 AM
Errr, sorry, I ment; it only works online. And if it doesnt work, I dunno.

Draenin
10-03-2006, 03:29 AM
I've not actually had the opportunity to test what I wrote yet, but there's not really anything wrong with that script. However, if you continue to have problems, try confining it to a single function with if and else statements. And like Ziro said, it needs to be changed from //#CLIENTSIDE to //#SERVERSIDE.

xXziroXx
10-03-2006, 03:43 AM
I've not actually had the opportunity to test what I wrote yet, but there's not really anything wrong with that script. However, if you continue to have problems, try confining it to a single function with if and else statements. And like Ziro said, it needs to be changed from //#CLIENTSIDE to //#SERVERSIDE.


Rofl, theres no such thing as //#SERVERSIDE.

Draenin
10-03-2006, 03:52 AM
Yeah, but he doesn't know that. :D

theHAWKER
10-03-2006, 05:29 PM
am i sapost to be killing the npc people? because im killing the baddys...

and i tryed surverside but i din't work x.x

Luigi203
10-03-2006, 05:51 PM
Rofl, theres no such thing as //#SERVERSIDE.

Of course there is. //#SERVERSIDE will be read as a comment, and will have the same effect as not using a //#CLIENTSIDE directive.

xXziroXx
10-03-2006, 06:40 PM
Of course there is. //#SERVERSIDE will be read as a comment, and will have the same effect as not using a //#CLIENTSIDE directive.

Yes, but it has no special function, its just a comment. Wich means, there is no such thing.

contiga
10-04-2006, 12:07 AM
Eww noobs.. there's no wait between hide; dontblock; and show;.. use sleep 3; before show; again.

The Evil Within
10-04-2006, 01:45 PM
If you're trying it on a server with GS2 enabled.


//#CLIENTSIDE
function onCreated() {
show();
}

function onCompusDead() {
hide();
sleep(2);
show();
}


The graphic should automatically block which means the blockagain command really isn't needed so long as there is never a dontblock command (which also isn't needed due to the fact that once an image is hidden it shouldn't block you). HOWEVER due to the fact that some players like to delete images to bypass the the doors and get straight to the link you may want to set the shape of the image and insert the dontblock and blockagain commands.


Just incase you're working on a server that for some odd reason is scripting in GS1 instead of GS2 (All new servers should be scripting in GS2, it is much more efficient and there are tons of new features so if you are scripting in GS1 then I suggest you talk to the manager of your server and have him start converting the scripts you guys have already done into GS2) then here:


if (created) {
show;
}

if (compusdead) {
hide;
sleep 2;
show;
}