Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 08-25-2002, 11:48 PM
Spark910 Spark910 is offline
Ex-Graal Global
Spark910's Avatar
Join Date: Oct 2001
Location: England
Posts: 10,892
Spark910 has a spectacular aura about
Any ideas why it does not work.

Explain where I went wrong and why it doenst work, dont just give me a new code, also please explain your code, As I am only learning NPC Gscript,

Code In 1 NPC
NPC Code:

// NPC made by Spark911
if (created) {
x=27;
y=37;
}
if (playerenters) {
x=27;
y=37;
timeout=.05;
}
if (timeout) {
if (mousex=>27&&mousex=<28&&mousey=>37&&mousey=<38) {
setstring server.npc,One;
timeout=.05;
}
else {
setstring server.npc,;
unset string;
}
timeout=.05;
}



Code in 2nd NPC

NPC Code:


// NPC made by Spark911
if (created) {
x=31;
y=37;
}
if (playerenters) {
x=31;
y=37;
timeout=.05;
}
if (timeout) {
if (mousex=>31&&mousex=<32&&mousey=>37&&mousey=<38) {
setstring server.npc,Two;
timeout=.05;
}
else {
setstring server.npc,;
unset string;
}
timeout=.05;
}




Code in NPC that displays which NPC you are over:

NPC Code:

// NPC made by Spark911
if (playerenters) {
x=31.5;
y=58.25;
timeout=.05;
}

if (timeout) {
message #s(server.npc);
timeout=.05;
}



One works fine, Nothing happens when your mouse is over 2, If there is an Easier way for me to do the script please say so and explain what you are doing and how it works =)
Reply With Quote
  #2  
Old 08-25-2002, 11:56 PM
mikepg mikepg is offline
Registered User
Join Date: Nov 2001
Location: VA, USA
Posts: 501
mikepg is on a distinguished road
Send a message via AIM to mikepg Send a message via Yahoo to mikepg
timeout must be 0.1 or greater serverside.

Also, it doesn't know who's mouse to read, so you may want to put the mouse clauses clientside.
__________________
~War Lord Mpg2
Bravo Online's Asst. Staff Manager

"Sittin by the tree, sippin eggnog, waitin on christmas gifts"
Reply With Quote
  #3  
Old 08-26-2002, 12:02 AM
Spark910 Spark910 is offline
Ex-Graal Global
Spark910's Avatar
Join Date: Oct 2001
Location: England
Posts: 10,892
Spark910 has a spectacular aura about
Ok that works fine now, But the second one still doesnt work:

NEW First:

NPC Code:

// NPC made by Spark911
if (created) {
x=27;
y=37;
}
if (playerenters) {
x=27;
y=37;
timeout=0.1;
}
//#CLIENTSIDE
if (timeout) {
if (mousex=>27&&mousex=<28&&mousey=>37&&mousey=<38) {
setstring server.npc,Ralf;
}
else {
setstring server.npc,;
unset string;
}
timeout=0.1;
}



New Second:

NPC Code:

// NPC made by Spark911
if (created) {
x=31;
y=37;
}
if (playerenters) {
x=31;
y=37;
timeout=0.1;
}
//#CLIENTSIDE
if (timeout) {
if (mousex=>31&&mousex=<32&&mousey=>37&&mousey=<38) {
setstring server.npc,Ralf;
}
else {
setstring server.npc,;
unset string;
}
timeout=0.1;
}



New Displayer:

NPC Code:

// NPC made by Spark911
if (playerenters) {
x=31.5;
y=58.25;
timeout=0.1;
}

if (timeout) {
message #s(server.npc);
timeout=0.1;
}




Still only first one works (Eventually it will be put in about 17NPC's)
Reply With Quote
  #4  
Old 08-26-2002, 12:25 AM
Spark910 Spark910 is offline
Ex-Graal Global
Spark910's Avatar
Join Date: Oct 2001
Location: England
Posts: 10,892
Spark910 has a spectacular aura about
Clientside is now abover the playerenters part.
Reply With Quote
  #5  
Old 08-26-2002, 12:30 AM
Python523 Python523 is offline
Banned
Join Date: Aug 2001
Location: Illinois
Posts: 3,498
Python523 is on a distinguished road
server strings can only be set serverside i believe
Reply With Quote
  #6  
Old 08-26-2002, 01:12 AM
Spark910 Spark910 is offline
Ex-Graal Global
Spark910's Avatar
Join Date: Oct 2001
Location: England
Posts: 10,892
Spark910 has a spectacular aura about
Can you please answer my PM and reply =)
Reply With Quote
  #7  
Old 08-26-2002, 02:23 AM
-Hadez- -Hadez- is offline
Registered User
Join Date: Aug 2002
Location: Maine
Posts: 164
-Hadez- is on a distinguished road
Spark, I am your father...
__________________
Reply With Quote
  #8  
Old 08-26-2002, 02:47 AM
nyghtGT nyghtGT is offline
Banned
nyghtGT's Avatar
Join Date: Jun 2001
Posts: 3,993
nyghtGT is on a distinguished road
Send a message via AIM to nyghtGT
use triggeraction to triger the npc serverside and set the string.
Reply With Quote
  #9  
Old 08-26-2002, 08:15 AM
emortylone emortylone is offline
Registered User
Join Date: Apr 2002
Location: Control-NPC
Posts: 834
emortylone is on a distinguished road
x.X I already told you x and y was stupid like that!
if (abs(mousex-x)=<1 && abs(mousey-y)=<1)
it is MUCh better and you can move it! x.X
---Shifter
__________________
Quote:
*Stefan: it seems sometimes they hire newbie scripters everywhere x-x
*Stefan: scripters are sometimes like people that draw paintings
*Stefan: all that counts is that it looks nice
Reply With Quote
  #10  
Old 08-28-2002, 03:47 PM
Com013 Com013 is offline
Registered User
Join Date: Aug 2002
Location: GMT+1
Posts: 381
Com013 is on a distinguished road
Re: Any ideas why it does not work.

Quote:
Originally posted by Spark910
NPC Code:

if (mousex=>27&&mousex=<28&&mousey=>37&&mousey=<38) {
setstring server.npc,One;
timeout=.05;
}
else {
setstring server.npc,;
unset string;
}


NPC Code:

if (mousex=>31&&mousex=<32&&mousey=>37&&mousey=<38) {
setstring server.npc,Two;
timeout=.05;
}
else {
setstring server.npc,;
unset string;
}


I guess you tried this offline/as a non-server script, so the problem is not the client/serverside part.
But when your mouse is over the first NPC this will be executed:

1. Script: (mouse is over it)
NPC Code:

setstring server.npc,One;



2. Script: (mouse is not over it)
NPC Code:

setstring server.npc,;
unset string;



Since they are both executed after each other, the second script would remove the effect of the first one.
You could solve it by only clearing the string when the mouse just left the NPC, but not always when the mouse is not over it.
Just do "this.mouseoverme = true;" when the mouse was moved over it and when the mouse is not over the NPC, you should check this variable first: "if(mousex>... && this.mouseoverme == true) {"
Then you could clear the string...and you shouldn't forget to set the variable to false again.
__________________
Com013
Former Admin of the LAT on Graal The Adventure

e-mail: [email protected]
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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