Graal Forums

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

VeX_RaT_Boy 07-29-2003 01:54 AM

Triggeraction....
 
When i try to do a triggeraction from clientside to serverside on a normal npc, it works, but if i do it more, it wont work...

It only works once...

Anyone have an idea about what's wrong?

Tseng 07-29-2003 05:10 AM

Re: Triggeraction....
 
Quote:

Originally posted by VeX_RaT_Boy
When i try to do a triggeraction from clientside to serverside on a normal npc, it works, but if i do it more, it wont work...

It only works once...

Anyone have an idea about what's wrong?

Posting the bit of code wherein you use the triggeraction, as well as how the serverside action is handled, would be very beneficial. Otherwise, one can only guess what you are doing wrong.

Projectshifter 07-29-2003 11:13 AM

::fully agrees::
We're assuming this is a weapon right?
---Shifter

VeX_RaT_Boy 07-29-2003 02:03 PM

Quote:

Originally posted by Projectshifter
::fully agrees::
We're assuming this is a weapon right?
---Shifter

No weapon, just a normal NPC in a level.

NPC Code:

if (timeout) {
if (this.dir=0) y-=0.3;
if (this.dir=2) y+=0.3;
if (this.dir=1) x-=0.3;
if (this.dir=3) x+=0.3;
message #v(this.dir);

timeout=0.5;
}

if (actionmove) {
this.dir=strtofloat(#p(0));
timeout=1;
}
//#CLIENTSIDE
if (timeout) {
if (keydown(1)&&!this.dir=1) {triggeraction x,y,move,1;this.dir=1;}
if (keydown(3)&&!this.dir=3) {triggeraction x,y,move,3;this.dir=3;}
if (keydown(0)&&!this.dir=0) {triggeraction x,y,move,0;this.dir=0;}
if (keydown(2)&&!this.dir=2) {triggeraction x,y,move,2;this.dir=2;}
timeout=0.05;
}



This is NOT the whole script. Also, the player is attached to it.

EDIT: It wont triggeraction AFTER the first timeout=1; serverside. I have no idea why.

osrs 07-29-2003 04:46 PM

NPC Code:

if(created||timeout){
if(this.dir=0&&y>0) y-=0.5;
if(this.dir=2&&x>0) y+=0.5;
if(this.dir=1&&x<64) x-=0.5;
if(this.dir=3&&y<64) x+=0.5;
message #v(this.dir);
timeout=0.5;
}

if(actionmove){
this.dir=strtofloat(#p(0));
timeout=0.5;
}

//#CLIENTSIDE
//Fixed by *osrs

if(created){
setimg block.png;
this.max=4;
timeout=0.05;
}

if(timeout||playerenters){
for(k=0;k<this.max;k++){
if(keydown(k)&&k!=this.m){
triggeraction x,y,move,#v(k);
this.m=strtofloat(#v(k));
}
}
timeout=0.05;
}



I think there is no need to trigger the npc every time when the position is changed,i tested the script online and worked fine.

PS:It's not the whole code,Kai :D

VeX_RaT_Boy 07-29-2003 11:09 PM

Quote:

Originally posted by osrs

I think there is no need to trigger the npc every time when the position is changed,i tested the script online and worked fine.

PS:It's not the whole code,Kai :D

Ok, thank you that worked :)

[edit]
NPC Code:

if(this.dir=0&&y>0) move 0,-1,0.5,0;
if(this.dir=2&&x>0) move 0,+1,0.5,0;
if(this.dir=1&&x<64) move -1,0,0.5,0;
if(this.dir=3&&y<64) move +1,0,0.5,0;


I tested it with move... and its not working... why?
[/edit]


Also, I have another problem with triggeraction...

Its a weapon, triggering something clientside. I have a NPC on a level checking for it serverside if (action...), but it won't work! Strangly, it works clientside, but not serverside!
(Weapon Clientside to NPC Serverside)

Please respond if you know the problem.

osrs 07-30-2003 01:43 AM

Quote:

Originally posted by VeX_RaT_Boy


Ok, thank you that worked :)

[edit]
NPC Code:

if(this.dir=0&&y>0) move 0,-1,0.5,0;
if(this.dir=2&&x>0) move 0,+1,0.5,0;
if(this.dir=1&&x<64) move -1,0,0.5,0;
if(this.dir=3&&y<64) move +1,0,0.5,0;


I tested it with move... and its not working... why?
[/edit]


Also, I have another problem with triggeraction...

Its a weapon, triggering something clientside. I have a NPC on a level checking for it serverside if (action...), but it won't work! Strangly, it works clientside, but not serverside!
(Weapon Clientside to NPC Serverside)

Please respond if you know the problem.

About the triggeraction,read newfeatures,Stefan made a hammer script,that would be helpful.
About the move thing,i'm not sure,i rarely use move x_x'

VeX_RaT_Boy 07-30-2003 02:57 AM

but the mining thing doesn't say how to use it from a clientside weapon to a serverside npc!

osrs 07-30-2003 03:36 AM

I think its not working because the local NPC moves every time,saving the npc position would work (I think x_o)

VeX_RaT_Boy 07-30-2003 01:16 PM

Its not a local NPC, it's a normal NPC in a level. But if i do the if (action...) clientside, it works!

Help anyone? clientside weapon > triggeraction to a serverside npc.

osrs 07-30-2003 04:52 PM

Quote:

Originally posted by VeX_RaT_Boy
Its not a local NPC, it's a normal NPC in a level. But if i do the if (action...) clientside, it works!

Help anyone? clientside weapon > triggeraction to a serverside npc.

Normal NPC in a level = local NPC,i believe o_x'

VeX_RaT_Boy 07-30-2003 05:40 PM

Quote:

Originally posted by osrs


Normal NPC in a level = local NPC,i believe o_x'

I thought local NPC was a npc made with putnpc, putnpc2 ETC...

Alexander 07-30-2003 11:07 PM

Quote:

Originally posted by osrs


Normal NPC in a level = local NPC,i believe o_x'

I thought local NPC was a NPC that was clientside o.O

Quote:

Originally posted by VeX_RaT_Boy
Its not a local NPC, it's a normal NPC in a level. But if i do the if (action...) clientside, it works!

Help anyone? clientside weapon > triggeraction to a serverside npc.

Do a setshape or setshape2 serverside then try the trigger ;)

Androk 07-30-2003 11:13 PM

You can't have something done on Clientside effect something on serverside, they don't mix, only variables transfer between the two. I am a newbie at scripting, so I might be wrong.

Alexander 07-30-2003 11:16 PM

Quote:

Originally posted by Androk
You can't have something done on Clientside effect something on serverside, they don't mix, only variables transfer between the two. I am a newbie at scripting, so I might be wrong.
Yes you can -.-

Tseng 07-30-2003 11:18 PM

Quote:

Originally posted by Androk
You can't have something done on Clientside effect something on serverside, they don't mix, only variables transfer between the two. I am a newbie at scripting, so I might be wrong.
You are wrong.

*sigh*

If you know you are a newbie at scripting, do not try to help others out unless you are absolutely certain that you know what you are talking about (and even then, it's best to get someone else to verify).

It hurt my eyes, please don't make posts incredibly huge, may I recommend using a color. -Falados

VeX_RaT_Boy 07-30-2003 11:22 PM

The weapon triggeraction thing is fixed, PS helped me with it :)

I still want to know why move aint working..everything is ok, but when the timeout starts, it wont triggeraction again.

Falados 07-30-2003 11:28 PM

Its probably b/c you are still using clientside coordinates for the server-side NPC, you moved the server-side part of it, but the clientside part remains where it is... posibly moving the client-side part to the new location aswell would work (set the clientside part's X and Y after you triggeraction)?

Alexander 07-30-2003 11:28 PM

Quote:

Originally posted by Tseng


You are wrong.

Didn't I say that already :o

Tseng 07-30-2003 11:30 PM

Quote:

Originally posted by Alexander


Didn't I say that already :o

Yes, but you did not provide him with an easily-readable warning about continuing that behavior in the future.

VeX_RaT_Boy 07-31-2003 12:13 AM

Quote:

Originally posted by Falados
Its probably b/c you are still using clientside coordinates for the server-side NPC, you moved the server-side part of it, but the clientside part remains where it is... posibly moving the client-side part to the new location aswell would work (set the clientside part's X and Y after you triggeraction)?
i made it do setplayerprop #c with the clientside coors, and message with the serverside. then i found out that clientside had decimals (43.3), and server had not. then i did int( ) on triggeraction, message, everything, but still not working.

MarkB 07-31-2003 12:45 AM

Quote:

Originally posted by Tseng


Yes, but you did not provide him with an easily-readable warning about continuing that behavior in the future.


lol tseng you act like he swore or something, rofl
relax k? he was offering help

Tseng 07-31-2003 12:49 AM

Quote:

Originally posted by MarkB



lol tseng you act like he swore or something, rofl
relax k? he was offering help

Would you like a pharmacist who had perhaps two weeks of training mixing your medicine prescriptions?

Or, even worse, attempting to teach others how to do so?

MarkB 07-31-2003 12:59 AM

well, you act rather extreme about it, a simple "dont speak unless you know wtf you are talking about" would do just fine, minus the feeling that he is going to be banned or something if he offers opinions/makes an attempt to help

Tseng 07-31-2003 01:01 AM

Fal-

Colors hurt the eyes more.

With size 48 text, I had thought perhaps someone might actually read it, and perhaps even listen to it.

Quote:

Originally posted by MarkB
well, you act rather extreme about it, a simple "dont speak unless you know wtf you are talking about" would do just fine, minus the feeling that he is going to be banned or something if he offers opinions/makes an attempt to help
People who clearly have no idea what they are doing should not be attempting to teach others.

MarkB 07-31-2003 01:12 AM

all i am saying, it is you overreacted

Tseng 07-31-2003 01:14 AM

Quote:

Originally posted by MarkB
all i am saying, it is you overreacted
Perhaps you misunderstand.

When things like this happen, and the uninformed attempt to teach others, we have a world full of scripters who a) write inefficient code, and b) are less willing to believe that they are doing something wrong, which only makes it harder for these problems to be corrected, and creates more unnecessary work for the global scripting team.

MarkB 07-31-2003 01:42 AM

doesnt change the fact you O V E R R E A C T E D to someone attempting to do something good, and help others.

Tseng 07-31-2003 02:04 AM

Quote:

Originally posted by MarkB
doesnt change the fact you O V E R R E A C T E D to someone attempting to do something good, and help others.
As the old saying goes, the road to hell is paved with good intentions.

MarkB 07-31-2003 02:11 AM

Quote:

Originally posted by Tseng


As the old saying goes, the road to hell is paved with good intentions.

good one.... O.o

Alexander 07-31-2003 02:13 AM

Quote:

Originally posted by Tseng


Perhaps you misunderstand.

When things like this happen, and the uninformed attempt to teach others, we have a world full of scripters who a) write inefficient code, and b) are less willing to believe that they are doing something wrong, which only makes it harder for these problems to be corrected, and creates more unnecessary work for the global scripting team.

He did attempt to help others, but he also stated he "might be wrong", in this case he was. He was just trying to help, he wasn't making a pernament statement of anything.

Kaimetsu 07-31-2003 04:49 AM

People who persist in giving bad advice get masked from the scripting forum. Androk, don't say things if you're not sure that they're correct.

Projectshifter 07-31-2003 08:50 AM

I'm still trying to figure out WHAT clientside thing NEEDS to be clientside thing in a LOCAL NPC needs to be sent to the serverside of that NPC? Best to just keep it serverside or clientside x-x
---Shifter

VeX_RaT_Boy 07-31-2003 03:15 PM

Both problems=solved.

Alex helped me with the move thingy.

Thanks everybody.

osrs 07-31-2003 06:17 PM

Quote:

Originally posted by VeX_RaT_Boy
Both problems=solved.

Alex helped me with the move thingy.

Thanks everybody.

What was wrong? :D

VeX_RaT_Boy 07-31-2003 06:22 PM

Quote:

Originally posted by osrs


What was wrong? :D

When it was moving, it tried to trigger x and y, but since it was moving all the time, x and y was not the npc.
Now its x+.5 and y+5.
:)

osrs 07-31-2003 06:27 PM

Quote:

Originally posted by VeX_RaT_Boy


When it was moving, it tried to trigger x and y, but since it was moving all the time, x and y was not the npc.
Now its x+.5 and y+5.
:)

Bah..

Quote:

Originally posted by osrs
I think its not working because the local NPC moves every time..

Falados 08-01-2003 10:48 AM

Ah, a simple case of leaping before you look.

Soul-Blade 08-01-2003 10:57 AM

I only read the first page, so forgive me if this has been said.

NPCs in a level ARE serverside. NPCs placed with putnpc2 are serverside. In fact, the ONLY way a NPC is not serverside is if it has //#CLIENTSIDE at the top of it. Otherwise, it is serverside. Correct me if I am wrong.

osrs 08-01-2003 10:48 PM

Quote:

Originally posted by Soul-Blade
I only read the first page, so forgive me if this has been said.

NPCs in a level ARE serverside. NPCs placed with putnpc2 are serverside. In fact, the ONLY way a NPC is not serverside is if it has //#CLIENTSIDE at the top of it. Otherwise, it is serverside. Correct me if I am wrong.

*Off-Topic*


All times are GMT +2. The time now is 09:59 AM.

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