Graal Forums

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

G_yoshi 07-24-2001 12:56 PM

Assisstance with attachplayertoobj...
 
Hey, I am trying to make a boat thing similar to the mini-ships on graal2001....i have it all setup (setshape2 stuff) but when the player is put on it, he is not fully attached, what is wrong?

NPC Code:

if (playertouchsme&&!playerattached) {
attachplayertoobj 0,0;
set playerattached;
playerx=x+5.5;
playery=y+7;
}

if (playerchats&&playerattached) {
if (strequals(#c,leave)) {
detachplayer;
unset playerattached;
playerx=x;
playery=y;
}



i know that I must be doing something wrong, so I would appreciate it if someone could help me with it, thanks :D

kyle0654 07-24-2001 01:37 PM

attachplayertoobj 0,id;

attaches the player to the current npc (identified by id) (as long as it's in the format playerindex, npcindex)

Brady2 07-24-2001 11:20 PM

Jadis:

What does attachtoobj do?

it sets a flag if (playerattached);

But why would that help? Couldn't you just set a flag instead of using attach player?
Or does it move the player along with the npc's movements?

G_yoshi 07-25-2001 12:43 AM

Quote:

Originally posted by kyle0654
attachplayertoobj 0,id;

attaches the player to the current npc (identified by id) (as long as it's in the format playerindex, npcindex)

I know that, I just want to know why it isn't working :/

it should attach the player, but I am assuming that I gave it the wrong id...but how do i find out the npc's id?

kyle0654 07-25-2001 01:23 AM

no, you actually use 'id' as the variable

G_yoshi 07-25-2001 02:13 AM

Quote:

Originally posted by kyle0654
no, you actually use 'id' as the variable
so you are saying to put 'id' in the final spot?

G_yoshi 07-25-2001 02:16 AM

Quote:

Originally posted by G_yoshi


so you are saying to put 'id' in the final spot?

i tried it......yay it worked :D

thanks for your help kyle :)

kyle0654 07-25-2001 02:34 AM

no problem

Shard_IceFire 07-25-2001 10:42 PM

Quote:

so you are saying to put 'id' in the final spot?
lol! yes, you literally put "id"

G_yoshi 07-25-2001 10:47 PM

Quote:

Originally posted by Shard_IceFire


lol! yes, you literally put "id"

erm, I have already taken care of it thank you ;)

konidias 07-26-2001 11:51 PM

Isn't 0 the only current id you can use (0 for npc)?

kyle0654 07-27-2001 12:43 AM

naw...try this:
NPC Code:

if (created) message #v(id);


every NPC on the server (or offline for that matter) is given an index, in order of creation I think. When I tried that offline my NPCs had indexes in the thousands...

G_yoshi 07-27-2001 12:57 AM

Quote:

Originally posted by kyle0654
naw...try this:
NPC Code:

if (created) message #v(id);


every NPC on the server (or offline for that matter) is given an index, in order of creation I think. When I tried that offline my NPCs had indexes in the thousands...

in the thousands :eek:


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

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