SA-MP Forums Archive
[SOLVED] Controlling NPCs through a gamemode/filterscript - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [SOLVED] Controlling NPCs through a gamemode/filterscript (/showthread.php?tid=99206)



[SOLVED] Controlling NPCs through a gamemode/filterscript - SpiderPork - 26.09.2009

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?


Re: Controlling NPCs through a gamemode/filterscript - V1ceC1ty - 26.09.2009

what do you want to make the npc's do?


Re: Controlling NPCs through a gamemode/filterscript - SpiderPork - 26.09.2009

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...


Re: Controlling NPCs through a gamemode/filterscript - V1ceC1ty - 26.09.2009

#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.


Re: Controlling NPCs through a gamemode/filterscript - FUNExtreme - 26.09.2009

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


Re: Controlling NPCs through a gamemode/filterscript - SpiderPork - 26.09.2009

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...


Re: Controlling NPCs through a gamemode/filterscript - SpiderPork - 26.09.2009

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

Thanks for trying to help me though .