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 03-24-2001, 09:46 AM
LordIceDragon LordIceDragon is offline
Registered User
Join Date: Mar 2001
Posts: 9
LordIceDragon is on a distinguished road
Question

i have tried the freeze player and play a gani and make it move when holding a key down but how come it doesn't work
__________________
Where there is darkness there is light...
Reply With Quote
  #2  
Old 03-24-2001, 08:37 PM
grim_squeaker_x grim_squeaker_x is offline
Retired Oldbie
grim_squeaker_x's Avatar
Join Date: Mar 2001
Posts: 3,084
grim_squeaker_x will become famous soon enough
Blah:
NPC Code:
if (created||timeout) {
if (this.active==1) {
//movement script
if (keydown(0)) {
y-=0.5;
dir = 0;
}
if (keydown(1)) {
x-=0.5;
dir = 1;
}
if (keydown(2)) {
y+=0.5;
dir = 2;
}
if (keydown(3)) {
x+=0.5;
dir = 3;
}
setani whatever,;
freezeplayer 0.05;
}
//Activating or deactivating script.
if (keydown(4)) {
if (this.pressed==0) {
if (this.active==0) this.active=1;
else this.active=0;
this.pressed=1;
}
}
else {
this.pressed=0;
}
timeout = 0.05;
}



But anyways, you need to put in the keydown's in a constantly repeating loop, timeout is the best for that.
__________________

Reply With Quote
  #3  
Old 03-24-2001, 11:58 PM
Thak2 Thak2 is offline
:]
Join Date: Mar 2001
Location: BC
Posts: 1,344
Thak2 is on a distinguished road
Send a message via AIM to Thak2
Also freezeplayer will not react with warps, so hopefully your use of it will not involve multiple levels.
Reply With Quote
  #4  
Old 03-25-2001, 06:06 AM
grim_squeaker_x grim_squeaker_x is offline
Retired Oldbie
grim_squeaker_x's Avatar
Join Date: Mar 2001
Posts: 3,084
grim_squeaker_x will become famous soon enough
Quote:
Originally posted by Thak2
Also freezeplayer will not react with warps, so hopefully your use of it will not involve multiple levels.
Actualy there is the: "disabledefmovement;" command, works as freezeplayer only it allows levle linkage, you do need to disable it with "enabledefmovement" later though.
__________________

Reply With Quote
  #5  
Old 03-25-2001, 11:07 AM
Thak2 Thak2 is offline
:]
Join Date: Mar 2001
Location: BC
Posts: 1,344
Thak2 is on a distinguished road
Send a message via AIM to Thak2
yes I knew of that, but that can only be used for P2P servers.

Last edited by Thak2; 03-25-2001 at 11:09 AM..
Reply With Quote
  #6  
Old 03-25-2001, 06:43 PM
grim_squeaker_x grim_squeaker_x is offline
Retired Oldbie
grim_squeaker_x's Avatar
Join Date: Mar 2001
Posts: 3,084
grim_squeaker_x will become famous soon enough
Yup.

So it's only posible in pay servers right now, except if I can do some research myself... So nblah I'll spend some time digging out .graal files to see if I can find a way of deciphering warps into variables.
__________________

Reply With Quote
  #7  
Old 03-26-2001, 01:12 PM
LordIceDragon LordIceDragon is offline
Registered User
Join Date: Mar 2001
Posts: 9
LordIceDragon is on a distinguished road
Question

thanks but
SAY WHAT!?!?!?
i have been programing on graal since it's release and well i got kinda cunfused ever since thisspeed came out(kinda dumb aint i) but easily put i just do:
if (playerenters) {toweapons -Bomy}
if (hasweapon(-Bomy)) {sethead Bomy_visio6.png;
disabledefmovement;
setani Bomy_idle,;}
if ( if (keydown(0)) {
y-=0.5;
dir = 0;
}
if (keydown(1)) {
x-=0.5;
dir = 1;
}
if (keydown(2)) {
y+=0.5;
dir = 2;
}
if (keydown(3)) {
x+=0.5;
dir = 3;
}
setani Bomy_walk,;
}




is that how a basic (very very basic) bomy
just the walking part right?
__________________
Where there is darkness there is light...
Reply With Quote
  #8  
Old 03-26-2001, 07:46 PM
grim_squeaker_x grim_squeaker_x is offline
Retired Oldbie
grim_squeaker_x's Avatar
Join Date: Mar 2001
Posts: 3,084
grim_squeaker_x will become famous soon enough
Quote:
Originally posted by LordIceDragon
thanks but
SAY WHAT!?!?!?
i have been programing on graal since it's release and well i got kinda cunfused ever since thisspeed came out(kinda dumb aint i) but easily put i just do:
if (playerenters) {toweapons -Bomy}
if (hasweapon(-Bomy)) {sethead Bomy_visio6.png;
disabledefmovement;
setani Bomy_idle,;}
if ( if (keydown(0)) {
y-=0.5;
dir = 0;
}
if (keydown(1)) {
x-=0.5;
dir = 1;
}
if (keydown(2)) {
y+=0.5;
dir = 2;
}
if (keydown(3)) {
x+=0.5;
dir = 3;
}
setani Bomy_walk,;
}




is that how a basic (very very basic) bomy
just the walking part right?
Almost...
For the keydown part you'll need to use:
if (timeout||created) {
[keydownstuffhere]
timeout=0.05;
}

Otherwise it won't work.
__________________

Reply With Quote
  #9  
Old 03-27-2001, 07:22 AM
kyle0654 kyle0654 is offline
-. .`
kyle0654's Avatar
Join Date: Mar 2001
Posts: 1,000
kyle0654 will become famous soon enough
Actually....I think the keydown stuff (checking if keys are down) took three lines...then most of it was mathematical based on what keys were down...

Hint: Use an Array
NPC Code:

if (created) {
this.cKeyDown = {0,0,0,0,0,0,0,0,0,0,0};
timeout = .05;
}
if (timeout) {
for (this.z = 0; this.z < 11; this.z++)
this.cKeyDown[this.z] = (keydown(this.z));
}



You could also have it store how long a key has been down...
Reply With Quote
  #10  
Old 03-27-2001, 08:11 AM
LordIceDragon LordIceDragon is offline
Registered User
Join Date: Mar 2001
Posts: 9
LordIceDragon is on a distinguished road
Red face

ok so...
if (timeout||created) {
if (playerenters) {toweapons -Bomy}
if (hasweapon(-Bomy)) {sethead Bomy_visio6.png;
disabledefmovement;
setani Bomy_idle,;}
if ( if (keydown(0)) {
y-=0.5;
dir = 0;
}
if (keydown(1)) {
x-=0.5;
dir = 1;
}
if (keydown(2)) {
y+=0.5;
dir = 2;
}
if (keydown(3)) {
x+=0.5;
dir = 3;
}
setani Bomy_walk,;
}
if (playerisdead){
setani bomy_dead,;
timeout=0.05;
}
__________________
Where there is darkness there is light...
Reply With Quote
  #11  
Old 03-27-2001, 12:28 PM
LordIceDragon LordIceDragon is offline
Registered User
Join Date: Mar 2001
Posts: 9
LordIceDragon is on a distinguished road
Angry

Darn it that doesnt work either
GRR...EVER SINCE THISSPEED CAME OUT I CANT MAKE ANYTHING!!!
__________________
Where there is darkness there is light...
Reply With Quote
  #12  
Old 03-27-2001, 07:39 PM
Thak2 Thak2 is offline
:]
Join Date: Mar 2001
Location: BC
Posts: 1,344
Thak2 is on a distinguished road
Send a message via AIM to Thak2
Ok, here is my version of the bomy script... I made it awhile back but stopped working on it when I discovered non-p2p servers cant use bomy stuff or complex ganis, Ill continue working on it later, and refine the onwall so it is the same as a humans/normal bomies.
NPC Code:

// NPC made by Thak
if (playerhearts = playerfullhearts&&!notbomy)
{callweapon selectedweapon, weaponfired;
}
if (playerenters) {
}
if (playertouchsme) {toweapons bomy;
}
if (weaponfired) {sethead bomy_birce0.png;
setani bomy_idle,;
disabledefmovement;
unset notbomy;
timeout=0.05;}
if (playersays(bomy1)) {sethead bomy_birce0.png;}
if (playersays(bomy2)) {sethead bomy_herm0.png;}
if (playersays(bomy3)) {sethead bomy_golg0.png;}
if (playersays(bomy4)) {sethead bomy_draktha0.png;}
if (timeout) {setani bomy_walk,;
playery-=0;
timeout=0.05;
}
if (timeout&&keydown(2)&&!bomyduck) {playery+=0.7;
playerdir=2;
setani bomy_walk,;
timeout=0.05;
}

if (timeout&&keydown(3)&&!bomyduck) {playerx+=0.7;
playerdir=3;
setani bomy_walk,;
timeout=0.05;
}

if (timeout&&keydown(0)&&!bomyduck) {playery-=0.7;
playerdir=0;
setani bomy_walk,;
timeout=0.05;
}

if (timeout&&keydown(1)&&!bomyduck) {playerx-=0.7;
playerdir=1;
setani bomy_walk,;
timeout=0.05;
}

if (timeout&&!keydown(1)&&!keydown(0)&&!keydown(2)&&! keydown(3))
{setani bomy_idle,;
timeout=0.05;
}

if (keydown(2)&&timeout&&onwall(playerx+1.5,playery+2 .4)) {
playery-=0.3;
sleep 0.05;
playery-=0.3;
sleep 0.05;
playery-=0.3;
timeout=0.05;
}

if (keydown(0)&&timeout&&onwall(playerx+1.5,playery+0 .4)) {
playery+=0.3;
sleep 0.05;
playery+=0.3;
sleep 0.05;
playery+=0.3;
timeout=0.05;
}

if (keydown(1)&&timeout&&onwall(playerx+0.2,playery+1 .1)) {
playerx+=0.25;
sleep 0.05;
playerx+=0.25;
sleep 0.05;
playerx+=0.25;
timeout=0.05;
}
if (keydown(3)&&timeout&&onwall(playerx+2.7,playery+1 .1)) {
playerx-=0.25;
sleep 0.05;
playerx-=0.25;
sleep 0.05;
playerx-=0.25;
timeout=0.05;
}
if (keydown(3)&&timeout&&onwall(playerx+2.7,playery+2 .4)) {
playerx-=0.25;
sleep 0.05;
playerx-=0.25;
sleep 0.05;
playerx-=0.25;
timeout=0.05;
}
if (keydown(1)&&timeout&&onwall(playerx+0.2,playery+2 .4)) {
playerx+=0.25;
sleep 0.05;
playerx+=0.25;
sleep 0.05;
playerx+=0.25;
timeout=0.05;
}
if (timeout&&keydown(5)&&!keydown(1)&&!keydown(0)&&!k eydown(2)&&!keydown(3)&&!bomyduck)
{setani bomy_duck,;
sleep 0.5;
set bomyduck;
timeout=0.05;}
if (bomyduck&&timeout) {
setani bomy_hide,;
timeout = 0.05;
}
if (!keydown(5)) {
unset bomyduck;
}
if (playerhearts<=0&&timeout) {
setani bomy_dead,;
}

if (playersays(off)) {sethead head41.gif;
setani idle,;
timeout=0;
freezeplayer=0;
enabledefmovement;
set notbomy;
}


There may be stuff I was fooling around with in there too that doesnt work, but it has been tested online and works pretty good.
Reply With Quote
  #13  
Old 03-27-2001, 07:56 PM
grim_squeaker_x grim_squeaker_x is offline
Retired Oldbie
grim_squeaker_x's Avatar
Join Date: Mar 2001
Posts: 3,084
grim_squeaker_x will become famous soon enough
Quote:
Originally posted by kyle0654
Actually....I think the keydown stuff (checking if keys are down) took three lines...then most of it was mathematical based on what keys were down...

Hint: Use an Array
NPC Code:

if (created) {
this.cKeyDown = {0,0,0,0,0,0,0,0,0,0,0};
timeout = .05;
}
if (timeout) {
for (this.z = 0; this.z < 11; this.z++)
this.cKeyDown[this.z] = (keydown(this.z));
}



You could also have it store how long a key has been down...
Hmm, thanks for that script I can probably use it to reduce the amountof scripting I have now in some cases.
__________________

Reply With Quote
  #14  
Old 03-28-2001, 07:18 PM
grim_squeaker_x grim_squeaker_x is offline
Retired Oldbie
grim_squeaker_x's Avatar
Join Date: Mar 2001
Posts: 3,084
grim_squeaker_x will become famous soon enough
Re: Buhaha

Quote:
Originally posted by Gspeed2000
Looks like someones forgetting the dreadfull onwall detection
Blah, that was example scripting GodSpeed
__________________

Reply With Quote
  #15  
Old 03-29-2001, 01:40 PM
Komieko Komieko is offline
Registered User
Join Date: Mar 2001
Posts: 494
Komieko is on a distinguished road
This is my version..I got alot of problems with it sucha s walking (it sets it to the first animation of bomy_walk each time so it doesn't play full)on horses same and water I got no clue about....Can anyone help with the walking thing?
Quote:
if (playertouchsme) {
sethead bomy_birce0.png;
setani bomy_idle,;
timeout=.05}

if (timeout){

setani bomy_idle,;

if (keydown(0)||keydown(1)||keydown(2)||keydown(3))
{setani bomy_walk,};

timeout=.05}
if (playerdies) {setani bomy_dead,;}
if (playeronhorse){setani bomy_ride,};
if (keydown(5)){setani bomy_hide,; freezeplayer .1;}
if (keydown(6)){setani bomy_attack,; freezeplayer .1;}
Reply With Quote
  #16  
Old 03-29-2001, 08:19 PM
Thak2 Thak2 is offline
:]
Join Date: Mar 2001
Location: BC
Posts: 1,344
Thak2 is on a distinguished road
Send a message via AIM to Thak2
To make it work good and be fluid you are going to have to disabledefmovement and set your own movement... I dont see any other way for yours to function accuratly.
Reply With Quote
  #17  
Old 03-30-2001, 01:10 AM
Komieko Komieko is offline
Registered User
Join Date: Mar 2001
Posts: 494
Komieko is on a distinguished road
um...*runs*

So what does disabledfmovemnt do?LikeI tried ur script and I was invis and if it actually showed the bomy (like once) it was flashing alot..
Reply With Quote
  #18  
Old 03-30-2001, 01:32 AM
Komieko Komieko is offline
Registered User
Join Date: Mar 2001
Posts: 494
Komieko is on a distinguished road
Question example?

Could someone give me an example f making the feet move when the arrow key is pushed?It'd help me out beccause I got no clue where to really start with the feet movement..Except I do got new main bomy script but I ain't no l33t scripter and some of it is just damn confusing!TOO many numbers!@_@

Last edited by Komieko; 03-30-2001 at 01:48 AM..
Reply With Quote
  #19  
Old 03-30-2001, 06:09 AM
Thak2 Thak2 is offline
:]
Join Date: Mar 2001
Location: BC
Posts: 1,344
Thak2 is on a distinguished road
Send a message via AIM to Thak2
Ok, first for the keydown to work best with what you want to do you would either have to freeze the player or disable default movement (animations).

You could make a full functioning script of it with freezeplayer except that freezeplayer makes it so the player doesnt detect anything such as warps...
so disabledefmovement must be used, as it turns off the default animations and movement.

With that set use something like this as an example of one movement:
NPC Code:

if (timeout && keydown(0)) {
playerdir=0;
playery -= 0.5;
setani bomy_walk,;
timeout=0.05;
}


keydown 0 is up as you should know, and the player moves approximetly 0.5 tiles every timeout which is same as normal... just set your beginning code which disablesdefmovement and sets the player head to a bomy head and a timeout, then add onwall code, and you have basic movement transformation script...

oh and what parts of my script didnt work? it should...
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 10:16 AM.


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