Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Gman's questions thread (https://forums.graalonline.com/forums/showthread.php?t=50856)

WanDaMan 02-03-2004 03:23 PM

replaceani walk,newgani;
Didn't you find that?

WanDaMan 02-03-2004 03:23 PM

Re: Triggeraction
 
Quote:

Originally posted by Gman4pwnu
Can a trigger action detect an NPC thats in a players inventory?

No.

VeX_RaT_Boy 02-03-2004 03:33 PM

Re: Triggeraction
 
Quote:

Originally posted by Gman4pwnu
Can a trigger action detect an NPC thats in a players inventory?

Sorry for all the posts, but im not jus goin 2 cram em all into one :)

what do you mean with detect?

osrs 02-03-2004 04:34 PM

Re: Re: Triggeraction
 
Quote:

Originally posted by WanDaMan

No.

Yes.

Quote:

Originally posted by VeX_RaT_Boy

what do you mean with detect?

Using triggeraction for detect specifieds weapons, i believe.

osrs 02-03-2004 04:36 PM

Read Stefan's post, here.

osrs 02-03-2004 04:38 PM

I think you should stop posting questions for every single script that you want to make.

osrs 02-03-2004 04:43 PM

Learn the basic first, what you're trying to script is pretty basic and you have troubles with it, so..

LEARN TO WALK BEFORE YOU TRY TO RUN.

Okay?

adam 02-03-2004 05:00 PM

Since there are no real tutorials.
There is no way to learn.

What stefan says makes perfect sense.

If your on a playerworld and suddently the npc server crashes, the clientside scripts still run becouse it already sent them to you, but the client runs them. If you come on afterwords nothing happens at all, becouse it can't send them to you.

WanDaMan 02-03-2004 05:27 PM

Yes, osrs but I don't think he means that.. I think he means other weapons aswell as the current weapon? (I don't know if you can either way)...

WanDaMan 02-03-2004 05:28 PM

That's hit points (HP) not weapons.. But It's good because it says the detection :)

WanDaMan 02-03-2004 05:30 PM

It's not against the rules, it isn't exactly spamming.. But he could of put them all in one :-)

osrs 02-03-2004 08:39 PM

Quote:

Originally posted by WanDaMan
It's not against the rules, it isn't exactly spamming.. But he could of put them all in one :-)
It's called lazyness, he can make a script without make questions?

osrs 02-03-2004 08:41 PM

Quote:

Originally posted by WanDaMan
That's hit points (HP) not weapons.. But It's good because it says the detection :)
Quote:

but I really have no clue on hit detection. =\
That's what he wants to know. -_-

osrs 02-03-2004 08:42 PM

Quote:

Originally posted by WanDaMan
Yes, osrs but I don't think he means that.. I think he means other weapons aswell as the current weapon? (I don't know if you can either way)...
'Can a trigger action detect an NPC thats in a players inventory? '

Yes, he can.

WanDaMan 02-03-2004 08:44 PM

Quote:

Originally posted by osrs


'Can a trigger action detect an NPC thats in a players inventory? '

Yes, he can.

But what if the triggeraction is intended to be for another NPC not the one with the triggeraction in? :\

WanDaMan 02-03-2004 08:47 PM

Yeah I edited if you see O.o!

WanDaMan 02-03-2004 08:49 PM

Quote:

Originally posted by osrs


It's called lazyness, he can make a script without make questions?

Thats a rhetorical question :)!
(Don't know spelling)

Termina_Owner 02-03-2004 09:06 PM

Try fooling arround with Sin&Cos, then use some script to setfocus a part of the destination where the next mark would be, and leave it run around wild. :) Using setfocus, of course...

Erm... Wrong question answered. Make the topic more on topic: use TIMEOUT, and drunklevel --. I think that's it... Wavy Vision is expressed in first answer, decreasing of drunk level in other.

GoZelda 02-03-2004 09:26 PM

Try using light effects :megaeek:

Admins 02-03-2004 10:23 PM

Quote:

Originally posted by Gman4pwnu
So how would I do a lights on / off script for everyone to see? A triggeraction from server to client?

Also, if I select an image for the npc, do I need to set a shape?

For lights: You can still show/hide the npc on serverside, the visibility information is sent to all players

When you do setimg then the npcserver is by default reading the beginning of the image (gif or png) to get the image size, and is automatically setting the shape size so playertouchsme etc. is working. That has been added 4 months ago. Also imgwidth(filename) and imgheight(filename) are working now on serverside.

Gman4pwnu 02-03-2004 10:23 PM

I had no clue on what commands might be used for a wavy vision effect, sorry for asking a question, i will no longer ask any questions. I will stay semi stupid on scripting.

Gman4pwnu 02-03-2004 10:26 PM

This is related to a custom hp system that im tryin to make. For hit detection, if the other player is carrying an npc that has the hit detection script, if the player swings the npc sword, can it send a triggeraction to the x,y and if the player is on the xy and has the detection npc?

Gman4pwnu 02-03-2004 10:30 PM

Thank you for your help stefan, I wish there were some guides that teach scripting in the way Accelerated C++ taught C++.

Pretty much it tells you what your trying to do, it gives you the code, and then it breaks it down to tell you what each command does.

Admins 02-03-2004 10:31 PM

x-x just ask and ignore stupid answers

something like that would be good i guess (does wavy effect when someone touchs the npc)

NPC Code:

if (playertouchsme) {
this.waveangle = 0;
for (this.i=0; this.i<5; this.i+=0.05) {
setfocus playerx+1.5+sin(this.waveangle)*3,playery+2;
this.waveangle += 0.2;
sleep 0.05;
}
resetfocus;
}



I have not tested this but it should work. Change the 'this.waveangle += 0.2' line to some other value to get different waving speed

Gman4pwnu 02-03-2004 10:32 PM

hopefully the last one! modifying player speed
 
The only way I know to modify the player's speed is to increase the x and y they move everytime they hit the arrow keys, im wondering if theres a flag or something that stores the playerspeed? Or some other way?

GoZelda 02-03-2004 10:34 PM

On Graal Classic you go walk weird when hit with a bowling ball ^^

I thought you ment drunk as in, you see flashes in front of your eyes, and stuff o.o;;

GoZelda 02-03-2004 10:35 PM

Yes, that's the way it's used clientside :\

GoZelda 02-03-2004 10:37 PM

Quote:

Originally posted by Termina_Owner


This is hilarious. I should check Stefan's posts more often :)

Stefan thinks the NPCserver has real feelings and can get bored :\

Termina_Owner 02-03-2004 10:51 PM

No. You can use the level 3 shield as an increase in speed, otherwise you'd have to make your own movement system.

ZeLpH_MyStiK 02-03-2004 11:22 PM

Quote:

Originally posted by Gman4pwnu
This is related to a custom hp system that im tryin to make. For hit detection, if the other player is carrying an npc that has the hit detection script, if the player swings the npc sword, can it send a triggeraction to the x,y and if the player is on the xy and has the detection npc?
Yes, that's how the shoot command works.

ZeLpH_MyStiK 02-03-2004 11:33 PM

Well hope the following helps, im going to go through trigonometry briefly:
In a unit circle (a circle with a radius of one), a point on the circles edge defined my an angle x has the coordinates (cos(x),sin(x)). If a larger circle is wanted, you multiply the coordinates by the number you want the radius to increase. I.E. if you want a circle with a radius of 5, the coordinate on the edge of the circle defined by angle x would be (5cos(x),5sin(x)). So the code should look something like this:
NPC Code:

//#CLIENTSIDE
if (created) {
loop=15; // number of times it circles
size=3; // size of the radius that the vision circles at
drunkeffect();
}
function drunkeffect() {
for(i=0;i<loop;i++) { // for loop that ensures that it circles (loop) times
for(j=0;j<360;j++) { // j=angle and i do believe gscript does not use radians
seteffect playerx+1.5+cos(j)*radius,playery+2+sin(j)*radius;
sleep .05;
}
}
resetfocus;
}


ZeLpH_MyStiK 02-03-2004 11:41 PM

Since it's a weapon hitobjects or hitplayer or hurt or something like that would be helpful heh? :D

osrs 02-03-2004 11:49 PM

Quote:

Originally posted by Gman4pwnu
I had no clue on what commands might be used for a wavy vision effect, sorry for asking a question, i will no longer ask any questions. I will stay semi stupid on scripting.
You can ask, but not for every single script that you want to make, you should start since the basic stuff dude, it'll be better for you, trust me. :)

Duwul 02-04-2004 12:36 AM

Quote:

Originally posted by ZeLpH_MyStiK
Well hope the following helps, im going to go through trigonometry briefly:
In a unit circle (a circle with a radius of one), a point on the circles edge defined my an angle x has the coordinates (cos(x),sin(x)). If a larger circle is wanted, you multiply the coordinates by the number you want the radius to increase. I.E. if you want a circle with a radius of 5, the coordinate on the edge of the circle defined by angle x would be (5cos(x),5sin(x)). So the code should look something like this:
NPC Code:

//#CLIENTSIDE
if (created) {
loop=15; // number of times it circles
size=3; // size of the radius that the vision circles at
drunkeffect();
}
function drunkeffect() {
for(i=0;i<loop;i++) { // for loop that ensures that it circles (loop) times
for(j=0;j<360;j++) { // j=angle and i do believe gscript does not use radians
seteffect playerx+1.5+cos(j)*radius,playery+2+sin(j)*radius;
sleep .05;
}
}
resetfocus;
}


Erm, Gscript DOES use radians. To convert from radians to degrees, I believe its (radians * (180/pi)). And to convert from degrees, it is (degrees * (pi/180)).

Gman4pwnu 02-04-2004 12:51 AM

Mining
 
I have made my pickaxe, but how do I detect if the player is hitting a certain tile ?

Duwul 02-04-2004 12:56 AM

Actually, I would get a mining rock image, put it into an npc, have the weapon trigger the mining action, and have the rock npc detect the action, then do stuff.

But to answer your question, you would do

NPC Code:

setplayerprop #c,#v(tiles[playerx+1.5+vecx(playerdir)*2,playery+2+vecy(playe rdir)*2]);



That would make your chat text the tile that you are hitting with the axe. Then just check if that tile is the one you want.

Termina_Owner 02-04-2004 01:03 AM

Go Duwul!

GMan, can you just CENTRALIZE all your questions? Or post them all in one area?

You can have this:

Pick Axe:
NPC Code:

//#CLIENTSIDE
if (weaponfired){
triggeraction playerx+1.5+vecx(playerdir)*2,playery+2+vecy(playe rdir)*2,mined,4;
}


NPC:
NPC Code:

if (created){
setshape 1,32,32;
}
if (actionmined){
message Aww.. You hit me! You Filthy Cheater!... You did #p(0) damage to me! Arg;
}


ZeLpH_MyStiK 02-04-2004 02:17 AM

Quote:

Originally posted by Duwul


Erm, Gscript DOES use radians. To convert from radians to degrees, I believe its (radians * (180/pi)). And to convert from degrees, it is (degrees * (pi/180)).

O ya right gscript does use radians. Well pi is 180 degrees. So easy to convert.

ZeLpH_MyStiK 02-04-2004 02:18 AM

Quote:

Originally posted by Termina_Owner
Go Duwul!

GMan, can you just CENTRALIZE all your questions? Or post them all in one area?

You can have this:

Pick Axe:
NPC Code:

//#CLIENTSIDE
if (weaponfired){
triggeraction playerx+1.5+vecx(playerdir)*2,playery+2+vecy(playe rdir)*2,mined,4;
}


NPC:
NPC Code:

if (created){
setshape 1,32,32;
}
if (actionmined){
message Aww.. You hit me! You Filthy Cheater!... You did #p(0) damage to me! Arg;
}


rofl i love ur mine =D

adam 02-04-2004 02:32 AM

Quote:

Originally posted by GoZelda

Stefan thinks the NPCserver has real feelings and can get bored :\

it doesn't?


All times are GMT +2. The time now is 10:56 PM.

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