Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   attachplayertoobj and setshape2? (https://forums.graalonline.com/forums/showthread.php?t=53015)

projectigi 06-06-2004 10:23 AM

attachplayertoobj and setshape2?
 
I tried to make a Bridge but it wont work right.
I tried some things:
NPC Code:

attachplayertoobj 0,id;
attachplayertoobj 0,npcid;
attachplayertoobj 0,npcsid;
...



But setshape2 wont works right
i can walk above the whole bridge :/
the blocking tiles dont works.

NPC Code:
if(created){
setimg testbridge01.png; //IMG Datei der Brücke
setstring client.at,0;
detachplayer;
message #v(id),#v(npcid),#v(npcs.[id]),#v(npc.id);
}
if(playertouchsme&&strtofloat(#s(client.at))==0){
if(strequals(#m,swim)){
setshape2 14,9,{
22,22,22,22,22,22,22,22,22,22,22,22,22,22,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,
22,22,22,22,22,22,22,22,22,22,22,22,22,22,
22,22,22,22,22,22,22,22,22,22,22,22,22,22
};
}
else{
setshape2 14,9,{
22,22,22,22,22,22,22,22,22,22,22,22,22,22,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,
22,22,22,22,22,22,22,22,22,22,22,22,22,22,
22,22,22,22,22,22,22,22,22,22,22,22,22,22
};
attachplayertoobj 0,1;
setstring client.at,1;
setshape2 14,9,{
22,22,22,22,22,22,22,22,22,22,22,22,22,22,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,
22,22,22,22,22,22,22,22,22,22,22,22,22,22,
22,22,22,22,22,22,22,22,22,22,22,22,22,22
};
}
}


projectigi 06-07-2004 12:00 PM

Ok now i dunno why but i changed the script a bit.
I included a timeout and taken a other thign for checking if the player swims.
Now it keeps warping me in the top left corner of the level when i wlak on the bridge. WHY?
NPC Code:

//#CLIENTSIDE
if(created||timeout){
if(playerswimming){
drawoverplayer;
setshape2 14,9,{
22,11,11,11,11,11,11,11,11,11,11,11,11,22,
22,11,11,11,11,11,11,11,11,11,11,11,11,22,
22,11,11,11,11,11,11,11,11,11,11,11,11,22,
22,11,11,11,11,11,11,11,11,11,11,11,11,22,
22,11,11,11,11,11,11,11,11,11,11,11,11,22,
22,11,11,11,11,11,11,11,11,11,11,11,11,22,
22,11,11,11,11,11,11,11,11,11,11,11,11,22,
22,11,11,11,11,11,11,11,11,11,11,11,11,22,
22,11,11,11,11,11,11,11,11,11,11,11,11,22
};
}
else{
drawunderplayer;
setshape2 14,9,{
22,22,22,22,22,22,22,22,22,22,22,22,22,22,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,
22,22,22,22,22,22,22,22,22,22,22,22,22,22,
22,22,22,22,22,22,22,22,22,22,22,22,22,22
};
}
if(playerx in |x,x+10|&&playery in |y-1,y+9|){
attachplayertoobj 0,id;
}
else{
detachplayer;
}
timeout=.05;
}


osrs 06-07-2004 05:04 PM

You don't really need that timeout.

projectigi 06-07-2004 06:38 PM

I triggered it to serverside and now it works lol

GoZelda 06-07-2004 08:37 PM

Though it's good you found the solution, it ofcourse is better if you find the solution before you post ;)


All times are GMT +2. The time now is 08:51 AM.

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