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=41971)

Com013 01-13-2003 09:28 PM

Bridge
 
1 Attachment(s)
I have only little experience with the commands which were previously p2p only, and so I have got problems making a bridge.

Here is my current script (yes, I know it is not looking nice):

NPC Code:

// Script made by Com013
if (created) {
setarray btiles,14*9;

for (i=0; i<9; i++)
for (j=0; j<14; j++) {
if (i<2 || i>=7)
btiles[i*14+j] = 22;
else
btiles[i*14+j] = 0;
}

setshape2 14,9,btiles;
setarray btiles,0;

drawoverplayer;
dontblock;
}
//#CLIENTSIDE
if (playerenters || timeout) {
if (playerattached) {
if (playerdir==1 && playerx<=x-0.5 ||
playerdir==3 && playerx>=x+11.5)
detachplayer;
} else if (playery in |y+1,y+4|) {
if (playerdir==3 && playerx==x-2.5 ||
playerdir==1 && playerx==x+13.5)
attachplayertoobj 0,npcs[0].id;
}

timereverywhere;
timeout = 0.05;
}



I haven't tested this yet on the NPC Server, so I am not sure whether the attachplayertoobj can be clientside.

The script is working fine, but when you are leaving the bridge, the player is suddenly under it. I have no clue how to improve it except by adding transparent parts at the sides of the bridge.

Googi 01-14-2003 05:55 AM

Why not just use move?

tlf288 01-14-2003 03:43 PM

I haven't downloaded it yet but couldn't you just widden the setshape to another 2-3 tiles on each side so it doesn't appear to draw over the player?

edit: Oh I see, Just change your x dectection to be 2-3 tiles wider....

Com013 01-14-2003 06:48 PM

Quote:

Originally posted by tlf288
I haven't downloaded it yet but couldn't you just widden the setshape to another 2-3 tiles on each side so it doesn't appear to draw over the player?
Yes, that was my first idea, but I can only do so for the right / bottom side of it. The left / top side cannot be extended using setshape. I guess I have got to use ganis for it.

Quote:

edit: Oh I see, Just change your x dectection to be 2-3 tiles wider....
No, that doesn't work, because the player cannot walk out of the shape. (To see it you can simply turn the detach command into a comment).

tlf288 01-15-2003 03:29 AM

Here you are:

NPC Code:

// Script made by Com013
// fixed by: Trevor

if (created) {
setarray btiles,14*9;

for (i=0; i<9; i++)
for (j=0; j<14; j++) {
if (i<2 || i>=7)
btiles[i*14+j] = 22;
else
btiles[i*14+j] = 0;
}

setshape2 14,9,btiles;
setarray btiles,0;

dontblock;
}
//#CLIENTSIDE
if (playerenters || timeout) {
message #v(npcs[0].id) - #v(playerattachid) - #v(playerattached || false) - (#v(levelorgx) - #v(levelorgy));

if(playerdir==0||playerdir==2){
drawoverplayer;
}

if (playerattached) {
if (playerdir==1 && playerx<=x-0.5 ||
playerdir==3 && playerx>=x+11.5){
drawunderplayer;
detachplayer;
}
} else if (playery in |y+1,y+4|) {
if (playerdir==3 && playerx==x-2.5 ||
playerdir==1 && playerx==x+13.5){
attachplayertoobj 0,npcs[0].id;
}
}

timereverywhere;
timeout = 0.05;
}



I tried everything then I was like "OMG!, this is so simple."

You can see what I did :)

tlf288 01-15-2003 03:59 AM

*smacks self*

I should of cought that...

I guess thats why your the Script Monkey and I'm only a cimpanzee :P

Goboom 01-15-2003 10:09 PM

Quote:

Originally posted by tlf288
*smacks self*

I should of cought that...

I guess thats why your the Script Monkey and I'm only a cimpanzee :P

Cupchino Monkey ;)

Com013 01-15-2003 10:34 PM

Quote:

Originally posted by tlf288
Here you are:

NPC Code:

// Script made by Com013
// fixed by: Trevor
...
if(playerdir==0||playerdir==2){
drawoverplayer;
}
...
drawunderplayer;



I tried everything then I was like "OMG!, this is so simple."

You can see what I did :)

Sorry, but drawover/underplayer won't work here, because then you would see yourself correctly under the bridge, while other players would see you over it. (Or other conflicts happen).

No, I guess I'll use the gani way instead.

Kaimetsu, why is setshape2 not working serverside?

tlf288 01-16-2003 01:48 AM

Quote:

Originally posted by Com013


Sorry, but drawover/underplayer won't work here, because then you would see yourself correctly under the bridge, while other players would see you over it. (Or other conflicts happen).

I see...

Just look at the bridge on Avalon. It works as far as I know.

Com013 01-16-2003 02:49 PM

Quote:

Originally posted by Kaimetsu

So I'll answer both.

Please excuse my bad english...yes, I actually wanted to hear both.

Quote:

Originally posted by tlf288

Just look at the bridge on Avalon. It works as far as I know.

Exactly that is the reason why I was posting this: I am redoing them, because they are NOT working correctly.
However, they are too near to the level border, so there are problems. I will just remove the avalon bridges and put stairs there.

tlf288 01-16-2003 03:12 PM

Quote:

Originally posted by Com013

However, they are too near to the level border, so there are problems.

Yes, level borders do seem to mess alot of things up when npcs are crossing over them.

Quote:


I will just remove the avalon bridges and put stairs there.

Only do that temporary. Working around the problem ussually isn't that good. Try to fix and if worse comes to worse ask Kai to try to fix it.

Python523 01-16-2003 05:15 PM

com, maybe you should try making classic a flat gmap, it would solve level border problems

Goboom 01-16-2003 11:47 PM

Quote:

Originally posted by Kaimetsu

1) Nope, not last time I checked. I asked Stefan about it but I think he's planning to do some thing where the server sends its shape information to the client, and that'd need a new client release, so it'll probably have to wait.
:megaeek: I don't want to wait...:\

Com013 01-18-2003 09:57 PM

Quote:

Originally posted by Python523
com, maybe you should try making classic a flat gmap, it would solve level border problems
Already did so (on Classic Developement).
I think the problem is still happening.


All times are GMT +2. The time now is 11:59 PM.

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