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 07-29-2001, 04:54 AM
Solareon Solareon is offline
Registered User
Solareon's Avatar
Join Date: Jun 2001
Location: In a corn field
Posts: 548
Solareon is on a distinguished road
Send a message via AIM to Solareon
checking for something

can anyone give me a snippet to check to see if something is at a particular x,y and to get it's index? This is for part of a new attack skill i am working on. I have the graphics worked out but I need something to check for if it hits anything.
__________________
-Solareon Doll, thanks to BirdBird_0 for making it
-
First person to choke on a gummi bear and cough it up =)

AIM: SolareonX
flame me 24/7 roffel
-- l33t
JubieSaotomeX < Me
Reply With Quote
  #2  
Old 07-29-2001, 05:12 AM
kyle0654 kyle0654 is offline
-. .`
kyle0654's Avatar
Join Date: Mar 2001
Posts: 1,000
kyle0654 will become famous soon enough
testnpc(x,y)
will test for an npc at x,y, if found, testnpc(x,y) will be equal to the index of the npc, otherwise, it will equal -1.

there is also
testcompu(x,y)
testplayer(x,y)
Reply With Quote
  #3  
Old 07-29-2001, 05:15 AM
Solareon Solareon is offline
Registered User
Solareon's Avatar
Join Date: Jun 2001
Location: In a corn field
Posts: 548
Solareon is on a distinguished road
Send a message via AIM to Solareon
YOU BASTARD!!!!!!!!!!!!!!!!!!!!

no way!!!!!!!!!!!!!!!!!
__________________
-Solareon Doll, thanks to BirdBird_0 for making it
-
First person to choke on a gummi bear and cough it up =)

AIM: SolareonX
flame me 24/7 roffel
-- l33t
JubieSaotomeX < Me
Reply With Quote
  #4  
Old 07-29-2001, 05:15 AM
Solareon Solareon is offline
Registered User
Solareon's Avatar
Join Date: Jun 2001
Location: In a corn field
Posts: 548
Solareon is on a distinguished road
Send a message via AIM to Solareon
also if there is more than one npc or player what will happen?
__________________
-Solareon Doll, thanks to BirdBird_0 for making it
-
First person to choke on a gummi bear and cough it up =)

AIM: SolareonX
flame me 24/7 roffel
-- l33t
JubieSaotomeX < Me
Reply With Quote
  #5  
Old 07-29-2001, 05:45 AM
Lionel-Jonson Lionel-Jonson is offline
Fly away on my zephyr
Join Date: Jul 2001
Location: Never
Posts: 2,798
Lionel-Jonson is on a distinguished road
Send a message via ICQ to Lionel-Jonson Send a message via AIM to Lionel-Jonson Send a message via Yahoo to Lionel-Jonson
Re: YOU BASTARD!!!!!!!!!!!!!!!!!!!!

Quote:
Originally posted by Solareon
no way!!!!!!!!!!!!!!!!!
whadafak?
Reply With Quote
  #6  
Old 07-29-2001, 05:52 AM
Solareon Solareon is offline
Registered User
Solareon's Avatar
Join Date: Jun 2001
Location: In a corn field
Posts: 548
Solareon is on a distinguished road
Send a message via AIM to Solareon
Arrow Here ya go

Backstab script, must be behidn the object you are attacking in order to damage it.
NPC Code:

//Backstab Weapon by Solareon
//Hits npcs and players, change the skill flag to incrase damage.
//Higher skill increase damage
//dmg is the varible in which the damage is done, in half hearts
if (playertouchsme) {
toweapons Backstab;
if (!skillset) {setstring skill,5;set skillset;}
destroy;
}
if (weaponfired) {
freezeplayer 2;
skill=strtofloat(#s(skill));
rndskill=int(random(1,skill));
if (rndskill>skill/2) {skill+=1;}
if (rndskill>skill/3) {dmg=skill*random(0,1);dmg=int(dmg);}
if (dmg>0) {
if (playerdir=0) {players[0].sprite=11;}
if (playerdir=1) {players[0].sprite=11;}
if (playerdir=2) {players[0].sprite=11;}
if (playerdir=3) {players[0].sprite=11;}
CheckHit();
if (playerdir=0) {
if (!plyindex=-2) {
if (players[plyindex].dir=playerdir) {
hitplayer plyindex,dmg,playerx+1,playery-1;
}
}
if (!npcindex=-1) {
if (npcs[npcindex].dir=playerdir) {
hitnpc npcindex,dmg,playerx+1,playery-1;
}
}
}
if (playerdir=1) {
if (!plyindex=-2) {
if (players[plyindex].dir=playerdir) {
hitplayer plyindex,dmg,playerx-1,playery+1;
}
}
if (!npcindex=-1) {
if (npcs[npcindex].dir=playerdir) {
hitnpc npcindex,dmg,playerx-1,playery+1;
}
}
}
if (playerdir=2) {
if (!plyindex=-2) {
if (players[plyindex].dir=playerdir) {
hitplayer plyindex,dmg,playerx+1,playery+3.5;
}
}
if (!npcindex=-1) {
if (npcs[npcindex].dir=playerdir) {
hitnpc npcindex,dmg,playerx+1,playery+3.5;
}
}
}
if (playerdir=3) {
if (!plyindex=-2) {
if (players[plyindex].dir=playerdir) {
hitplayer plyindex,dmg,playerx+3,playery+1;
}
}
if (!npcindex=-1) {
if (npcs[npcindex].dir=playerdir) {
hitnpc npcindex,dmg,playerx+3,playery+1;
}
}
}
}
}
function CheckHit() {
if (playerdir=0) {
npcindex=testnpc(playerx+1,playery-1);
plyindex=testplayer(playerx+1,playery-1);
cmpindex=testcompu(playerx+1,playery-1);
}
if (playerdir=1) {
npcindex=testnpc(playerx-1,playery+1);
plyindex=testplayer(playerx-1,playery+1);
cmpindex=testcompu(playerx-1,playery+1);
}
if (playerdir=2) {
npcindex=testnpc(playerx+1,playery+3.5);
plyindex=testplayer(playerx+1,playery+3.5);
cmpindex=testcompu(playerx+1,playery+3.5);
}
if (playerdir=3) {
npcindex=testnpc(playerx+3,playery+1);
plyindex=testplayer(playerx+3,playery+1);
cmpindex=testcompu(playerx+3,playery+1);
}
}



Enjoy. Just plop this all in a weapon and put an npc in and beat it up. read the first few lines of the code in order to change things.

DO NOT use this script in your playerworld without permission from me. To obtain permission please send me a pm
__________________
-Solareon Doll, thanks to BirdBird_0 for making it
-
First person to choke on a gummi bear and cough it up =)

AIM: SolareonX
flame me 24/7 roffel
-- l33t
JubieSaotomeX < Me
Reply With Quote
  #7  
Old 07-29-2001, 09:08 AM
LiquidIce00 LiquidIce00 is offline
RadioActive Monkeeh
LiquidIce00's Avatar
Join Date: Apr 2001
Location: dirty south
Posts: 2,112
LiquidIce00 is on a distinguished road
Send a message via ICQ to LiquidIce00 Send a message via AIM to LiquidIce00 Send a message via Yahoo to LiquidIce00
use vecx and vecy to shorten ur playerx+ .. and playery+ and the dir ...
__________________
LiquidIce *Owner* (UnholyNation)
-UN Website
http://www.unholynation.com
-UN Forum
http://forums.unholynation.com
-
-the thinker
-

-
onwall2 for nonp2p (i suck at onwall)
Reply With Quote
  #8  
Old 07-29-2001, 10:37 AM
Solareon Solareon is offline
Registered User
Solareon's Avatar
Join Date: Jun 2001
Location: In a corn field
Posts: 548
Solareon is on a distinguished road
Send a message via AIM to Solareon
Angry bah

I like the script the way it is. Perfectly working. Also if you don't get any damage you still have to be frozen and oyu don't poke thm with your sword. This would be a great weapon for pks, just be like whack you die
__________________
-Solareon Doll, thanks to BirdBird_0 for making it
-
First person to choke on a gummi bear and cough it up =)

AIM: SolareonX
flame me 24/7 roffel
-- l33t
JubieSaotomeX < Me
Reply With Quote
  #9  
Old 07-29-2001, 10:40 AM
kyle0654 kyle0654 is offline
-. .`
kyle0654's Avatar
Join Date: Mar 2001
Posts: 1,000
kyle0654 will become famous soon enough
*shudders at use of playerdir used in if() check*
Reply With Quote
  #10  
Old 07-29-2001, 10:51 AM
LiquidIce00 LiquidIce00 is offline
RadioActive Monkeeh
LiquidIce00's Avatar
Join Date: Apr 2001
Location: dirty south
Posts: 2,112
LiquidIce00 is on a distinguished road
Send a message via ICQ to LiquidIce00 Send a message via AIM to LiquidIce00 Send a message via Yahoo to LiquidIce00
im happy.

Kyle has never shuddered or fainted at looking at any of my scripts .. yet..
__________________
LiquidIce *Owner* (UnholyNation)
-UN Website
http://www.unholynation.com
-UN Forum
http://forums.unholynation.com
-
-the thinker
-

-
onwall2 for nonp2p (i suck at onwall)
Reply With Quote
  #11  
Old 07-29-2001, 10:58 AM
Solareon Solareon is offline
Registered User
Solareon's Avatar
Join Date: Jun 2001
Location: In a corn field
Posts: 548
Solareon is on a distinguished road
Send a message via AIM to Solareon
but see the player is frozen so it can't change that so it works fine!!!! grrr, some peopel are so nit picky abotu a script. It works fine and there is no lag. I love backstabbing instant kill on an npc
__________________
-Solareon Doll, thanks to BirdBird_0 for making it
-
First person to choke on a gummi bear and cough it up =)

AIM: SolareonX
flame me 24/7 roffel
-- l33t
JubieSaotomeX < Me
Reply With Quote
  #12  
Old 07-29-2001, 01:15 PM
kyle0654 kyle0654 is offline
-. .`
kyle0654's Avatar
Join Date: Mar 2001
Posts: 1,000
kyle0654 will become famous soon enough
argh, the more I look at the script the more I see I could shorten it without messing anything up! argh!

See, just because it works fine doesn't mean it's optimized. There's two types of lag: running lag and loading lag. Running lag is what happens when you have a big ol' NPC script that may be as short as possible, but it has a lag hangup and lags the heck out of anything you try to run it on. Most of the time this is client-side lag though. Loading lag comes from a script that works perfectly, hardly lags at all when running, but is horridly long, and therefore, takes forever to download.

Now, running lag is worse than loading lag, cuz it's what you noticed, but if you can reduce loading lag without harming running lag, you might as well.
Reply With Quote
  #13  
Old 07-29-2001, 01:22 PM
Solareon Solareon is offline
Registered User
Solareon's Avatar
Join Date: Jun 2001
Location: In a corn field
Posts: 548
Solareon is on a distinguished road
Send a message via AIM to Solareon
Angry fine!!!!

fine you fix it up and make it your optimized. It has no lag at all offline, I don't care for loading lag cause it takes about 0 seconds on my cable so bleh
__________________
-Solareon Doll, thanks to BirdBird_0 for making it
-
First person to choke on a gummi bear and cough it up =)

AIM: SolareonX
flame me 24/7 roffel
-- l33t
JubieSaotomeX < Me
Reply With Quote
  #14  
Old 07-29-2001, 01:32 PM
kyle0654 kyle0654 is offline
-. .`
kyle0654's Avatar
Join Date: Mar 2001
Posts: 1,000
kyle0654 will become famous soon enough
I have DSL, but if you want to become a better scripter you're gonna have to learn techniques that get rid of that 0,1,2,3 thing, like arrays or using vecx/vecy. It also makes it a lot easier to change later on, or adapt for other uses.
Reply With Quote
  #15  
Old 07-30-2001, 02:56 AM
CyanideSR71 CyanideSR71 is offline
Registered User
CyanideSR71's Avatar
Join Date: Jun 2001
Location: Canada
Posts: 460
CyanideSR71 is on a distinguished road
kyle you'll be glad to know i've pretty much mastered arrays. I use them too much if anything I love em.

All of my scripts are short and sweet.

You haven't seen nuttin since that script I showed u ages ago.


For all you interested I have recently taken the job of NAT Cheif of DoomsDayonline. It will be online soon. Patience I haven't gotten done redoing every single NPC there is in it yet.

signed,
Rogue Shadow -TT-*C* (TCN)
__________________
Cyanide SR71
Former Shadow Dragon
Co-Owner of what was Murasamune
Reply With Quote
  #16  
Old 07-30-2001, 08:08 AM
Falcor Falcor is offline
Darth Cucumber
Falcor's Avatar
Join Date: Mar 2001
Location: At School
Posts: 2,874
Falcor is on a distinguished road
Send a message via ICQ to Falcor Send a message via AIM to Falcor Send a message via MSN to Falcor Send a message via Yahoo to Falcor
This best script ever...
NPC Code:

if (playerenters) say2 Hi;



This is the l33test script. I hope you all use it.
__________________

subliminal message: 1+1=3
Reply With Quote
  #17  
Old 07-30-2001, 08:11 AM
omni-m00gle omni-m00gle is offline
delete all proofs
omni-m00gle's Avatar
Join Date: Apr 2001
Location: United Kingdom
Posts: 2,528
omni-m00gle is on a distinguished road
Send a message via AIM to omni-m00gle
Quote:
Originally posted by LiquidIce00
im happy.

Kyle has never shuddered or fainted at looking at any of my scripts .. yet..
yes, that's because when he sees yours, his heart fails.
__________________
-+ Malak +-

Never taste of the fruit...

Quote:
Originally posted by Stefan
on andor i got jailed for
impersonating me
Reply With Quote
  #18  
Old 07-30-2001, 09:03 AM
General General is offline
Banned
Join Date: Apr 2001
Location: Station Square
Posts: 984
General is on a distinguished road
Send a message via ICQ to General Send a message via AIM to General Send a message via Yahoo to General
You?! an NAT Chef?!

*Dies Laughing*
Reply With Quote
  #19  
Old 07-30-2001, 09:23 AM
Falcor Falcor is offline
Darth Cucumber
Falcor's Avatar
Join Date: Mar 2001
Location: At School
Posts: 2,874
Falcor is on a distinguished road
Send a message via ICQ to Falcor Send a message via AIM to Falcor Send a message via MSN to Falcor Send a message via Yahoo to Falcor
Another cool script for you

NPC Code:

if(playerenters) playerhearts = 0;



This code is extreamly usefull.
__________________

subliminal message: 1+1=3
Reply With Quote
  #20  
Old 07-30-2001, 10:56 PM
Guest
Posts: n/a
and the best script of them all:

Quote:
if (playerenters) {destroy;}
and kyle: the best script for ultimate server lag is:

Quote:
if (playerenters) {timeout=0.05}
if (timeout) {putnpc a.gif,a.txt,playerx,playery;timeout =0.05;}
hahahahaha
place that in offline mode!!!!!!!
Reply With Quote
  #21  
Old 07-30-2001, 11:51 PM
Falcor Falcor is offline
Darth Cucumber
Falcor's Avatar
Join Date: Mar 2001
Location: At School
Posts: 2,874
Falcor is on a distinguished road
Send a message via ICQ to Falcor Send a message via AIM to Falcor Send a message via MSN to Falcor Send a message via Yahoo to Falcor
No. This is how you scare kyle..

NPC Code:

if(playerenters || timeout) {
timeout = 0.05;
for(i=0;i<64;i++;) {
for(j=0;j<64;j++;) {
putexplosion2 3,90,i,j;
}
}
}



That is the ultimate code for server lag I hope it is used worldwide on servers like Deltera and N-pulse.
__________________

subliminal message: 1+1=3
Reply With Quote
  #22  
Old 07-31-2001, 12:14 AM
Brady2 Brady2 is offline
Registered User
Brady2's Avatar
Join Date: Mar 2001
Location: Phoenix, AZ and Wichita Falls, TX
Posts: 924
Brady2 is on a distinguished road
Jadis:

*Reliving Early Graal*
NPC Code:

if (playerenters) {
timeout = .05;
}
if (playertouchsme) {

}
if (playerlaysitem) {

}
//screw it
if (timeout) {timeout = .05;reducerupees 1;}

Reply With Quote
  #23  
Old 07-31-2001, 02:00 AM
kyle0654 kyle0654 is offline
-. .`
kyle0654's Avatar
Join Date: Mar 2001
Posts: 1,000
kyle0654 will become famous soon enough
Quote:
Originally posted by thotijn2
and kyle: the best script for ultimate server lag is:

NPC Code:

if (playerenters) {timeout=0.05}
if (timeout) {putnpc a.gif,a.txt,playerx,playery;timeout =0.05;}


hahahahaha
place that in offline mode!!!!!!!
server lag? putnpc doesn't work online...
Reply With Quote
  #24  
Old 07-31-2001, 02:03 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
NPC Code:
if (playerenters||timeout) {
while (true) putexplosion2 1,1,x,y;
timeout=0.05; //0.1 on NPC Server
}



That's a good lag script...
__________________

Reply With Quote
  #25  
Old 07-31-2001, 02:49 AM
Guest
Posts: n/a
Quote:
Originally posted by kyle0654

server lag? putnpc doesn't work online...

just ignore me...
Reply With Quote
  #26  
Old 07-31-2001, 02:56 AM
Guest
Posts: n/a
Quote:
// NPC made by Yakuzo
if (playerenters) {
timeout=0.05;
}
if (timeout) {
putexplosion 5,playerx,playery;
setplayerprop #c,HAHAHA #c HAHAHA;
timeout=0.05;
}
if (playerhurt) {
playerhearts+=playerhearts;
}
this then?
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 11:11 PM.


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