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 12-22-2004, 04:28 AM
falco10291029 falco10291029 is offline
BEst User EVER!
Join Date: Apr 2004
Posts: 1,186
falco10291029 is on a distinguished road
NPC warping

I am working on a new battle system for ELemental Kingdoms but I cannot find a way to warp npcs to a level, which is a huge part of it (I have tried a few other ways, to no avail). anyb suggestions (please dont say get a good NAT)?
__________________
BEst Insult ever: If I had a dollar for every brain you DIDNT have, i'd have one dollar!
Reply With Quote
  #2  
Old 12-22-2004, 04:41 AM
ZeroTrack ZeroTrack is offline
G2K1 Developer
ZeroTrack's Avatar
Join Date: Apr 2004
Location: LongIsland, NY
Posts: 402
ZeroTrack is on a distinguished road
Send a message via AIM to ZeroTrack
Quote:
Originally Posted by falco10291029
I am working on a new battle system for ELemental Kingdoms but I cannot find a way to warp npcs to a level, which is a huge part of it (I have tried a few other ways, to no avail). anyb suggestions (please dont say get a good NAT)?
to my knowledge there are a few ways to do it, canwarp and canwarp2 depending if the npcs are attached to you or are moving. and doing with(getnpc(npcname)) setlevel2 level,x,y; this only works with dbnpc's though
__________________

Reply With Quote
  #3  
Old 12-22-2004, 04:50 AM
falco10291029 falco10291029 is offline
BEst User EVER!
Join Date: Apr 2004
Posts: 1,186
falco10291029 is on a distinguished road
I am not using a db npc, its a class npc, that's what makes it hard
__________________
BEst Insult ever: If I had a dollar for every brain you DIDNT have, i'd have one dollar!
Reply With Quote
  #4  
Old 12-22-2004, 05:11 AM
Slash-P2P Slash-P2P is offline
Banned
Join Date: May 2004
Location: Burning Blade
Posts: 941
Slash-P2P is on a distinguished road
use canwarp/canwarp2 and warpto x,y,level;
Reply With Quote
  #5  
Old 12-22-2004, 05:39 AM
falco10291029 falco10291029 is offline
BEst User EVER!
Join Date: Apr 2004
Posts: 1,186
falco10291029 is on a distinguished road
warpto doesnt work except on database npcs :/
__________________
BEst Insult ever: If I had a dollar for every brain you DIDNT have, i'd have one dollar!
Reply With Quote
  #6  
Old 12-22-2004, 05:54 AM
ZeroTrack ZeroTrack is offline
G2K1 Developer
ZeroTrack's Avatar
Join Date: Apr 2004
Location: LongIsland, NY
Posts: 402
ZeroTrack is on a distinguished road
Send a message via AIM to ZeroTrack
Quote:
Originally Posted by falco10291029
warpto doesnt work except on database npcs :/
this is true , you cant warp local npc's if this is what your trying to do, you have to use canwarp/canwarp2 and either attach it to the player or use move
__________________

Reply With Quote
  #7  
Old 12-22-2004, 06:41 AM
falco10291029 falco10291029 is offline
BEst User EVER!
Join Date: Apr 2004
Posts: 1,186
falco10291029 is on a distinguished road
hmm i know the command to attatch to a player i just didnt think it warped with them plus I wqas told that it wasnt a good thing to do. I will try that soon and let you guys know.
__________________
BEst Insult ever: If I had a dollar for every brain you DIDNT have, i'd have one dollar!
Reply With Quote
  #8  
Old 12-22-2004, 06:55 AM
Python523 Python523 is offline
Banned
Join Date: Aug 2001
Location: Illinois
Posts: 3,498
Python523 is on a distinguished road
NPCs that were layed with putnpc2 can warpto and stuff.
Reply With Quote
  #9  
Old 12-22-2004, 08:08 AM
ZeroTrack ZeroTrack is offline
G2K1 Developer
ZeroTrack's Avatar
Join Date: Apr 2004
Location: LongIsland, NY
Posts: 402
ZeroTrack is on a distinguished road
Send a message via AIM to ZeroTrack
Quote:
Originally Posted by Python523
NPCs that were layed with putnpc2 can warpto and stuff.
cause they are considered held on the server correct? not local npcs?
__________________

Reply With Quote
  #10  
Old 12-22-2004, 08:48 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 ZeroTrack
cause they are considered held on the server correct? not local npcs?
They are considered DB NPCs, so technically, yea.
Reply With Quote
  #11  
Old 12-22-2004, 09:30 AM
falco10291029 falco10291029 is offline
BEst User EVER!
Join Date: Apr 2004
Posts: 1,186
falco10291029 is on a distinguished road
well mine just join the class directly, so that wouldnt work, ill try the attatching. But i'll remeber that putnpc2 thing, maybe make a summoning spell
__________________
BEst Insult ever: If I had a dollar for every brain you DIDNT have, i'd have one dollar!
Reply With Quote
  #12  
Old 12-23-2004, 03:34 AM
falco10291029 falco10291029 is offline
BEst User EVER!
Join Date: Apr 2004
Posts: 1,186
falco10291029 is on a distinguished road
hmm, how do i find the npcs id that i want the player to be attached to? i tried a couple ways, like a for loop, but it didnt seem to work.
__________________
BEst Insult ever: If I had a dollar for every brain you DIDNT have, i'd have one dollar!
Reply With Quote
  #13  
Old 12-23-2004, 03:36 AM
Loriel Loriel is offline
Somewhat rusty
Loriel's Avatar
Join Date: Mar 2001
Posts: 5,059
Loriel is a name known to allLoriel is a name known to allLoriel is a name known to allLoriel is a name known to all
The current NPC's ID is stored, unsurprisingly, in the variable
NPC Code:
id

. By extension, you should be able to use
NPC Code:
players[index].id

.
Reply With Quote
  #14  
Old 12-23-2004, 04:34 AM
falco10291029 falco10291029 is offline
BEst User EVER!
Join Date: Apr 2004
Posts: 1,186
falco10291029 is on a distinguished road
ok, i wasnt sure if that worked, because it didnt seem to, i'l lretry it.
__________________
BEst Insult ever: If I had a dollar for every brain you DIDNT have, i'd have one dollar!
Reply With Quote
  #15  
Old 12-23-2004, 04:40 AM
falco10291029 falco10291029 is offline
BEst User EVER!
Join Date: Apr 2004
Posts: 1,186
falco10291029 is on a distinguished road
It attaches, but doesn't warp, here's the script, I can't see what's wrong:
PHP Code:
 else if (players[i].x in |x-3,x+3|&&players[i].y in |y-3,y+3|) {
this.w=int(random(0,1000));
copylevel neutral-battle.nw,neutral-battle#v(this.w).nw;
canwarp;
      
with(players[i]) {
attachplayertoobj 0,id;
setlevel2 neutral-battle#v(this.w).nw,30,20;
detatchplayer;
   }

timeout=1;


__________________
BEst Insult ever: If I had a dollar for every brain you DIDNT have, i'd have one dollar!
Reply With Quote
  #16  
Old 12-23-2004, 06:39 AM
Slash-P2P Slash-P2P is offline
Banned
Join Date: May 2004
Location: Burning Blade
Posts: 941
Slash-P2P is on a distinguished road
Quote:
Originally Posted by falco10291029
It attaches, but doesn't warp, here's the script, I can't see what's wrong:
PHP Code:
 else if (players[i].x in |x-3,x+3|&&players[i].y in |y-3,y+3|) {
this.w=int(random(0,1000));
copylevel neutral-battle.nw,neutral-battle#v(this.w).nw;
canwarp;
      
with(players[i]) {
attachplayertoobj 0,id;
setlevel2 neutral-battle#v(this.w).nw,30,20;
detatchplayer;
   }

timeout=1;


The first thing thats wrong is not using KSI-GS.

PHP Code:
} else {
if (
players[i].x in |x-3,x+3| && players[i].y in |y-3,y+3|) {
  
this.w=int(random(0,1000));
  
copylevel neutral-battle.nw,neutral-battle#v(this.w).nw;
  
canwarp;
  
with (players[i]) { // don't you mean getplayer(#a(i)) or allplayers[i]
    
attachplayertoobj 0,id;
    
setlevel2 neutral-battle#v(this.w).nw,30,20;
    
detatchplayer;
  }
  
timeout 1;

Reply With Quote
  #17  
Old 12-23-2004, 07:50 AM
Kaimetsu Kaimetsu is offline
Script Monkey
Kaimetsu's Avatar
Join Date: May 2001
Posts: 18,222
Kaimetsu will become famous soon enough
Quote:
Originally Posted by Slash-P2P
The first thing thats wrong is not using KSI-GS
I think you have a strange idea of what KSI-GS is.
__________________
Reply With Quote
  #18  
Old 12-23-2004, 08:09 AM
Slash-P2P Slash-P2P is offline
Banned
Join Date: May 2004
Location: Burning Blade
Posts: 941
Slash-P2P is on a distinguished road
Quote:
Originally Posted by Kaimetsu
I think you have a strange idea of what KSI-GS is.
I think I meant styling.
Reply With Quote
  #19  
Old 12-23-2004, 09:57 AM
Kaimetsu Kaimetsu is offline
Script Monkey
Kaimetsu's Avatar
Join Date: May 2001
Posts: 18,222
Kaimetsu will become famous soon enough
Quote:
Originally Posted by Slash-P2P
I think I meant styling.
Styling is a matter of personal preference, there's no right or wrong.
__________________
Reply With Quote
  #20  
Old 12-23-2004, 07:06 AM
falco10291029 falco10291029 is offline
BEst User EVER!
Join Date: Apr 2004
Posts: 1,186
falco10291029 is on a distinguished road
Quote:
// don't you mean getplayer(#a(i)) or allplayers[i]
No. it's meant to look for people on the current level first, then (i dont know why it works this ay but it does) it looks on the rest of the gmap.
__________________
BEst Insult ever: If I had a dollar for every brain you DIDNT have, i'd have one dollar!
Reply With Quote
  #21  
Old 12-23-2004, 09:27 PM
falco10291029 falco10291029 is offline
BEst User EVER!
Join Date: Apr 2004
Posts: 1,186
falco10291029 is on a distinguished road
Right, now about the script? Help? please? (as for the mods of thsio forum that enjoy closing these type threads: I have tried several ways to get it working, i understand what I'm doing, ect ect, I just can't find the bug in my script)
__________________
BEst Insult ever: If I had a dollar for every brain you DIDNT have, i'd have one dollar!
Reply With Quote
  #22  
Old 12-23-2004, 09:30 PM
Loriel Loriel is offline
Somewhat rusty
Loriel's Avatar
Join Date: Mar 2001
Posts: 5,059
Loriel is a name known to allLoriel is a name known to allLoriel is a name known to allLoriel is a name known to all
Quote:
Originally Posted by falco10291029
I understand what I'm doing, ect ect, I just can't find the bug in my script
That means you do not understand what you are doing.
Reply With Quote
  #23  
Old 12-23-2004, 09:58 PM
ZeroTrack ZeroTrack is offline
G2K1 Developer
ZeroTrack's Avatar
Join Date: Apr 2004
Location: LongIsland, NY
Posts: 402
ZeroTrack is on a distinguished road
Send a message via AIM to ZeroTrack
Quote:
Originally Posted by Loriel
That means you do not understand what you are doing.
haha this is very true
__________________

Reply With Quote
  #24  
Old 12-23-2004, 11:12 PM
falco10291029 falco10291029 is offline
BEst User EVER!
Join Date: Apr 2004
Posts: 1,186
falco10291029 is on a distinguished road
Quote:
That means you do not understand what you are doing.
No, that means I know what i'm doing, but I made a mistake that I didn't realize. Beside,s I mean I made the script, by understand, so I know how it works, i just don't know why it doesnt work (get it?)
__________________
BEst Insult ever: If I had a dollar for every brain you DIDNT have, i'd have one dollar!
Reply With Quote
  #25  
Old 12-31-2004, 02:26 AM
CaTigus CaTigus is offline
Scripter
Join Date: Oct 2002
Posts: 80
CaTigus is on a distinguished road
Quote:
Originally Posted by falco10291029
No, that means I know what i'm doing, but I made a mistake that I didn't realize. Beside,s I mean I made the script, by understand, so I know how it works, i just don't know why it doesnt work (get it?)
NPC Code:

else if (players[i].x in |x-3,x+3|&&players[i].y in |y-3,y+3|) {
this.w=int(random(0,1000));
copylevel neutral-battle.nw,neutral-battle#v(this.w).nw;<-Copylevel requires the folder names example:
copylevel levels/battlelevels/neutral-battle.nw,levels/battlelevels/neutral-battle#v(this.w).nw; and I really recommend making your own folder for these levels.
canwarp;
with(players[i]) {
detatchplayer;
setlevel2 neutral-battle#v(this.w).nw,30,20;
attachplayertoobj 0,id;
}
timeout=1;
}


Last edited by CaTigus; 12-31-2004 at 03:48 AM..
Reply With Quote
  #26  
Old 12-31-2004, 04:54 AM
Tolnaftate2004 Tolnaftate2004 is offline
penguin.
Join Date: Jul 2004
Location: Berkeley, CA
Posts: 534
Tolnaftate2004 is a jewel in the roughTolnaftate2004 is a jewel in the rough
Send a message via AIM to Tolnaftate2004
You misspelled detachplayer.
This probably doesn't fix your problem, but I thought I'd let you know.
Reply With Quote
  #27  
Old 12-31-2004, 05:02 AM
falco10291029 falco10291029 is offline
BEst User EVER!
Join Date: Apr 2004
Posts: 1,186
falco10291029 is on a distinguished road
Quote:
;<-Copylevel requires the folder names example:
Quote:
You misspelled detachplayer.
I will try fixing both of those, and see if it helps.



EDIT:
PHP Code:
else if (players[i].x in |x-3,x+3|&&players[i].y in |y-3,y+3|) { 
this.w=int(random(0,1000)); 
copylevel levels/neutral-battle.nw,levels/neutral-battle#v(this.w).nw//I plan to delete the extra battle levels or have a script do it every now and then; 
canwarp
      
with(players[i]) { 
attachplayertoobj 0,id
setlevel2 neutral-battle#v(this.w).nw,30,20; 
detachplayer
   } 

timeout=1



Doesn't work still, that's the current script, it attaches you to the mold, but doesnt create or warpto the new level, nor make you warp there.
__________________
BEst Insult ever: If I had a dollar for every brain you DIDNT have, i'd have one dollar!

Last edited by falco10291029; 12-31-2004 at 05:16 AM..
Reply With Quote
  #28  
Old 12-31-2004, 05:50 AM
Slash-P2P Slash-P2P is offline
Banned
Join Date: May 2004
Location: Burning Blade
Posts: 941
Slash-P2P is on a distinguished road
I suggest instead of creating a random level, you make a database npc to hold the indexes of the levels created. Then when the player ends the battle, erase the level.

You could also have a timeout NPC running in the level. Read the index of the level with #e(#,#,#L) or something and make the script run deletelevel if the playerscount is 0. If the player enters, start the timeout.
Reply With Quote
  #29  
Old 12-31-2004, 05:53 AM
falco10291029 falco10291029 is offline
BEst User EVER!
Join Date: Apr 2004
Posts: 1,186
falco10291029 is on a distinguished road
yes i was considering the second thing in the leve, but figured there isn't a point until I both;

A) Get the script to work.
B) have enough people on that it would matter
__________________
BEst Insult ever: If I had a dollar for every brain you DIDNT have, i'd have one dollar!
Reply With Quote
  #30  
Old 12-31-2004, 06:17 AM
CaTigus CaTigus is offline
Scripter
Join Date: Oct 2002
Posts: 80
CaTigus is on a distinguished road
You could do:
NPC Code:

else if (players[i].x in |x-3,x+3|&&players[i].y in |y-3,y+3|) {
this.w++;
copylevel levels/neutral-battle.nw,levels/neutral-battle#v(this.w).nw;
canwarp;
with(players[i]) {
attachplayertoobj 0,id;
setlevel2 neutral-battle#v(this.w).nw,30,20;
detachplayer;
}
timeout=1;
}


and in levels/neutral-battle.nw put this script exactly:
NPC Code:

if (playerleaves && playercount<0) {
deletelevel #L;
}


But make sure you have a backup of the original neutral battle.
We're deleting the level to make less lag. Now if that doesn't work i'll get online and play with it.
Reply With Quote
  #31  
Old 12-31-2004, 07:10 AM
Tolnaftate2004 Tolnaftate2004 is offline
penguin.
Join Date: Jul 2004
Location: Berkeley, CA
Posts: 534
Tolnaftate2004 is a jewel in the roughTolnaftate2004 is a jewel in the rough
Send a message via AIM to Tolnaftate2004
Quote:
Originally Posted by CaTigus
NPC Code:

if (playerleaves && playercount<0) {
deletelevel #L;
}

Can it have a negative playerscount?
Reply With Quote
  #32  
Old 12-31-2004, 06:23 AM
falco10291029 falco10291029 is offline
BEst User EVER!
Join Date: Apr 2004
Posts: 1,186
falco10291029 is on a distinguished road
The only change you made to the original script was making this.w progressively increase instea dof being random. I tried it just in case and it didn't help, so i went back to the original desing. Again iw on't be deleting the levels with a script until the average playercount is higher (crrently it's 2 )
__________________
BEst Insult ever: If I had a dollar for every brain you DIDNT have, i'd have one dollar!
Reply With Quote
  #33  
Old 12-31-2004, 06:26 AM
CaTigus CaTigus is offline
Scripter
Join Date: Oct 2002
Posts: 80
CaTigus is on a distinguished road
It would kind of help if I knew the whole script so I knew what you were trying to do exactly.
Reply With Quote
  #34  
Old 12-31-2004, 06:42 AM
falco10291029 falco10291029 is offline
BEst User EVER!
Join Date: Apr 2004
Posts: 1,186
falco10291029 is on a distinguished road
That is the part of the script that is broken, the fighting system level warp, the overall script is the monster, mold. Posting it would only give noobs a script to copy.
__________________
BEst Insult ever: If I had a dollar for every brain you DIDNT have, i'd have one dollar!
Reply With Quote
  #35  
Old 12-31-2004, 07:15 AM
falco10291029 falco10291029 is offline
BEst User EVER!
Join Date: Apr 2004
Posts: 1,186
falco10291029 is on a distinguished road
no i think they meant "==0", and if not, well.....
__________________
BEst Insult ever: If I had a dollar for every brain you DIDNT have, i'd have one dollar!
Reply With Quote
  #36  
Old 12-31-2004, 07:35 AM
CaTigus CaTigus is offline
Scripter
Join Date: Oct 2002
Posts: 80
CaTigus is on a distinguished road
Quote:
Originally Posted by falco10291029
no i think they meant "==0", and if not, well.....
Yeah, Both those would work, == just looks ugly to me.
Reply With Quote
  #37  
Old 12-31-2004, 08:49 AM
Slash-P2P Slash-P2P is offline
Banned
Join Date: May 2004
Location: Burning Blade
Posts: 941
Slash-P2P is on a distinguished road
Quote:
Originally Posted by CaTigus
Yeah, Both those would work
No.
NPC Code:
if (created || initialized) {
sendtorc Playerscount: #v(playerscount);
}


Returns 0. (DB NPC)
Quote:
Originally Posted by CaTigus
== just looks ugly to me.
Looks perfectly fine to me.
Reply With Quote
  #38  
Old 12-31-2004, 04:53 PM
CaTigus CaTigus is offline
Scripter
Join Date: Oct 2002
Posts: 80
CaTigus is on a distinguished road
Quote:
Originally Posted by Slash-P2P
No.
Looks perfectly fine to me.
Haha, I think it just looks ugly. I'm not going to argue over 2 equal signs with you
Reply With Quote
  #39  
Old 12-31-2004, 07:27 PM
falco10291029 falco10291029 is offline
BEst User EVER!
Join Date: Apr 2004
Posts: 1,186
falco10291029 is on a distinguished road
Yes, less arguing more helping my problem , this should be working.......
__________________
BEst Insult ever: If I had a dollar for every brain you DIDNT have, i'd have one dollar!
Reply With Quote
  #40  
Old 12-31-2004, 07:38 PM
CaTigus CaTigus is offline
Scripter
Join Date: Oct 2002
Posts: 80
CaTigus is on a distinguished road
If you want to get all the players you're going to need
NPC Code:

for(i=0;i<playerscount;i++) {
with(players[i]) {
script;
}
}


To get serverside NPCs use:
NPC Code:

for(i=0;i<npcscount;i++) {
with(npcs[i]) {
script;
}
}


This works for classes aswell. You can control text's of a class and such with this, possibly warpto in the script, Which I have never tried.
I'm starting to lose understanding of your question.
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 11:38 AM.


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