Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Help: attachplayertoobj objecttype,id (https://forums.graalonline.com/forums/showthread.php?t=5955)

Keyan 06-27-2001 11:10 PM

Help: attachplayertoobj objecttype,id
 
K, my friend is the one havin the problems with this, not me (i dont script o_o; ) Anyone have any ideas what it does?

BigMcStrongmuscl: attachplayertoobj objecttype,id
BigMcStrongmuscl: i dun get what it means by "attach"
BigMcStrongmuscl: cuz the player dont move with the object


Er1c 06-28-2001 01:20 AM

When I was trying out the new commands, this is what I made to check out attachplayertoobj... I'll add some comments for you.

NPC Code:

if (created) {
setimg lift_platform.png;
this.speed = .1;
drawunderplayer;//looked funny when the player was getting on without this
setshape2 8,7,{
20,20,20,20,20,20,20,20,
20, 0, 0, 0, 0, 0, 0,20,
20, 0, 0, 0, 0, 0, 0,20,
20, 0, 0, 0, 0, 0, 0,20,
20, 0, 0, 0, 0, 0, 0,20,
20,20, 0, 0, 0, 0,20,20,
20,20, 0, 0, 0, 0,20,20,
};//sets the images blocking properties
timeout = .05;
}
if (timeout) {
if (this.mode=0) {//left movement
if (x<12) {
this.mode = 1;
} else {
x -= this.speed;
}
} else {
if (x>42) {//right movement
this.mode = 0;
} else {
x += this.speed;
}
}
if (playerattached) {
this.check = false;//checks if the player can get off without getting stuck on a wall
for (i = 0;i<4;i++) {
if (onwall(x+2+i,y+7)) {
this.check = true;
break;
}
}
if (playery>=y+4 && playerx+.5 in |x+1,x+4| && this.check==false)//this will take the player off the object if theres no wall in the way
detachplayer;
} else {
if (playerx+.5 in |x,x+5| && playery in |y-2,y+4|)//this attaches the player to the object
attachplayertoobj 0,id;
}
timeout = .05;
}



All times are GMT +2. The time now is 03:50 PM.

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