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 05-02-2002, 01:56 PM
Glory Glory is offline
Banned
Glory's Avatar
Join Date: Mar 2002
Location: Sunnydale
Posts: 1,365
Glory is on a distinguished road
Send a message via AIM to Glory
Mouse Movement

Kumada wanted me to post this,
Kumada:
Here is a movement script for the new version.. its not
completely done yet but it should at least show you how to use
some of the new commands.

NPC Code:
	
// NPC made by Kumada
if (playerenters || timeout){
if (leftmousebutton){
setani walk,;
this.walktox = mousex;
this.walktoy = mousey;
showimg 1,@Moving to x#v(this.walktox)
y#v(this.walktoy),this.walktox,this.walktoy;
for (; this.walktox>playerx; playerx++; ){
playerdir = 3;
sleep 0.05;
}
for (; this.walktox<playerx; playerx--; ){
playerdir = 1;
sleep 0.05;
}
for (; this.walktoy>playery; playery++; ){
playerdir = 2;
sleep 0.05;
}
for (; this.walktoy<playery; playery--; ){
playerdir = 0;
sleep 0.05;
}
}
timeout = 0.05;
}

Reply With Quote
  #2  
Old 05-02-2002, 02:34 PM
Saga2001 Saga2001 is offline
Wishing he had 3 feet
Join Date: Aug 2001
Location: Basement
Posts: 1,565
Saga2001 is on a distinguished road
Send a message via ICQ to Saga2001 Send a message via AIM to Saga2001 Send a message via Yahoo to Saga2001
While were showing off mouse scripts...I got bored and made this...its cool. :) Won't work w/o npc server (well some of it will..)
NPC Code:

if (actionserverside) {
if (strequals(#p(0),getPlayer)) {
with (getplayer(#p(1))) {
setstring thiso.player,#a;
thiso.hearts = playerhearts;
thiso.fhearts = playerfullhearts;
thiso.ap = playerap;
thiso.mp = playermp;
}
setstring clientr.playermenu,"#s(this.player)'s Status","Hearts #v(thiso.hearts)/#v(thiso.fhearts)","AP: #v(thiso.ap)","MP: #v(thiso.mp)";
}
}
//#CLIENTSIDE
if (playerenters || timeout) {
if (strlen(#s(client.colors))<=0) setstring client.colors,.2 .5 .9 1;
tokenize #s(client.colors);
this.r = strtofloat(#t(1));
this.g = strtofloat(#t(2));
this.b = strtofloat(#t(3));
this.a = strtofloat(#t(4));
getPlayer();
if (this.on == 1)
setstring this.menuitems,Status,"Hearts #v(playerhearts)/#v(playerfullhearts)","AP: #v(playerap)","MP: #v(playermp)";
if (this.wait>5) {
if (this.on == 1) updateDropdown();
if (mousebuttons == 1 && this.lock == 0) showDropdown();
if (mousebuttons == 4) hideDropdown();
if (mousewheeldelta!=0 && this.on == 1) {this.y+=(mousewheeldelta*25);moveDropdown();}
if (keydown2(keycode(u),true)) {this.wait=0;this.lock = 0;}
if (keydown2(keycode(n),true)) {this.wait=0;this.lock = 1;}
}
}
if (strlen(#s(clientr.playermenu))>0) {
for (i=0; i<sarraylen(clientr.playermenu); i++;) {
showimg 700+i,@#I(clientr.playermenu,i),5,120+(i*15);
changeimgvis 700+i,5;
changeimgzoom 700+i,.75;
changeimgcolors 700+i,this.r,this.g,this.b,this.a;
}
if (keydown2(keycode(h),true)) hidePlayer();
}
this.wait+=2.5;
timeout=.05;
}
function updateDropdown() {
for (i=0; i<sarraylen(this.menuitems); i++;) {
showimg 600+i,@#I(this.menuitems,i),this.x,this.y+(i*15);
changeimgvis 600+i,5;
changeimgzoom 600+i,.75;
changeimgcolors 600+i,this.r,this.g,this.b,this.a;
}
}
function showDropdown() {
this.on = 1;
this.wait=0;
for (i=0; i<sarraylen(this.menuitems); i++;) {
showimg 600+i,@#I(this.menuitems,i),mousescreenx,mousescre eny+(i*15);
changeimgvis 600+i,5;
changeimgzoom 600+i,.75;
changeimgcolors 700+i,this.r,this.g,this.b,this.a;
}
this.x = mousescreenx;
this.y = mousescreeny;
}
function moveDropdown() {
this.wait=0;
for (i=0; i<sarraylen(this.menuitems); i++;) {
showimg 600+i,@#I(this.menuitems,i),this.x,this.y+(i*15);
changeimgvis 600+i,5;
changeimgzoom 600+i,.75;
changeimgcolors 700+i,this.r,this.g,this.b,this.a;
}
}
function hideDropdown() {
this.on = 0;
this.wait=0;
for (i=0; i<sarraylen(this.menuitems); i++;) hideimg 600+i;
}
function getPlayer() {
for (i=0; i<playerscount; i++;) {
if (mousex in |players[i].x, players[i].x+3| && mousey in |players[i].y, players[i].y+4|) setstring this.account,#a(i);
}
triggeraction 0,0,serverside,-playerinfo,getPlayer,#s(this.account);
}
function hidePlayer() {
setstring this.account,;
for (i=0; i<sarraylen(clientr.playermenu); i++) hideimg 700+i;
setstring clientr.playermenu,;
}
if (playerchats) {
if (startswith(/colors,#c)) {
tokenize #c;
setstring client.colors,#t(1) #t(2) #t(3) #t(4);
}
if (strequals(#c,/status-help))
say2 #b
Status System.#b
Commands:#b
Left click - Show your own stats#b
Right click - Hide your stats#b
Mouse Wheel - move your stats#b
Press n - Lock your stats#b
Press u - Unlock your stats#b
Mouseover a player - View his/her#b
stats#b
Press h - Hide their stats#b
More soon!;
}

__________________

!Wan ( 11:27:55 AM):
can i c ur scripts please?
Zorg (RC): If I hear NPC Server call Ne0, Past Austin or Brent sexy one more time im disconnecting it

Last edited by Saga2001; 05-02-2002 at 03:50 PM..
Reply With Quote
  #3  
Old 05-02-2002, 08:22 PM
Projectshifter Projectshifter is offline
The David
Projectshifter's Avatar
Join Date: Apr 2002
Location: USA
Posts: 912
Projectshifter is an unknown quantity at this point
Send a message via ICQ to Projectshifter Send a message via AIM to Projectshifter Send a message via MSN to Projectshifter Send a message via Yahoo to Projectshifter
Sans doesn't have an NPC server :'(
---Shifter
Reply With Quote
  #4  
Old 05-02-2002, 11:31 PM
Saga2001 Saga2001 is offline
Wishing he had 3 feet
Join Date: Aug 2001
Location: Basement
Posts: 1,565
Saga2001 is on a distinguished road
Send a message via ICQ to Saga2001 Send a message via AIM to Saga2001 Send a message via Yahoo to Saga2001
Well if you want to see it, go on Andor, and say:
"/status-help"
__________________

!Wan ( 11:27:55 AM):
can i c ur scripts please?
Zorg (RC): If I hear NPC Server call Ne0, Past Austin or Brent sexy one more time im disconnecting it
Reply With Quote
  #5  
Old 05-03-2002, 10:54 PM
Saga2001 Saga2001 is offline
Wishing he had 3 feet
Join Date: Aug 2001
Location: Basement
Posts: 1,565
Saga2001 is on a distinguished road
Send a message via ICQ to Saga2001 Send a message via AIM to Saga2001 Send a message via Yahoo to Saga2001
Wow, I am a complete idiot. Why am I going clientside when all that info can be retrived clientside with the players[i].value...Well I'll be working on that, but I think you get the point.
__________________

!Wan ( 11:27:55 AM):
can i c ur scripts please?
Zorg (RC): If I hear NPC Server call Ne0, Past Austin or Brent sexy one more time im disconnecting it
Reply With Quote
  #6  
Old 05-03-2002, 11:13 PM
prozac424242 prozac424242 is offline
Registered User
prozac424242's Avatar
Join Date: May 2001
Location: Gone crazy: back soon
Posts: 356
prozac424242 is on a distinguished road
Send a message via ICQ to prozac424242 Send a message via AIM to prozac424242
simple fun

this is not as fancy but its still cool
NPC Code:

// NPC made by Prozac
if (playerenters)
{timeout=.05;}
if (timeout)
{
if (leftmousebutton) {
putexplosion2 3,2,mousex,mousey;
}
timeout=.05;
}



insteat of explosion you can do showimg, lay rupee, putbomb, hitobjecs, .. be creative! heh
__________________

Useful links:
Graal Stats
Client Script Functions-GS1 to GS2
Serverside Script Functions-Gscript page
Particle Engine-Player Attributes
Server Options-Admin rights-Gmaps
Quote:
Originally Posted by Admins
Thanks for developing and improving playerworlds and such
Reply With Quote
  #7  
Old 05-03-2002, 11:16 PM
prozac424242 prozac424242 is offline
Registered User
prozac424242's Avatar
Join Date: May 2001
Location: Gone crazy: back soon
Posts: 356
prozac424242 is on a distinguished road
Send a message via ICQ to prozac424242 Send a message via AIM to prozac424242
the move on click

Glory. you might wanna add some onwall commands to that script so players cant cheat ... and not move faster than you could walk heh
__________________

Useful links:
Graal Stats
Client Script Functions-GS1 to GS2
Serverside Script Functions-Gscript page
Particle Engine-Player Attributes
Server Options-Admin rights-Gmaps
Quote:
Originally Posted by Admins
Thanks for developing and improving playerworlds and such
Reply With Quote
  #8  
Old 05-04-2002, 01:23 AM
TDO2000 TDO2000 is offline
Registered User
TDO2000's Avatar
Join Date: Jul 2001
Location: Germany
Posts: 655
TDO2000 is on a distinguished road
Quote:
Originally posted by Kaimetsu
I really want to post my gesture recognition system, but y'know, script stealing and all
hmmmm sounds like B&W

hmmmm Graal need something like the UO-movement-System
I prefer it that way ^-^

something like this (but with a better onwall-check etc)
I have just invested 2-3 minutes to test the new mouse commands

NPC Code:

//Small UO-Like Walking System
if (playerenters || created) {
if (!isweapon) toweapons System;
else {
this.xy={playerx,playery};
disabledefmovement;
timeout=.05;
}
}

if (timeout) {
//showing the cursor
showimg 201,@<->,mousex,mousey;
//Checking for a key pressed
if (leftmousebutton) movechar();
else if (strequals(#m,walk)) setani idle,;
timeout=.05;
}

function movechar() {
setani walk,;
//getting Distance
this.distance = ((playerx-mousex)^2+(playery-mousey)^2)^.5;
//Getting the Playerdir
dx = playerx - mousex;
dy = playery - mousey;
if (abs(dx)>abs(dy)) {
if (dx>0) playerdir=1; else playerdir=3;
} else {
if (dy>0) playerdir=0; else playerdir=2;
}
//getting speedvar
if (this.distance < 5) this.speed = .3;
if (this.distance in |5,10|) this.speed = .5;
if (this.distance > 10) this.speed = .7;
//move the player
len = (dx*dx+dy*dy)^0.5;
addx = (dx/len)*this.speed;
addy = (dy/len)*this.speed;
if (!onwall(playerx+1.5+vecx(playerdir)*1.025,playery +2+vecy(playerdir)*1.025)) {
playerx-=addx;
playery-=addy;
}
}


use it, flame it or do whatever you want
__________________
No Webhost at the moment
Reply With Quote
  #9  
Old 05-04-2002, 02:25 AM
Saga2001 Saga2001 is offline
Wishing he had 3 feet
Join Date: Aug 2001
Location: Basement
Posts: 1,565
Saga2001 is on a distinguished road
Send a message via ICQ to Saga2001 Send a message via AIM to Saga2001 Send a message via Yahoo to Saga2001
Quote:
Originally posted by Kaimetsu
I really want to post my gesture recognition system, but y'know, script stealing and all
:-/. A gesture script, what do you mean? well sounds leet. St00pid script stealers...
__________________

!Wan ( 11:27:55 AM):
can i c ur scripts please?
Zorg (RC): If I hear NPC Server call Ne0, Past Austin or Brent sexy one more time im disconnecting it
Reply With Quote
  #10  
Old 05-04-2002, 01:36 PM
Neonight Neonight is offline
where da wmdz at
Neonight's Avatar
Join Date: Jun 2001
Location: Windsor, Illinois
Posts: 3,665
Neonight is on a distinguished road
Send a message via AIM to Neonight

Jagen:
Black and white is pretty leet, too bad people are too indecent and they steal scripts, your script sounds interesting, maybe you should make it like b & w and make it so the color effects only show when you have a valid rune?
Reply With Quote
  #11  
Old 05-04-2002, 01:52 PM
Neonight Neonight is offline
where da wmdz at
Neonight's Avatar
Join Date: Jun 2001
Location: Windsor, Illinois
Posts: 3,665
Neonight is on a distinguished road
Send a message via AIM to Neonight
Quote:
Originally posted by Kaimetsu


So how does the player see where he's already drawn? (I've never played B&W, y'see)

Jagen:
In b&w, I think the hand (you, the god) leaves behind a really light trail but when the gesture is valid, it gets a lot brighter and darker, I just remembered that it did leave a slight trail, I had forgotten since I've been letting my cousins rent that game...
Does your gesture system have a write feature? Where you can imput your own gestures? Or did you program specific gestures into the script?
Reply With Quote
  #12  
Old 05-05-2002, 08:49 PM
Glory Glory is offline
Banned
Glory's Avatar
Join Date: Mar 2002
Location: Sunnydale
Posts: 1,365
Glory is on a distinguished road
Send a message via AIM to Glory
Re: the move on click

Quote:
Originally posted by prozac424242
Glory. you might wanna add some onwall commands to that script so players cant cheat ... and not move faster than you could walk heh
I didn't make it.
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 04:18 AM.


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