Graal Forums

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

killaxjw_p2p 08-28-2003 04:11 AM

Need help
 
What am i doing wrong???im trying to make it if a restraunt member says /sub a sub will appear and the other player can touch the sub and it will dissapear.

NPC Code:

// Food Script created by ...
if(created){
setstring this.foodtype,sub; }

if(playerchats&&strequals(#c,/#s(this.foodtype))){
putnpc2 playerx+.5+vecx(playerdir)*2,playery+1+vecy(player dir)*2,{
if(created){
setimg sub.png;
}
if(playertouchsme){
playerhearts=playerfullhearts;
}
}
}


protagonist 08-28-2003 04:14 AM

Well, one obvious thing is that the player has to say /#s(this.foodtype) before the NPC even tries to put down an NPC.

Kaimetsu 08-28-2003 04:19 AM

It irritates me that nobody bothers trying to debug their work before they go running to the forums for help.

Tseng 08-28-2003 04:26 AM

Posting just what it does wrong would be beneficial. For example, does the NPC not lay down, or does it not disappear, or what?

(I obviously can see that you have no destroy; after the playerhearts=playerfullhearts;, but that's beside the point. It's the principle of the thing.)

Quote:

Originally posted by protagonist
Well, one obvious thing is that the player has to say /#s(this.foodtype) before the NPC even tries to put down an NPC.
I hope you are not saying that Graal does not interpolate the string before comparing the two, because it does.

protagonist 08-28-2003 05:02 AM

Quote:

Originally posted by Tseng

I hope you are not saying that Graal does not interpolate the string before comparing the two, because it does.

I would assume that if it checks if the chat string equalled /#s(this.foodtype) then it would expect that exact text to be input.

Tseng 08-28-2003 05:05 AM

Quote:

Originally posted by protagonist


I would assume that if it checks if the chat string equalled /#s(this.foodtype) then it would expect that exact text to be input.

It interpolates it. Try it out for yourself if you do not believe me.

(Otherwise, how could it interpolate #c to your chat text? ;))

protagonist 08-28-2003 06:17 AM

Quote:

Originally posted by Tseng


It interpolates it. Try it out for yourself if you do not believe me.

(Otherwise, how could it interpolate #c to your chat text? ;))

Ah I see.

CheeToS2 08-28-2003 01:12 PM

missing a ; at the end of the second to the last line.. putnpc2 is still a command, don't hate because it uses { }'s ;D

Knuckles 08-28-2003 01:30 PM

Re: Need help
 
Quote:

Originally posted by killaxjw_p2p
What am i doing wrong???im trying to make it if a restraunt member says /sub a sub will appear and the other player can touch the sub and it will dissapear.

NPC Code:

// Food Script created by ...
if(created){
setstring this.foodtype,sub; }

if(playerchats&&strequals(#c,/#s(this.foodtype))){
putnpc2 playerx+.5+vecx(playerdir)*2,playery+1+vecy(player dir)*2,{
if(created){
setimg sub.png;
}
if(playertouchsme){
playerhearts=playerfullhearts;
}
}
}


putnpc2 doesnt work offline, if thats where you trying it.
Quote:

missing a ; at the end of the second to the last line.. putnpc2 is still a command, don't hate because it uses { }'s ;D
Yes, but thats not the reason why its not working.

Knuckles 08-28-2003 01:33 PM

Quote:

Originally posted by Kaimetsu
It irritates me that nobody bothers trying to debug their work before they go running to the forums for help.
That's because its not his work.
You can tell from his other post.

Kaimetsu 08-28-2003 01:35 PM

Quote:

Originally posted by Knuckles

That's because its not his work.
You can tell from his other post.

I think you're probably right.

killaxjw_p2p 08-28-2003 11:43 PM

...Thanks for helping i got it to work...


All times are GMT +2. The time now is 06:53 AM.

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