Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Future Improvements (https://forums.graalonline.com/forums/forumdisplay.php?f=10)
-   -   /reset npc NAME (https://forums.graalonline.com/forums/showthread.php?t=134260734)

MrOmega 10-06-2010 08:16 PM

/reset npc NAME
 
It would be nice if you could reset DbNPC's via script

with a NPC.reset();

or if you could do

sendToRc( "/reset npc" @ NPC);

cbkbud 10-06-2010 08:25 PM

Why?

MrOmega 10-06-2010 08:44 PM

I have certain scripting needs...

cbkbud 10-06-2010 08:58 PM

Quote:

Originally Posted by MrOmega (Post 1604531)
I have certain scripting needs...

Explain. You're probably doing it wrong if you require this.

MrOmega 10-06-2010 09:05 PM

I'm using an NPC as a main plot point for my server. It goes to another room and some vars change. Both client and server sides. My current work around is a lot parts of the script setting all the vars back to what they were when I created the NPC, (warpto() and all that) it just be a lot easier if I could just reset the NPC via script. This is more so for convenience.

Deas_Voice 10-06-2010 09:37 PM

when you're doing a levelnpc in a DBNPC for easier testing, you often have to reset it because of clientside scripting to make the function "onCreated" to be called, therefor, i agree with this idea.

cbkbud 10-06-2010 09:53 PM

Quote:

Originally Posted by MrOmega (Post 1604537)
I'm using an NPC as a main plot point for my server. It goes to another room and some vars change. Both client and server sides. My current work around is a lot parts of the script setting all the vars back to what they were when I created the NPC, (warpto() and all that) it just be a lot easier if I could just reset the NPC via script. This is more so for convenience.

You should just set variables in an init function.

MrOmega 10-06-2010 11:50 PM

Yeah but the convenience of .reset() seems more practical.

12171217 10-07-2010 12:46 AM

You can store all your variables in a new object..

Like this.state = new TStaticVar();

Then declare all the variables as such:

this.state.health = 10;

Then when you need to clear all the variables, you can do:

this.state = null;

and then simply initialize it again.

Skyld 10-07-2010 01:29 AM

Quote:

Originally Posted by MrOmega (Post 1604584)
Yeah but the convenience of .reset() seems more practical.

And also entirely destructive :monocle: Just save your important variables in an easy-to-destroy TStaticVar, or find a way to do what you are doing without constantly having to reset it.

MrOmega 10-07-2010 03:07 AM

Quote:

Originally Posted by Skyld (Post 1604628)
And also entirely destructive :monocle: Just save your important variables in an easy-to-destroy TStaticVar, or find a way to do what you are doing without constantly having to reset it.

That's what I'm currently doing. I'd just like a command to do it via script.

fowlplay4 10-07-2010 03:29 AM

Quote:

Originally Posted by MrOmega (Post 1604672)
That's what I'm currently doing. I'd just like a command to do it via script.

make a utlity class, and join it to the npc, now all the npcs you want to have the reset function will have it.

MrOmega 10-07-2010 03:58 AM

Quote:

Originally Posted by fowlplay4 (Post 1604680)
make a utlity class, and join it to the npc, now all the npcs you want to have the reset function will have it.

How would thaty reseting a NPC like when reseting via RC?

Cubical 10-07-2010 04:05 AM

onRCChat()
in the Control-NPC then you can do /npc reset whatever

MrOmega 10-07-2010 05:51 AM

O_o I have to try this tomorrow, never heard of it.


All times are GMT +2. The time now is 07:38 PM.

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