Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 02-15-2002, 11:00 AM
lordhelmut lordhelmut is offline
Registered User
lordhelmut's Avatar
Join Date: Aug 2001
Posts: 710
lordhelmut is on a distinguished road
Send a message via ICQ to lordhelmut Send a message via AIM to lordhelmut Send a message via Yahoo to lordhelmut
2 Questions

One is...Say I wanted to script a gun or something. What would be the best way to do the bullets? also...Can someone explain how to use the board command
__________________

Check out the development at:
http://razza.org/lordhelmut/FantasyTales/index
Reply With Quote
  #2  
Old 02-15-2002, 11:23 AM
Androk2k1 Androk2k1 is offline
Banned
Androk2k1's Avatar
Join Date: Dec 2001
Posts: 1,336
Androk2k1 is on a distinguished road
1. I guess you could either use putnpc or showimg, I am not sure which one is better, but I would use... showimg, it's less trouble and all scripting is withing one NPC...

2. I dunno...
Reply With Quote
  #3  
Old 02-15-2002, 12:04 PM
lordhelmut lordhelmut is offline
Registered User
lordhelmut's Avatar
Join Date: Aug 2001
Posts: 710
lordhelmut is on a distinguished road
Send a message via ICQ to lordhelmut Send a message via AIM to lordhelmut Send a message via Yahoo to lordhelmut
no way am i using putnpc, maybe arrays to keep track of showimg accept i dont know how to use arrays in graal
__________________

Check out the development at:
http://razza.org/lordhelmut/FantasyTales/index
Reply With Quote
  #4  
Old 02-15-2002, 01:52 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
I would use arrays.
array example:
NPC Code:

// to make an array do this:
// setarray arrayname,size;
// as in this example:
setarray this.values,10;
/*
to set values in an array do this:
arrayname[indexnumber] = value;
the first index in every array is 0.
so if you have an array that you set to size 100
than its 0-99.
as in this example:
*/
this.values[0] = 1;
this.values[9] = 5;
/*
that is the hard way to do it though,
this is easier:
*/
this.values = {1,0,0,0,1,2,3};
/*
that will set an array with 7 values (0-6)
and can be called as so:
*/
this.newnumber = this.values[5];
/*
Meaning that this.newnumber would equal 2
*/
Mostly with big arrays you put them thru a for loop,
like in this rain example:
*/
// Rain script:
if (created) {
setarray this.rainx,100;
setarray this.rainy,100;
for (i=0;i<arraylen(this.rainx);i++;) {
/* arraylen(arrayname) <-- gives you the amount of indexes in the array.*/
this.rainx[i] = random(0,64);
this.rainy[i] = random(0,64);
}
}
if (playerenters||timeout) {
for (i=0;i<arraylen(this.rainx);i++;) {
// Shows rain:
showimg i+500,@.,this.rainx[i],this.rainy;
// Puts the rain above the player:
changeimgvis i+500,3;
// If the rain reaches the end of the screen it will repeat:
this.rainx[i]+=(this.rainx[i]>64 ? -64 : 0);
this.rainy[i]+=(this.rainy[i]>64 ? -64 : 0);
/*
if this:
this.rainx[i]+=(this.rainx[i]>64 ? -64 : 0);
looks weird, what it is, is a condition, if you look, the syntax is this:
(condition ? a : b)
if the condition is true than it goes to a otherwise it goes to b.
If it doesn't make sence im me we can talk about it.
*/
}
timeout=.05;
}


hope I typed that right and I also hope it helps.
__________________

!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 02-15-2002, 02:52 PM
neomaximus2k neomaximus2k is offline
Registered User
Join Date: Feb 2002
Location: UK
Posts: 324
neomaximus2k is on a distinguished road
Send a message via ICQ to neomaximus2k
Quote:
Originally posted by Saga2001
I would use arrays.
array example:
NPC Code:

// to make an array do this:
// setarray arrayname,size;
// as in this example:
setarray this.values,10;
/*
to set values in an array do this:
arrayname[indexnumber] = value;
the first index in every array is 0.
so if you have an array that you set to size 100
than its 0-99.
as in this example:
*/
this.values[0] = 1;
this.values[9] = 5;
/*
that is the hard way to do it though,
this is easier:
*/
this.values = {1,0,0,0,1,2,3};
/*
that will set an array with 7 values (0-6)
and can be called as so:
*/
this.newnumber = this.values[5];
/*
Meaning that this.newnumber would equal 2
*/
Mostly with big arrays you put them thru a for loop,
like in this rain example:
*/
// Rain script:
if (created) {
setarray this.rainx,100;
setarray this.rainy,100;
for (i=0;i<arraylen(this.rainx);i++ {
/* arraylen(arrayname) <-- gives you the amount of indexes in the array.*/
this.rainx[i] = random(0,64);
this.rainy[i] = random(0,64);
}
}
if (playerenters||timeout) {
for (i=0;i<arraylen(this.rainx);i++ {
// Shows rain:
showimg i+500,@.,this.rainx[i],this.rainy;
// Puts the rain above the player:
changeimgvis i+500,3;
// If the rain reaches the end of the screen it will repeat:
this.rainx[i]+=(this.rainx[i]>64 ? -64 : 0);
this.rainy[i]+=(this.rainy[i]>64 ? -64 : 0);
/*
if this:
this.rainx[i]+=(this.rainx[i]>64 ? -64 : 0);
looks weird, what it is, is a condition, if you look, the syntax is this:
(condition ? a : b)
if the condition is true than it goes to a otherwise it goes to b.
If it doesn't make sence im me we can talk about it.
*/
}
timeout=.05;
}


hope I typed that right and I also hope it helps.

*ZOOOOOOOOOM OVER MY HEAD*
__________________
Beware of thy Inner self
NPC Code:

_.,.__
((o\\o\))
.-. ` \\``
__( )___.o"".,___
=== ~~~~~~~~
==
= Neo

Reply With Quote
  #6  
Old 02-15-2002, 04:52 PM
Ultima_P2P Ultima_P2P is offline
Registered User
Join Date: Dec 2001
Location: On Your Doorstep
Posts: 168
Ultima_P2P is on a distinguished road
Send a message via AIM to Ultima_P2P
Quote:
Originally posted by neomaximus2k



*ZOOOOOOOOOM OVER MY HEAD*
Yeah, me too
__________________

- ¤*U£†îmå*¤

Forever in my hands
I hold the sword...
Reply With Quote
  #7  
Old 02-15-2002, 04:56 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
Really? :-/ im me (PastAustin) and I can explain it better.
__________________

!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
  #8  
Old 02-15-2002, 06:56 PM
lordhelmut lordhelmut is offline
Registered User
lordhelmut's Avatar
Join Date: Aug 2001
Posts: 710
lordhelmut is on a distinguished road
Send a message via ICQ to lordhelmut Send a message via AIM to lordhelmut Send a message via Yahoo to lordhelmut
forget second part, Supersonic is teaching me
__________________

Check out the development at:
http://razza.org/lordhelmut/FantasyTales/index
Reply With Quote
  #9  
Old 02-15-2002, 07:43 PM
Guest
Posts: n/a
if (playertouchsme) {
setstring Ammo,15;
toweapons name;
}

if (weaponfired) {
i = strtofloat(#s(Ammo)) - 1;
play fire.wav;
if (i == 0) {
setstring Ammo,;
destroy;
}
setstring Ammo,#v(i);
}


If you where smart, you would look on the npc scripting page first ;/

http://www.graal2001.com/levelsnpc/npc-guide.php
Reply With Quote
  #10  
Old 02-15-2002, 07:55 PM
TDK_RC6 TDK_RC6 is offline
Registered User
TDK_RC6's Avatar
Join Date: Jan 2002
Location: Earth
Posts: 0
TDK_RC6 is on a distinguished road
the new varialble tile[x,y] is a lot better
__________________
Staff on Renegade


email: [email protected]
aim: papivicente
Reply With Quote
  #11  
Old 02-15-2002, 08:24 PM
TDK_RC6 TDK_RC6 is offline
Registered User
TDK_RC6's Avatar
Join Date: Jan 2002
Location: Earth
Posts: 0
TDK_RC6 is on a distinguished road
Quote:
Originally posted by Kaimetsu


And if you were smart, you wouldn't have typed "where".

Besides, your code doesn't deal with the actual handling of the fired bullets in the slightest. It just decrements an ammo count.
silly kai
__________________
Staff on Renegade


email: [email protected]
aim: papivicente
Reply With Quote
  #12  
Old 02-15-2002, 09:36 PM
TDK_RC6 TDK_RC6 is offline
Registered User
TDK_RC6's Avatar
Join Date: Jan 2002
Location: Earth
Posts: 0
TDK_RC6 is on a distinguished road
you are just funny
__________________
Staff on Renegade


email: [email protected]
aim: papivicente
Reply With Quote
  #13  
Old 02-15-2002, 09:49 PM
TDK_RC6 TDK_RC6 is offline
Registered User
TDK_RC6's Avatar
Join Date: Jan 2002
Location: Earth
Posts: 0
TDK_RC6 is on a distinguished road
Quote:
Originally posted by Kaimetsu


I'm wondering how to take that :-/
take it as a good thing
__________________
Staff on Renegade


email: [email protected]
aim: papivicente
Reply With Quote
  #14  
Old 02-16-2002, 02:09 AM
neomaximus2k neomaximus2k is offline
Registered User
Join Date: Feb 2002
Location: UK
Posts: 324
neomaximus2k is on a distinguished road
Send a message via ICQ to neomaximus2k
Quote:
Originally posted by TDK_RC6
the new varialble tile[x,y] is a lot better
how do you use the tile command, i never understood how to read a certain tile
(example snow)
__________________
Beware of thy Inner self
NPC Code:

_.,.__
((o\\o\))
.-. ` \\``
__( )___.o"".,___
=== ~~~~~~~~
==
= Neo

Reply With Quote
  #15  
Old 02-16-2002, 02:27 AM
TDK_RC6 TDK_RC6 is offline
Registered User
TDK_RC6's Avatar
Join Date: Jan 2002
Location: Earth
Posts: 0
TDK_RC6 is on a distinguished road
kai is totally right, not a command, its a variable

anways you use it to set the tile at x,y to a certain tile

NPC Code:

if (playerchats) {
tokenize #c;
if (strequals(#t(0),changetile)&&tokenscount==4) {
if (strtofloat(#t(1)) in |0,64|&&strtofloat(#t(2)) in |0,64|) {
tiles[strtofloat(#t(1)),strtofloat(#t(2))]=strtofloat(#t(3));
setplayerprop #c, ;
}
}
}

__________________
Staff on Renegade


email: [email protected]
aim: papivicente

Last edited by TDK_RC6; 02-16-2002 at 05:44 AM..
Reply With Quote
  #16  
Old 02-16-2002, 05:43 AM
TDK_RC6 TDK_RC6 is offline
Registered User
TDK_RC6's Avatar
Join Date: Jan 2002
Location: Earth
Posts: 0
TDK_RC6 is on a distinguished road
forgot to mention what you need to do to get this to work


just say changetile xcoordinate ycoordinate tilenumber
__________________
Staff on Renegade


email: [email protected]
aim: papivicente
Reply With Quote
  #17  
Old 02-16-2002, 05:27 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
Quote:
Originally posted by Kaimetsu
Board is not a command.
Board[]? where did that come from?

Quote:
Originally posted by TDK_RC6
forgot to mention what you need to do to get this to work


just say changetile xcoordinate ycoordinate tilenumber
yeah board[] is useless with changetile...
__________________

!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
  #18  
Old 02-16-2002, 06:22 PM
neomaximus2k neomaximus2k is offline
Registered User
Join Date: Feb 2002
Location: UK
Posts: 324
neomaximus2k is on a distinguished road
Send a message via ICQ to neomaximus2k
My question wasn't worded correctly.
ok say that i am on the sand. i want the player to move slower but if he was on grass he would move normally.
now how would i get it to check when he is on sand and when he is on grass
__________________
Beware of thy Inner self
NPC Code:

_.,.__
((o\\o\))
.-. ` \\``
__( )___.o"".,___
=== ~~~~~~~~
==
= Neo

Reply With Quote
  #19  
Old 02-16-2002, 07:35 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
purely because i haven't used tile i'll use board.
NPC Code:

while (true) {
this.tile = board[playerx+1.5+64*playery+2];
for(i=0;i<3;i++;) {
if (this.tile==511&&keydown(i)) {
playerx+=vecx(playerdir);
playery+=vecy(playerdir);
}
}
sleep .05;
}



thats just a rough draft, but kinda like that.
__________________

!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
  #20  
Old 02-16-2002, 08:25 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
Quote:
Originally posted by Kaimetsu


From here:
now i see, i guess i missed that...
__________________

!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
  #21  
Old 02-17-2002, 02:32 AM
neomaximus2k neomaximus2k is offline
Registered User
Join Date: Feb 2002
Location: UK
Posts: 324
neomaximus2k is on a distinguished road
Send a message via ICQ to neomaximus2k
Quote:
Originally posted by Kaimetsu


Neo, you need to take the tile at the point where the player is and check if its index is within the ranges that would make it a sand tile.
Yes however an example would have been nice. because again i have never scripted anything like this before and dont know where to get the tile values from, it may be somewhere stupid but i aint seen it
__________________
Beware of thy Inner self
NPC Code:

_.,.__
((o\\o\))
.-. ` \\``
__( )___.o"".,___
=== ~~~~~~~~
==
= Neo

Reply With Quote
  #22  
Old 02-17-2002, 06:27 PM
neomaximus2k neomaximus2k is offline
Registered User
Join Date: Feb 2002
Location: UK
Posts: 324
neomaximus2k is on a distinguished road
Send a message via ICQ to neomaximus2k
Quote:
Originally posted by Kaimetsu


Swoosh your pointer over the tileset in the editor and look at the coords on the status bar.
Oh now i get ya!!!!!!
thanks dude that has just made a lot of my scripts a lot easier now
__________________
Beware of thy Inner self
NPC Code:

_.,.__
((o\\o\))
.-. ` \\``
__( )___.o"".,___
=== ~~~~~~~~
==
= Neo

Reply With Quote
  #23  
Old 02-17-2002, 09:58 PM
TDK_RC6 TDK_RC6 is offline
Registered User
TDK_RC6's Avatar
Join Date: Jan 2002
Location: Earth
Posts: 0
TDK_RC6 is on a distinguished road
Quote:
Originally posted by neomaximus2k


Oh now i get ya!!!!!!
thanks dude that has just made a lot of my scripts a lot easier now
lol
__________________
Staff on Renegade


email: [email protected]
aim: papivicente
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 03:41 PM.


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