# Problem with NPCS

**URL:** <https://forum.kirupa.com/t/problem-with-npcs/231354>\
**Category:** flash\
**Created:** [July 4, 2007, 1:15am UTC](https://forum.kirupa.com/t/problem-with-npcs/231354 "2007-07-04T01:15:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Heytherejake](https://avatars.discourse-cdn.com/v4/letter/h/f05b48/32.png) [@Heytherejake](https://forum.kirupa.com/u/Heytherejake)\
**Post date:** [July 4, 2007, 1:15am UTC](https://forum.kirupa.com/t/problem-with-npcs/231354/1 "2007-07-04T01:15:39Z")

</div>

I have this code to initialize NPCS in my game if you’re in their sight range

```auto
onClipEvent(load) {
    working = false;
    sight = 40;
}
onClipEvent(enterFrame) {
    if(_level0.guy._x - this._x < sight and _level0.guy._x - this._x > -sight and _level0.guy._y - this._y < sight and _level0.guy._y - this._y > -sight) {
        working = true;
    }
    if(working == true) {
        trace("Working");
    }
}

```

Anyone know why its not working?
