Graal Forums

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

monkeymon 06-10-2002 12:42 PM

Bridge
 
Is it possible to script a bridge client side? One where a player can go under, at the same time another player is walking over it? (The way a real bridge works):confused:

user13-xo 06-10-2002 01:02 PM

Re: Bridge
 
Quote:

Originally posted by monkeymon
Is it possible to script a bridge client side? One where a player can go under, at the same time another player is walking over it? (The way a real bridge works):confused:
Its possible. I done it on Babylon.

screen_name 06-10-2002 06:20 PM

yeah thats totally possible =D

kevy 06-10-2002 06:59 PM

confusing but yet yes

Loriel 06-10-2002 07:18 PM

attachplayertoobj is used there, no? Or is it serverside?

Warcaptain 06-10-2002 08:18 PM

clientside
NPC Code:

//#CLIENTSIDE
if (playerenters){
this.sw=imgwidth(#f)/16;
this.sh=imgheight(#f)/16;
}

if (playerenters||timeout){
if (playerx in {x,x+this.sw-2}&&playery in {y,y+this.sw-2}){
attachplayertoobj 0,id;
drawunderplayer;
}elseif (playerattached){
playerx+=vecx(playerdir)*.5;
playery+=vecy(playerdir)*.5;
detachplayer;
drawoverplayer;
}
timeout=.05;
}


may not work, because im typing it on my laptop at school lol
im 95% sure #f is the npcs image hehe but ive not used it alot so i dont know lol

i hope it works, let me know okay?
remeber to set the image or it wont work lol

azuretek23 06-10-2002 11:19 PM

you mind explainin how it works?

Warcaptain 06-11-2002 12:28 AM

NPC Code:

//Easy Bridge By Warcaptain
//#CLIENTSIDE
if (playerenters){
dontblock;
this.sw=int(imgwidth(#f)/16); //converts the width to tile
this.sh=int(imgheight(#f)/16); //converts the heightto tile
}

if (playerenters||timeout){
//checks if player is in range to be on the bridge
if (playerx in |x,x+this.sw-2.75|&&playery in |y-2,y+this.sw-2|){
attachplayertoobj 0,id;
drawunderplayer;
}elseif (playerattached){
playerx+=vecx(playerdir)*.5; //makes sure player gets off
playery+=vecy(playerdir)*.5; //makes sure player gets off
detachplayer;
drawoverplayer;
}
timeout=.05;
}


there, easy bridge by warcaptain :-)
all you need to do, is add setshape2 blah

and this isnt really a bridge, you can work the special walk under script from here
its more a walk on script

Projectshifter 06-11-2002 01:08 AM

LOL. Shouldn't this be an NPC Server question? I'd say make 3 images. One of both of the sides, and one of the middle. For the sides:
NPC Code:

//#CLIENTSIDE
if (playertouchsme)
timeout=0.1;
if (timeout)
{ set underbridge;
sleep 0.11;
unset underbridge;}



for the bridge itself:
NPC Code:

//#CLIENTSIDE
if (playertouchsme&&underbridge)
{ drawoverplayer;
dontblock;}
if (playertouchsme&&!underbridge)
{ drawoverplayer;
dontblock;}



Seems slightly simpler and not as much of a hassle, but your call, he he.
---Shifter

Falcor 06-11-2002 02:18 AM

You don't need an NPCs server =_=
Any I REALLY wish you guys wouldn't post entire scripts!!
I hope kaimetsu deletes your posts or atleast edits out the scripts. =-=

Also shifter, I have no clue what passed your mind, Bridges are done with attachplayertoobj and setshape2. Although you can do it other ways, its just a lot more practical to do it RIGHT way, your confusing him.

As for you others. try to HELP THE PERSON. Not hand it to them on a silver plater and say "Here! Ask me fore some more scripts so you never have to learn yourself!"

"You're asking me to take my time and resources to give you something in exchange for nothing. Further, this would be a slippery slope that would undoubtedly lead to yourself and others asking for the same in the future." - Thus sayith the Gord

Python523 06-13-2002 11:36 AM

Quote:

Originally posted by Projectshifter
LOL. Shouldn't this be an NPC Server question? I'd say make 3 images. One of both of the sides, and one of the middle. For the sides:
NPC Code:

//#CLIENTSIDE
if (playertouchsme)
timeout=0.1;
if (timeout)
{ set underbridge;
sleep 0.11;
unset underbridge;}



for the bridge itself:
NPC Code:

//#CLIENTSIDE
if (playertouchsme&&underbridge)
{ drawoverplayer;
dontblock;}
if (playertouchsme&&!underbridge)
{ drawoverplayer;
dontblock;}



Seems slightly simpler and not as much of a hassle, but your call, he he.
---Shifter

1.) Notice he said CLIENTSIDED
2.) eww, flags, use a string

Saga2001 06-13-2002 12:47 PM

Quote:

Originally posted by azuretek23
you mind explainin how it works?
YAY! If more people asked this question, or were at all interested in learning rather than getting things scripted for them I wouldn't bash my head into walls in my sleep.

haunter 06-16-2002 05:24 AM

Quote:

Originally posted by Saga2001


YAY! If more people asked this question, or were at all interested in learning rather than getting things scripted for them I wouldn't bash my head into walls in my sleep.

Would you please explain how to use setshape2 and attcplayertobj and how to combine those two commands to make a bridge? (and no, i am not asking you to make it for me) But please explain in plain english.


All times are GMT +2. The time now is 04:45 AM.

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