[SOLVED] Controlling NPCs through a gamemode/filterscript
#1

This has been bugging me for the past 2 days, so here comes the "ask-on-the-SA:MP-forum" time again ...

Is it possible to control NPCs through a gamemode or a filterscript. I can't use Stop/Start/Pause/ResumeRecordingPlayback, because they only work in the NPCs' script.
I have tried with a timer in the NPC script, which checks if a variable is set to a value, and then plays the playback, and I DID set the value to that amount in the gamemode, and then I tried with an include, which I have included in both, gamemode and the NPC script.
Both gave the same result; nothing happened.
I have put debug messages on the beggining and the end to test if the script gets called or if it freezes. None of them got called.

So my guess is that variables and includes don't work, any ideas how I could get this to work?
Reply
#2

what do you want to make the npc's do?
Reply
#3

Quote:
Originally Posted by V№ceC№ty
what do you want to make the npc's do?
It doesn't really matter, I just want to start the recording if some variable is set to some value...
Reply
#4

#include <a_samp> in the npcmode?

i think i asked this question when 0.3 first came out and kye or dugi said it cant be done.
Reply
#5

The includes a_samp and a_npc can not be used togheter so currently the controlling of a npc is only possible in the npc script itself.
CallRemoteFunction won't work either as the npcscripts are not placed inside the filterscripts map.

Hope this helps you
Reply
#6

Quote:
Originally Posted by FUNExtreme
The includes a_samp and a_npc can not be used togheter so currently the controlling of a npc is only possible in the npc script itself.
CallRemoteFunction won't work either as the npcscripts are not placed inside the filterscripts map.

Hope this helps you
I've tried with an include which has 2 functions, a function to set a value and a function to get it.
I have included that include in the gamemode and the NPC script, then set a timer in the NPC script which checks if the variable is set to some value, and if it is, it plays the playback (Yes, I have used StartRecordingPlayback in the NPC script, not the gamemode).
I have also set the value of the variable inside the gamemode, so now I'm totally clue-less why this doesn't work, it should, or I'm stupid.

EDIT: I have also tried to define variables in the gamemode and the NPC script, then set a timer and checked if that variable is set to a value...
Reply
#7

Solved, used SendClientMessage on the NPC and then started the recording under OnClientMessage.

Thanks for trying to help me though .
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)