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 07-19-2002, 02:43 AM
Googi Googi is offline
A Serious Epidemic
Googi's Avatar
Join Date: Oct 2001
Location: Canada
Posts: 18,866
Googi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud of
Send a message via AIM to Googi
Question about with (getplayer)

Is it possible to use with (getplayer) to get a player who has a certain distance from the current player?

Like this...

NPC Code:

while (oncar) {
with (getplayer(playerx-1)){
hurt 2;
}
}

__________________
Reply With Quote
  #2  
Old 07-19-2002, 02:50 AM
GrowlZ1010 GrowlZ1010 is offline
defunct
Join Date: May 2002
Posts: 187
GrowlZ1010 is on a distinguished road
I presume you'd have to use testplayer to check the index of any nearby players, then use something similar to with(getplayer(#a(index))) to select the player for editing. But it should be possible, yes.
Reply With Quote
  #3  
Old 07-19-2002, 02:52 AM
Python523 Python523 is offline
Banned
Join Date: Aug 2001
Location: Illinois
Posts: 3,498
Python523 is on a distinguished road
use with(players[index])
it can get any player in the level the script is run in
Reply With Quote
  #4  
Old 07-19-2002, 10:40 AM
Googi Googi is offline
A Serious Epidemic
Googi's Avatar
Join Date: Oct 2001
Location: Canada
Posts: 18,866
Googi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud of
Send a message via AIM to Googi
Quote:
Originally posted by Python523
use with(players[index])
it can get any player in the level the script is run in
It can't be used to get a player who is has an x-co-ord of playerx+1 though XD
__________________
Reply With Quote
  #5  
Old 07-19-2002, 10:59 AM
Python523 Python523 is offline
Banned
Join Date: Aug 2001
Location: Illinois
Posts: 3,498
Python523 is on a distinguished road
Quote:
Originally posted by Googi


It can't be used to get a player who is has an x-co-ord of playerx+1 though XD
yes it can? it works like getplayer but with the index of a player in the level
Reply With Quote
  #6  
Old 07-19-2002, 11:01 PM
Googi Googi is offline
A Serious Epidemic
Googi's Avatar
Join Date: Oct 2001
Location: Canada
Posts: 18,866
Googi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud of
Send a message via AIM to Googi
Well for some reason I doubt this would work :-\

NPC Code:

with (players[i].x = playerx-1){
hurt 2;
}

__________________
Reply With Quote
  #7  
Old 07-20-2002, 12:50 AM
Python523 Python523 is offline
Banned
Join Date: Aug 2001
Location: Illinois
Posts: 3,498
Python523 is on a distinguished road
Quote:
Originally posted by Googi
Well for some reason I doubt this would work :-\

NPC Code:

with (players[i].x = playerx-1){
hurt 2;
}

because you have a completelly wrong syntax? getplayer doesnt work like that either, just go through all the players using a for loop and make it so if their x is in a certain part, it continues with with the script
Reply With Quote
  #8  
Old 07-20-2002, 02:51 AM
Googi Googi is offline
A Serious Epidemic
Googi's Avatar
Join Date: Oct 2001
Location: Canada
Posts: 18,866
Googi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud of
Send a message via AIM to Googi
XD, I did get it, but it turns out that it doesn't do what I thought it would.

What about a way to execute a command when two players touch eachother.
__________________
Reply With Quote
  #9  
Old 07-20-2002, 03:31 AM
CheeToS2 CheeToS2 is offline
That Guy
CheeToS2's Avatar
Join Date: Dec 2001
Location: Seattle, WA
Posts: 2,528
CheeToS2 will become famous soon enough
Send a message via AIM to CheeToS2
googi, use testplayer (i think thats what it is called) to get the index.

format is testplayer(x,y)
it returns the index # of the player at those coordinates
__________________

Reply With Quote
  #10  
Old 07-20-2002, 05:29 AM
Googi Googi is offline
A Serious Epidemic
Googi's Avatar
Join Date: Oct 2001
Location: Canada
Posts: 18,866
Googi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud of
Send a message via AIM to Googi
Quote:
Originally posted by CheeToS2
googi, use testplayer (i think thats what it is called) to get the index.

format is testplayer(x,y)
it returns the index # of the player at those coordinates
Okay, but how do I find out the index number and put it into my script.

XD, for some reason I neglected to learn about indexs.

Any good tutorials about indexs?
__________________
Reply With Quote
  #11  
Old 07-20-2002, 09:57 PM
Googi Googi is offline
A Serious Epidemic
Googi's Avatar
Join Date: Oct 2001
Location: Canada
Posts: 18,866
Googi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud of
Send a message via AIM to Googi
Quote:
Originally posted by Kaimetsu
Testplayer is a bad idea. And the plural for 'index' is 'indices'.
Okay, where can I learn about indices then?
__________________
Reply With Quote
  #12  
Old 07-21-2002, 01:20 AM
Googi Googi is offline
A Serious Epidemic
Googi's Avatar
Join Date: Oct 2001
Location: Canada
Posts: 18,866
Googi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud of
Send a message via AIM to Googi
Quote:
Originally posted by Kaimetsu


commands.rtf
Thanks

Okay, now I know what I'm doing (I hope XD)

But how do I get the index without using testplayer (Since you say it is a bad idea)
__________________
Reply With Quote
  #13  
Old 07-21-2002, 01:22 AM
Python523 Python523 is offline
Banned
Join Date: Aug 2001
Location: Illinois
Posts: 3,498
Python523 is on a distinguished road
if you want to go through the players in a level, run a for loop
for(i=0;i<playerscount;i++){
with(players[i]){
//stuff
}
}
Reply With Quote
  #14  
Old 07-21-2002, 02:55 AM
Googi Googi is offline
A Serious Epidemic
Googi's Avatar
Join Date: Oct 2001
Location: Canada
Posts: 18,866
Googi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud of
Send a message via AIM to Googi
NPC Code:

for (i=0;i<playerscount;i++){
with (players[playerx-1]){
hurt 2;
}
}



Once again I doubt that will work.
__________________
Reply With Quote
  #15  
Old 07-21-2002, 03:22 AM
Googi Googi is offline
A Serious Epidemic
Googi's Avatar
Join Date: Oct 2001
Location: Canada
Posts: 18,866
Googi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud of
Send a message via AIM to Googi
Quote:
Originally posted by Kaimetsu
Grim Squeaker:

*Zaps*
Try checking if the player is in the area you want him to be, then do the with, silly.
Kai said using testplayer was a bad idea though.
__________________
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 02:07 PM.


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