Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Server (https://forums.graalonline.com/forums/forumdisplay.php?f=14)
-   -   Simple "Block and Button" puzzle. (https://forums.graalonline.com/forums/showthread.php?t=4186)

freddyfox 06-06-2001 09:08 PM

Simple "Block and Button" puzzle.
 
For the block,
NPC Code:

if(playerenters){
canbepushed;
}
if(x=buttonx&&y=buttony){
//make sure to replace buttonx/y with the x and y the button is on
set puzzlecomplete;
x = startingx;
y = startingy;
//make sure startingx/y are the co-ordinates that the block
//started on
}



For the door, wall, etc.
NPC Code:

if(playertouchsme&&puzzlecomplete){
hidelocal;
dontblocklocal;
}



A simple block puzzle!

Thak2 06-07-2001 03:50 AM

Will that code work without a timeout?

Cloud_X 06-07-2001 04:23 AM

Quote:

Originally posted by Kaimetsu


Only if "playerpushesme" or whatever works on the NPC Server. But can we even push stuff on the NPC Server?

I believe, Try out the table in the admin house.

06-07-2001 04:57 AM

o.O

TB3 06-07-2001 05:01 AM

ummmmm
 
Im pretty sure that that was scripted considering it has washit in it too but i doubt they would put it there if it was part of system lol.
By system i mean the canbepushed/pulled.

Admins 06-10-2001 11:59 PM

No pulling/pushing is not automatic on the
npcserver. There is
if (actionpulled)
and
if (actionpushed)
and the npc then must move itself and the player.
The script of the table:

NPC Code:

if (created) {
noplayeronwall;
setshape 1,6*16,11*16;
}
if (actionpulled || actionpushed || washit) {
if (washit)
i = playerdir;
else
i = strtofloat(#p(0));
newx = x + vecx(i)*0.5;
newy = y + vecy(i)*0.5;

if (!onwall2(newx,newy,6,11)) {
x = newx;
y = newy;
if (actionpulled) {
playerx += vecx(i)*0.5;
playery += vecy(i)*0.5;
}
}
}



It's not perfect, the player can pull himself into
a wall. But it is working perfectly on npcserver
and you can do your own special effects
like you can do a bowling ball which must be pushed
and then automatically moves


All times are GMT +2. The time now is 01:28 AM.

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