Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > Old Scripting Engine (GS1)
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 01-17-2006, 11:05 PM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
goggles

This is an NPC for Infrared goggles, half of the script isn't here (the part for setting the colors, because we have a day/night system that needs to be countered). Anyway, it kinda works, my only problems with it is that it counts some NPCs as players, not just npcs with showcharacter, but also random ones without showcharacter. Also, players can see the glow around themselves, even if they aren't using goggles. Any suggestions?
NPC Code:
//#CLIENTSIDE
if(weaponfired && this.inuse==0)
{
this.inuse=1;
setstring client.infgoggles,1;
setplayerprop #P1,dr-hat008.png;
}
else if(weaponfired && this.inuse==1)
{
this.inuse=0;
setstring client.infgoggles,0;
setplayerprop #P1,;
seteffect 0,0,0,0;
hideimg 914775;
for(this.i=0;this.i<playerscount;this.i++)
{
hideimg this.i;
hideimg this.i+1;
}
timeout=0;
}
if(this.inuse==1 || timeout)
{
for(this.i=0;this.i=<playerscount;this.i++)
{
setstring client.players,#v(this.i);
showtext 914775,550,10,Arial,b,Players:#s(client.players);
changeimgzoom 914775,.5;
changeimgvis 914775,5;
showimg this.i,ion.gif,players[strtofloat(#s(client.players))].x+.5,players[strtofloat(#s(client.players))].y+.75;
changeimgcolors this.i,1,.25,.25,.99;
changeimgzoom this.i,2;
changeimgvis this.i,1;
}
timeout=.05;
}

Attached Thumbnails
Click image for larger version

Name:	strangenpc.png
Views:	313
Size:	61.1 KB
ID:	34949  
Reply With Quote
  #2  
Old 01-17-2006, 11:45 PM
napo_p2p napo_p2p is offline
oh snaps
napo_p2p's Avatar
Join Date: Sep 2003
Location: Pismo Beach, California
Posts: 2,118
napo_p2p has a spectacular aura aboutnapo_p2p has a spectacular aura about
Send a message via AIM to napo_p2p Send a message via MSN to napo_p2p
To get rid of it showing NPCs, in the for loop try checking to make sure the player's ID is > -1 (since 'character' NPC ids are -1). You can accomplish this by using:
PHP Code:
if (players[this.i].id > -1
NOTE: On a GS2 enabled server (and with v4), I do not think that NPCs are included in the players array.

As for your problem with a player seeing the light around himself, I believe that the first person in the players array (clientside) is yourself. So start the for loops at 1 (NOTE: I am not certain about this, but try if you are willing ).

Also, it's probably best to have only one if (weaponfired) block. For example:
PHP Code:
if (weaponfired) {
   if (
this.inuse == 0) {
     
//Stuff
   
}
   else {
     
//Stuff
   
}

__________________
Scito hoc super omnia.
Haec vita est tua una sola.
Dum vita superest, utere maxime quoque puncto, momento, et hora quae habes.
Tempus neminem non manet.
Noli manere tempus.
Carpe Diem

Seize the Day.
Reply With Quote
  #3  
Old 01-18-2006, 12:07 AM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
Quote:
Originally Posted by napo_p2p
To get rid of it showing NPCs, in the for loop try checking to make sure the player's ID is > -1 (since 'character' NPC ids are -1). You can accomplish this by using:
PHP Code:
if (players[this.i].id > -1
NOTE: On a GS2 enabled server (and with v4), I do not think that NPCs are included in the players array.
We are gs2 enabled, but I'll try that
Quote:
As for your problem with a player seeing the light around himself, I believe that the first person in the players array (clientside) is yourself. So start the for loops at 1 (NOTE: I am not certain about this, but try if you are willing ).
Eh, that would just make it so I couldn't see myself glowing
Quote:

Also, it's probably best to have only one if (weaponfired) block.
Got screwed up with the timeout x_X

Last edited by excaliber7388; 01-18-2006 at 12:23 AM..
Reply With Quote
  #4  
Old 01-18-2006, 12:18 AM
napo_p2p napo_p2p is offline
oh snaps
napo_p2p's Avatar
Join Date: Sep 2003
Location: Pismo Beach, California
Posts: 2,118
napo_p2p has a spectacular aura aboutnapo_p2p has a spectacular aura about
Send a message via AIM to napo_p2p Send a message via MSN to napo_p2p
Quote:
Originally Posted by excaliber7388
Eh, that would just make it so I coulnd't see myself glowing...althought I'll try that too XD
Ahh I misunderstood what you meant. I thought you didn't want to show a glow around yourself.

But now I know what you mean. Use this.i + 300 (lower indexes are visible to all).
__________________
Scito hoc super omnia.
Haec vita est tua una sola.
Dum vita superest, utere maxime quoque puncto, momento, et hora quae habes.
Tempus neminem non manet.
Noli manere tempus.
Carpe Diem

Seize the Day.
Reply With Quote
  #5  
Old 01-18-2006, 12:25 AM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
Quote:
Originally Posted by napo_p2p
Ahh I misunderstood what you meant. I thought you didn't want to show a glow around yourself.

But now I know what you mean. Use this.i + 300 (lower indexes are visible to all).
But then that would be for a player with the index of 300? Also, when I try to add something in that accounts for the NPCs, I either get a ton of lag, or a negative number. this gets a negative #, but why?
NPC Code:
//#CLIENTSIDE
//stuff
if(this.inuse==1 || timeout)
{
for(this.i=0;this.i=<playerscount;this.i++)
{
setstring client.players,#v(this.i-this.n);
//stuff
else if(!players[strtofloat(#s(client.players))].id>-1 && this.i<playerscount)
{
this.n+=1;
}
//stuff
}


Last edited by excaliber7388; 01-18-2006 at 12:37 AM..
Reply With Quote
  #6  
Old 01-18-2006, 12:37 AM
napo_p2p napo_p2p is offline
oh snaps
napo_p2p's Avatar
Join Date: Sep 2003
Location: Pismo Beach, California
Posts: 2,118
napo_p2p has a spectacular aura aboutnapo_p2p has a spectacular aura about
Send a message via AIM to napo_p2p Send a message via MSN to napo_p2p
Quote:
Originally Posted by excaliber7388
But then that would be for a player with the index of 300?
I'm sorry, I should have been more specific:

NPC Code:
    showimg this.i + 300,ion.gif,players[strtofloat(#s(client.players))].x+.5,players[strtofloat(#s(client.players))].y+.75;

changeimgcolors this.i + 300,1,.25,.25,.99;

changeimgzoom this.i + 300,2;

changeimgvis this.i + 300,1;

__________________
Scito hoc super omnia.
Haec vita est tua una sola.
Dum vita superest, utere maxime quoque puncto, momento, et hora quae habes.
Tempus neminem non manet.
Noli manere tempus.
Carpe Diem

Seize the Day.
Reply With Quote
  #7  
Old 01-18-2006, 12:45 AM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
Thanks, but I still can't get it to stop counting NPCs without going negative, i havn't changed the script I last posted, so far it's the one that gets closest, without a ton of lag
Reply With Quote
  #8  
Old 01-18-2006, 02:14 AM
Yen Yen is offline
Banned
Yen's Avatar
Join Date: Oct 2005
Location: Nova Scotia, Canada
Posts: 1,085
Yen is an unknown quantity at this point
Send a message via AIM to Yen Send a message via MSN to Yen
players[this.i].darts

NPCs normally don't carry around darts.
Reply With Quote
  #9  
Old 01-18-2006, 02:41 AM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
huh? I don't need another thing to identify an NPC, the problem is, the weapon thinks that the NPC is included in playerscount, and therefore, it HAS to make this.i go up to that number, otherwise you have a never ending loop, with it being stuck at a number that may not be correct. I find that the NPC woeks in some levels, but not others, and the number is normally much higher than the actual number of NPCs in the level, (returning numbers like 600) what i need is for it to add 1 to a number each time it goes through the loop and finds an npc, then subtract that number from the playerscount (client.players) but when I try this, the loop becomes infinite, and the number becomes negative
Reply With Quote
  #10  
Old 01-18-2006, 02:42 AM
ZeLpH_MyStiK ZeLpH_MyStiK is offline
Scripter
ZeLpH_MyStiK's Avatar
Join Date: May 2003
Location: NYC
Posts: 553
ZeLpH_MyStiK is on a distinguished road
Send a message via MSN to ZeLpH_MyStiK Send a message via Yahoo to ZeLpH_MyStiK
have you actually seen infrared goggles? when you actually look into them, the image is green XD
__________________
Reply With Quote
  #11  
Old 01-18-2006, 02:45 AM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
yeah, i should have called these thermal goggles, i plan to change the name. Anyway, I already have typical night vision gogles, this is an alternative, as night vision can be messed up by bright lights, and obstructions, like thick smoke, etc. whereas, this has a light that shows where each player is...and the number of players in the level, if I can fix that without lag x_X otherwise, I'll have to take it out.

Last edited by excaliber7388; 01-18-2006 at 02:56 AM..
Reply With Quote
  #12  
Old 01-18-2006, 07:09 AM
Rick Rick is offline
PipBoy Extraordinaire!
Rick's Avatar
Join Date: Jul 2004
Location: Long Beach, California.
Posts: 831
Rick is on a distinguished road
PHP Code:
this.0;
for (
this.0this.=< playerscountthis.i++) {
  if (
players[this.i].id >= 0) {
    
showimg 300+this.j,ion.gif,players[this.i].x+.5,players[this.i].y+.75;
    
changeimgcolors 300+this.j,1,.25,.25,.99;
    
changeimgzoom 300+this.j,2;
    
changeimgvis 300+this.j,1;
    
this.j++;
  }

Reply With Quote
  #13  
Old 01-25-2006, 05:46 PM
Draenin Draenin is offline
Magnificent Bastard
Draenin's Avatar
Join Date: Dec 2004
Location: Bermuda Triangle
Posts: 6,790
Draenin has much to be proud ofDraenin has much to be proud ofDraenin has much to be proud ofDraenin has much to be proud ofDraenin has much to be proud ofDraenin has much to be proud of
Send a message via AIM to Draenin Send a message via MSN to Draenin Send a message via Yahoo to Draenin
My eyes! The goggles, they...
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:21 PM.


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