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 -.-


All times are GMT +2. The time now is 07:14 AM.

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