[Release] Best thing ever for a NPC! Must read!

What do you think about it

  • I had this already, you're really stupid for releasing this

    Votes: 7 50.0%
  • This is nice, so easy, but i just haven't figured this before!

    Votes: 7 50.0%

  • Total voters
    14
Status
Not open for further replies.
Joined
Apr 7, 2008
Messages
570
Reaction score
31
Hey, sometimes there's an event in your server like..

example: i got a first to 200 event
in my free market is an exp seller..
that's quite stupid..

SO.
i came up with a quick solution

if you make a npc put this at the start of it
PHP:
var status = 0;
var on = 1;
var off = 0;
var activated = on;

you see the actived? that's what this is all about
now, ull start your script

PHP:
function start() {
 status = -1;
 action(1, 0, 0);
}
function action(mode, type, selection) {
 if (mode == -1) {
  cm.dispose();
 } else {
  if (mode == 0 && status == 0) {
   cm.dispose();
   return;
  }
  if (mode == 1)
   status++;
  else
   status--;

a script ALWAYS have to start with this! this is the base
lets continue our script from beginning

PHP:
var status = 0;
var on = 1;
var off = 0;
var activated = on;
 
function start() {
 status = -1;
 action(1, 0, 0);
}
function action(mode, type, selection) {
 if (mode == -1) {
  cm.dispose();
 } else {
  if (mode == 0 && status == 0) {
   cm.dispose();
   return;
  }
  if (mode == 1)
   status++;
  else
   status--;
  if (activated == on) {
   YOUR SCRIPT HERE
   script.. script..
   more script!
   end of script :P
  } else {
   cm.sendOk("I am not activated..");
   cm.dispose();
  }
 }
}

ehr. that was it i guess?
thanks would be appreciated ^^


Summary:
PHP:
var on = 1;
var off = 0;
var activated = on;
 
if (activated == on) {
YOUR SCRIPT HERE
} else {
cm.sendOk("I am not activated..");
cm.dispose();
}
 
Last edited:
lol yea
but it's mostly the easy things that make people happy.
especially the people who don't have the time/knowledge to code their own npcs




wth? i don't understand you.

I dont speak english , so is logic that you dont understand what im talking about o.o

Basically :

We create new NPCs with activate = off
After we create ALL NPCs that are in GMS and not in the source
Start coding the NPCs and change activate = off to activate = on

EDIT: I UNDERSTAND 100% English , but i dont write it O_O
 
nice.
but isnt this more like a guide

i will update it later with changes in the source

I dont speak english , so is logic that you dont understand what im talking about o.o

Basically :

We create new NPCs with activate = off
After we create ALL NPCs that are in GMS and not in the source
Start coding the NPCs and change activate = off to activate = on

EDIT: I UNDERSTAND 100% English , but i dont write it O_O

ok i understand it, good idea!

So true...

And btw, IMO is better, use just 1 variable.. as so..

if (variable == 0){
No event message
}else{
normal..

ooh. i see
well, if you use on or off
you can just simply change 1 word at the top of the script
else you will have to go into the script and edit stuff. i think this is way easier

Sorry for being a noob, but what does this do?

you can simply change activated to off or on in your npc script
if it is on, the npc will say regular text
if it is off, the npc will say he isnt activated and will close
 
ooh. i see
well, if you use on or off
you can just simply change 1 word at the top of the script
else you will have to go into the script and edit stuff. i think this is way easier

Nah, you don't get my point..

i means, var variable = 0; for off, and 1 for on.. instead of changin on = 1/0; off = 1/0; activated = 0/1; or maybe i understand wrong :x
 
Nah, you don't get my point..

i means, var variable = 0; for off, and 1 for on.. instead of changin on = 1/0; off = 1/0; activated = 0/1; or maybe i understand wrong :x

yea i know.
with my method people can write on or off.
there are people who don't know that on = 1 and off = 0.
i really think this is way more easy

Erm... I really prefer having an event NPC that links to a command and then warps you there >_>

lol? this is no npc i released..
it's a function to easily enable/disable a npc
 
Status
Not open for further replies.
Back