Persistent draggable npcs via join

After messing with the join command a bit I came up with this script. It’s probably been done before, but I hope you guys like it nevertheless.

My level npc:

// NPC made by traddles
if (created || playerenters) {
  timereverywhere;
  setimg arrowsbox.png;
  setstring this.name,arrowbox;
  join persistentdraggable;
  init();
}

function onDragStop() {
  // just here to demonstrate the ability
  // to do stuff on being dropped by a player
  if (x > 62) x = 62;
  if (y > 62) y = 62;
  if (x < 0) x = 0;
  if (y < 0) y = 0;
  say2 I've been dropped;
}

Attached is the persistentdraggable.txt file. In order to use this npc you need to do at a minimum:

if (created || playerenters) {
  <either a setimg or a setshape>
  setstring this.name,<some_unique_name>;
  join persistentdraggable;
  init();
}

Although I also made the persistentdraggable.txt npc call “onDragStop()” so if you write a function with that name it will get called when a player stops dragging the npc. Or you can not write the function and the script just stops dragging the npc. (in my example I use the onDragStop() function to check for the npc being off the level and also a say2).

I’ve attached a level and the npc text file. Or if you want to see it in action but don’t feel like adding these files to your server I’ve got a demo up on my still-in-progress server “selzvati”.

Learn to put shit in the proper subforums.

oops. Sorry. Didn’t realize there was a script showcase subforum to the npc subforum. Thanks for moving it.

Also, it occurred to me about 10 minutes after posting that this doesn’t handle crossing levels in an overworld. I’ll have to work on that for the next iteration.

This is an EXCELLENT script. Thank you <3

Thanks.

You’re welcome. I’m glad you enjoyed it.

interesting script… but just add it to weapons and u could make a… RETARDED ADMIN WEAPON!!! YAY! hmmmm maybe that would be cool… it depends. well its pretty fun i guess… ok im doing that i guess i would be an abusive staff. I’d drag noobs on roofs and force them to buy i membership:) that would be fun ( IM SORRY I DIDNT MEAN IT DONT FIRE ME!!!)

If you didnt mean it you wouldnt have posted it.

uh are you talking to yourself?

:drugs:

I posted it bcuz…IDK GET OFF MY CHIZ ( WHAT IS CHIZ?!?) I MEAN IM SORRY FOR SHARING MY LIVES STORY WITH U I MEAN WHY??? !pissed!

oi awesome do you play iGraal?

My lil brother plays igraal and he was watching me on the comp when i was home for spring break and he said “hey tricxta he made a room in ipod in a nightclub”, is that you

It must be cool cause my brother flipped “OMG TRICXTA HES FAMOUS” tricxta you got an 11 year old fan

yay an admirer ^.^ makes it all worth it haha

i hate graal

Holy shit. You’re annoying.

Could a mod clean up some of this spam please? (maybe move it to misc?) Primarily awsome’s more drug-induced posts?

not worth carrying to misc, just delete it

canwarp;

oooooo, that’s a pretty handy sounding setting. I didn’t see it in commands.rtf or any of the newfeaturesXXX.txt

Where did you hear about it and how exactly does it work?