[help] NPCs interacting; CallRemoteFunction() inside NPC filterscript?
#1

Hi there,

With a friend of mine we made a nice police car chase record that goes around the town.

I made two simple NPC scripts basing on the well known tutorial on this forum.

But sadly those recordings aint perfectly synchronised; one lasts about a second longer than the other one, so if i get them looped each one separately, like
Код:
public OnRecordingPlaybackEnd() StartRecordingPlayback(RECORDING_TYPE, RECORDING);
They get desynchronised after few runs.

I was looking for any global/common variable/function scope for those filterscripts, but couldn't find much.
A friend of mine suggested me to use CallRemoteFunction(); stuff which seemed pretty logical solution, so i did it like that:

The chasing NPC has:
Код:
public OnRecordingPlaybackEnd() {
  CallRemoteFunction("NPC_RunAway");
  StartRecordingPlayback(RECORDING_TYPE, RECORDING);
}
and the run-away NPC don't have OnRecordingPlaybackEnd() callback at all, but it has:
Код:
forward NPC_RunAway();
public NPC_RunAway() {

	StartRecordingPlayback(RECORDING_TYPE, RECORDING);
}
The run-away NPC compiles perfectly, but when it comes to the chasing one... it fails.

I just cant call CallRemoteFunction() from inside an NPC script.
I keep getting the standard error 017: undefined symbol "CallRemoteFunction" if my includes go that way:
Код:
#include <a_npc>
#include <a_samp>
Wheter i try to reverse the order and include a_samp before a_npc, i get hell load of NPC callback related errors, like the a_npc was never included at all.

Any clues on that will be really appreciated
Reply
#2

Quote:
Originally Posted by Y_Leѕѕ
You can't use CallRemoteFunction in NPC scripts as they're all separate processes.
Thanks for the reply, but i'll try asking slightly more precise

What You say mostly makes sense but.. I'm not any pro pawn hacker, but while speaking of any other languages - most of the time there should be logically possible to make a parent node that can speak to its childnodes, right?

Or a parent object instance, that speaks to it's child objects stored in an enumerable private variable. I did that composition plenty times in prototype.js lol, but that's not the case.

Anyway, i'm looking for any possibly common namespace/variable scope between the game (samp03svr) and the NPC processes (samp-npc) OR a common namespace/variable scope for the NPC processes (samp-npc)

If that's not anyhow possible, i'm looking forward to any suggestions that could possibly guide me on making two NPCs interacting with eachother considering both the approach i thought of (explained in the first post), or any other possible approaches like a global variable that both child processes could have read/write access to.

Or maybe a mysterious, yet unknown to me method of spawning those NPCs?

Thanks
Reply
#3

Thanks for explanation. I'm rather a usually framework-kiddie so i'm not that good at low-level.

Any hints where i can possibly get Your library? Is it anyhow released for public use?

Or do You mean YSF? I remind a topic where it's said (probably by You) that YSF is not compatible/stable with samp-0.3*
Reply
#4

Looks great! Going to take a closer look at it.
Thanks :]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)