Graal Forums

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

Sir Kwang 01-26-2002 09:10 AM

npc script
 
Im tryin to make a walkin npc script, where you walk like a character in southpark so far i got
NPC Code:
 if (weaponfired) 


lol

Gohan43331 01-26-2002 09:14 AM

Re: npc script
 
Graal2001.com -> click library -> click npc scripting

Find the script of your choice :D

Python523 01-26-2002 09:38 AM

make some keydowns and set the ganis to idle (by southpark do you mean not walking, just like moving w/o moving your feet?)

TDO2000 01-26-2002 08:18 PM

hmmm something like:

NPC Code:

if(playertouchsme){
toweapons Soutparkwalking;
}

if(weaponfired){
if(this.active=1){
this.active=0;
enabledefmovement;
}
else {
disabledefmovement;
this.speed = .5; //Can be changed
this.active=1;
timeout=.05;
}
}

if(timeout){
setani sp_walk,;
for(this.i=0;this.i<4;this.i++){
if(keydown(this.i)){
playerdir=this.i;
for(this.m=0;this.m < this.speed;this.m+=.05){
if(!onwall(playerx+1.5+vecx(playerdir)*1.05,player y+2+vecy(playerdir)*1.05)){
playerx+=vecx(playerdir)*.05;
playery+=vecy(playerdir)*.05;
}
}
}
}
if(this.active==1){timeout=.05;}
}




could work, not tested ^_^

btedji 01-27-2002 03:02 AM

Take a look at the bomy script that should help you learn

entravial 01-27-2002 09:51 AM

~AlphaFlame~

I thought disabledefmovement nixed all the keys... including S... so TDO, only problem I see with yours (just looking) is the weaponfired part :-p.

Probably

if (weaponfired || timeout && keydown(4))

Would work... if 4 is D like I think it is... *pokes at it*

Echos 01-27-2002 10:48 AM

[Kaimetsu]

Or... you could just use replaceani...

[/Kaimetsu]

Python523 01-27-2002 11:49 AM

you could use disabledefmovement for the moving part, I'm working on something like that:
if (created)
{toweapons *Jagen Control System 1.0;
speed=.9;
setstring speed,.9;
timeout=.05;}
if (timeout)
{disabledefmovement;
timeout=.05;}
//Controling movements
if (keydown(0))
{setani walk,;
playerdir=0;
playery=playery-strtofloat(#s(speed))/10;}
if (keydown(1))
{setani walk,;
playerdir=1;
playerx=playerx-strtofloat(#s(speed))/10;}
if (keydown(2))
{setani walk,;
playerdir=2;
playery=playery+strtofloat(#s(speed))/10;}
if (keydown(3))
{setani walk,;
playerdir=3;
playerx=playerx+strtofloat(#s(speed))/10;}
I have two vars up there so when I get into NPCs that upgrade speed I could just do:
speed=strtofloat(#s(speed))+.1;

setstring speed,#v(speed);
I divided the thing by 10 because graal was reading the .9 as 9 so I had to divide =/

Echos 01-27-2002 12:13 PM

Quote:

Originally posted by Python523
you could use disabledefmovement for the moving part, I'm working on something like that:
if (created)
{toweapons *Jagen Control System 1.0;
speed=.9;
setstring speed,.9;
timeout=.05;}
if (timeout)
{disabledefmovement;
timeout=.05;}
//Controling movements
if (keydown(0))
{setani walk,;
playerdir=0;
playery=playery-strtofloat(#s(speed))/10;}
if (keydown(1))
{setani walk,;
playerdir=1;
playerx=playerx-strtofloat(#s(speed))/10;}
if (keydown(2))
{setani walk,;
playerdir=2;
playery=playery+strtofloat(#s(speed))/10;}
if (keydown(3))
{setani walk,;
playerdir=3;
playerx=playerx+strtofloat(#s(speed))/10;}
I have two vars up there so when I get into NPCs that upgrade speed I could just do:
speed=strtofloat(#s(speed))+.1;

setstring speed,#v(speed);
I divided the thing by 10 because graal was reading the .9 as 9 so I had to divide =/

[Kaimetsu]

So... horribly... inefficient... You could drop that to maybe 8 lines.

[/Kaimetsu]

Python523 01-27-2002 12:59 PM

Quote:

Originally posted by Echos


[Kaimetsu]

So... horribly... inefficient... You could drop that to maybe 8 lines.

[/Kaimetsu]

I knew someone was going to say that x.x
I mostly go for what works, not how short it is, I wait till I add more features till I shorten it, I'll probably work on it soon

Echos 01-27-2002 01:06 PM

Quote:

Originally posted by Python523

I knew someone was going to say that x.x
I mostly go for what works, not how short it is, I wait till I add more features till I shorten it, I'll probably work on it soon

[Kaimetsu]

Why not go for both? You'll learn a lot more in the process.

[/Kaimetsu]


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

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