Warning: include(/var/www/html/forum/Sources/../../../includes/depot_files/OFPEC_get_header_image.inc.php): failed to open stream: No such file or directory in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 146

Warning: include(): Failed opening '/var/www/html/forum/Sources/../../../includes/depot_files/OFPEC_get_header_image.inc.php' for inclusion (include_path='.:/usr/local/lib/php') in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 146

Notice: Undefined index: OFPEC in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 152

Notice: Trying to access array offset on value of type null in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 152

Notice: Trying to access array offset on value of type null in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 152
    Home   Help Login Register  

Author Topic: Moving npcs  (Read 1409 times)

0 Members and 1 Guest are viewing this topic.

Offline ziarrek

  • Members
  • *
Moving npcs
« on: 02 Aug 2007, 02:05:47 »
Hi, I'm new here and I have a question: is there any way to prevent npcs from being pushed around by the player?
(for example a man is sitting on a chair and when I run into him, he moves, so that he is still sitting but with no chair under him).
Please help.

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: Moving npcs
« Reply #1 on: 02 Aug 2007, 02:32:42 »
The only way to deal with this is a looping script. I used one once to keep a unit sitting on the toilet...
Code: [Select]
_toiletOfficer = _this select 0
_posTO = getPos _toiletOfficer
#loop
_pos = GetPos _toiletOfficer
_xp = (GetPos _toiletOfficer) Select 0
_yp = (GetPos _toiletOfficer) Select 1
If(Alive _toiletOfficer And (_xp != _posTO Select 0 Or _yp != _posTO Select 1)) Then {_toiletOfficer SetPos _posTO}
~0.5
If(Alive _toiletOfficer) Then {Goto "loop"}
Exit

urp!

Offline ziarrek

  • Members
  • *
Re: Moving npcs
« Reply #2 on: 02 Aug 2007, 13:35:32 »
Thanks a lot:D I thought about something like this, but I'm not goog at scripts so I had to ask.