Thread: Help
View Single Post
  #2  
Old 09-18-2002, 11:00 PM
emortylone emortylone is offline
Registered User
Join Date: Apr 2002
Location: Control-NPC
Posts: 834
emortylone is on a distinguished road
Ah, they are VERY useful. They keep track of numbers. For example:
NPC Code:

if (created)
{ this.hit=0;}

if (washit)
{ this.hit=this.hit+1;
hit();
}

function hit()
{ setcharprop #c,#v(this.hit);}


that makes this.hit go up ONE time everytime it was hit. And it will display it via #c as how many hits have happened. This.vars are ONLY for NUMBERS, no data can be stored in them. But I've done things like this:
NPC Code:

if (created)
{ this.dist=abs(npcs[1].save[1]-x)-abs(npcs[1].save[2].y);}


Something like that, i'm not exactly sure b/c I'm at school :P and i don't have much time. BUT I had a central NPC set npcs[1].save[1 and 2] to it's x and y. So this.dist was the distance it was from the central point. It was useful because I was making a clock that rotated around the middle, so I didn't have to code everything to be so far from the central point, I could move it out to ANY distance I wanted and it would still make a circle around that middle point. the radius changed, but the middle point didn't Try some stuff... I'll get you some examples if I get home in time.
---Shifter
__________________
Quote:
*Stefan: it seems sometimes they hire newbie scripters everywhere x-x
*Stefan: scripters are sometimes like people that draw paintings
*Stefan: all that counts is that it looks nice
Reply With Quote