Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   NPC warping (https://forums.graalonline.com/forums/showthread.php?t=56559)

falco10291029 12-31-2004 08:02 PM

My question is, currently, why isn't it copying the level correctly?

Skyld 12-31-2004 09:12 PM

Quote:

Originally Posted by CaTigus
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.

this.i

Malinko 12-31-2004 09:16 PM

Quote:

Originally Posted by Skyld
this.i

Oh god...*slaps forehead*,

Edit: Inside joke, Skyld gets mad when you use "i" and not "this.i".

falco10291029 12-31-2004 09:18 PM

this.i doesn't matter that much

Skyld 12-31-2004 09:21 PM

If you use it clientside in more than one script, they will conflict. I know that what you are trying to do is serverside, but still it is bad practise.

Evil_Trunks 12-31-2004 11:07 PM

Quote:

Originally Posted by Skyld
If you use it clientside in more than one script, they will conflict. I know that what you are trying to do is serverside, but still it is bad practise.

they will? I don't exactly see how unless Graal somehow runs two scripts at the exact same time (it does not do that)

falco10291029 12-31-2004 11:38 PM

I know they conflict when it's clientside, but geuss what, it's serverside.

Kaimetsu 01-01-2005 01:28 AM

Quote:

Originally Posted by Skyld
If you use it clientside in more than one script, they will conflict

Horrendously bad advice.

Skyld 01-01-2005 02:53 AM

Quote:

Originally Posted by Evil_Trunks
they will? I don't exactly see how unless Graal somehow runs two scripts at the exact same time (it does not do that)

Clientside, variables without a prefix are stored on the client.

Quote:

Originally Posted by falco10291029
I know they conflict when it's clientside, but geuss what, it's serverside.

Did you not read what I said?

Quote:

I know that what you are trying to do is serverside, but still it is bad practise.

Kaimetsu 01-01-2005 02:59 AM

Listen: If you want the value of a variable to be preserved between frames then yes, a this. prefix should be used. But that is not the case with simple iterative variables. It is wasteful to have a copy for every separate NPC.

falco10291029 01-01-2005 03:30 AM

Quote:

Did you not read what I said?
Yes, I did. I am just saying that i feel no need to type this. if I don't need to :whatever:

Slash-P2P 01-01-2005 03:51 AM

Isn't copylevel serverside?

falco10291029 01-01-2005 03:59 AM

yes it is, and SO IS THE NPC USING IT!

ZeroTrack 01-01-2005 05:26 AM

i think everyone forgot the orginal problem

falco10291029 01-01-2005 06:36 AM

Me too, I would restart the thread if that wasn't illegal, but now people are arguin over something pointless...when...my thread...is still...going....on.........damn i'm a jackass :(

falco10291029 01-02-2005 12:33 AM

Hey what's the variable for gravity? i want to change mine so that I can use it for spells....(there's bugs when I use 0 for power and zangle)

CaTigus 01-02-2005 01:45 AM

Quote:

Originally Posted by falco10291029
Hey what's the variable for gravity? i want to change mine so that I can use it for spells....(there's bugs when I use 0 for power and zangle)

What do you mean gravity?
playerz?
playerz=
playerz+=
playerz-=
playerz++
playerz--
but playerz doesnt go below 0.

Tolnaftate2004 01-02-2005 03:08 AM

It's "gravity."

falco10291029 01-02-2005 04:08 AM

Catigus, i meant for shoot, and tolfanate, thanks. Anyway i still need this problem fixed XD

CaTigus 01-02-2005 05:08 AM

Quote:

Originally Posted by falco10291029
Catigus, i meant for shoot, and tolfanate, thanks. Anyway i still need this problem fixed XD

Oh, I get it now, you were using the shoot command for a spell :P Sorry

falco10291029 01-02-2005 06:10 AM

yes i was, but now i wish to have the problem fixed. I have an idea, but i need to know how yto trigger an action into the npcserver or a db npc (I'm thinking maybe only a db can copy levels)

TB3 01-05-2005 01:49 AM

With all this talk about the deletelevel ; command , when using it does the npcserver remove DB npcs from that level before deleting it ??

Slash-P2P 01-05-2005 01:56 AM

Quote:

Originally Posted by CaTigus
but playerz doesnt go below 0.

It can.

Quote:

Originally Posted by falco10291029
only a db can copy levels)

I've done it before with a weapon.

falco10291029 01-05-2005 04:31 AM

what's the exact command you used? I cant get copylevel to work no matter what typ of npc uses it :(

Evil_Trunks 01-05-2005 04:44 AM

I have used it before

I think the destination copyed level has to be in a subfolder of the level you are copying? I remember experiencing omething odd like this and taking a while to pick up on it

Slash-P2P 01-05-2005 04:52 AM

I havent used it in a while but I think I had the template level in levels/ and it copied to a subfolder and only had the folders on the 2nd part.

like

copylevel battletest.nw,battles/battletest#v(var).nw;

falco10291029 01-05-2005 05:15 AM

I'll try that, and announce if it works :-P


EDIT: No, that doesn't seem to work either, I tested it by puttin it in the npcserver, so I didnt ahve to go online, and i'l ltry it on molds too, but i doubt it'll work

middo 01-05-2005 08:46 AM

I too have gotten it to work before...
I made a tent NPC that would spawn tents with individual insides.

I had the actual tent NPC put down via putnpc2
And when you entered the tent, your last coordinants were saved...
It wasnt exactly fool-proof, you could go in a tent and not come out for a day, and end up stuck on a tree..
I don't remember if I fixed that or not. Now I would have made a level-script that checked with a DB NPC where I would store coordinants and status (maybe dates) of tents to see if the one you are in is still active/in existance...

In the class NPC, I had an

if (created) {
copylevel levels/tents/tent_basic.nw,levels/tents/tent_#v(server.tentquary);
}

NOTE; Dont do it the lame way I did it...

TB3 01-05-2005 04:05 PM

Eh....?
PHP Code:

//Level NPC in level that initiates battle.
if (playerenters) {
  
putnpc2 x,y,{join baddyclassname;};
  
with(npcs[npcscount-1]) {
    
setstring this.target,#a;
  
}


PHP Code:

//Baddy Class 
if (created||invalid) {
  
setstring this.var,#v(int(random(0,300)));
  
ok 0;
  
with(getnpc(Battles)) {
    if(
lindexof(#s(thiso.var),this.activelevels) == -1) ok = 1;
  
}
  if(
ok == 0) {
    
callnpc -1,invalid,;
  } else {
    
copylevel battletest.nw,battles/battletest_#s(this.var).nw;
    
with(getnpc(Battles)) {
      
addstring this.activelevels,#s(thiso.var);
    
}
    
setstring this.startlevel,#L;
    
warpto battletest_#s(this.var).nw,x,y;
    
with(getplayer(#s(this.target))) setlevel2 #L,playerx,playery;
  
}
}
//Baddy code rest of the way except
if(whateverhappenswhenbaddydies) {
  
setlevel2 escapelevel,playerx,playery;
  
with(getnpc(Battles)) {
    
removestring this.activelevels,#s(thiso.var);
  
}
  
warpto #s(this.startlevel),x,y; //Failsafe if delete level doesnt remove db npcs you dont want bugged db npcs clogging your npcserver
  
deletelevel battles/battletest_#s(this.var).nw; // Not sure if you need the battles/ part 


PHP Code:

//Battles DB List NPC 

Maybe something like this ???
God knows i didnt test it so there may be some grammar errors or script errors.
And I was inquiring earlier do DB npcs get deleted from level if you use the deletelevel command ? eh?

falco10291029 01-05-2005 10:45 PM

yes they do, I had something stored there and it was deleted by accident, and so ewas the DN npc, and anyways, i tryed the ways, but it doesnt seem to be copying, I am gonna try doing several of those in the same script, and see if any of them activate..


All times are GMT +2. The time now is 03:23 PM.

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