[HELP]NPCs aren't in my pos -
Saw® - 09.11.2013
Hi, I made a timer witch each 4 sec it spawns a zombie (within a callback) :
pawn Код:
//Sorry about the identation when I copy a code here ...
public OnPlayerSpawn(playerid)
{
new target;
if(IsPlayerNPC(playerid))// if the player is NPC do nothing
{
}
else
{
ZBT[playerid] = SetTimerEx("ZombieBot", 4000, true, "ii", playerid, target);
}
return 1;
}
pawn Код:
forward ZombieBot(playerid, target);
public ZombieBot(playerid, target)
{
CreateRNPC("ZOMBIE");
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x,y,z);
SetRNPCPos(target,x+6.0,y,z);
SendClientMessage(playerid,COLOR_WHITE,"It is in your pos !");
return 1;
}
I'm using RNPC include/plugin
The problem is : the npc is created but can't see npc in my pos...
Re: [HELP]NPCs aren't in my pos -
iJumbo - 09.11.2013
I think you have to
Код:
new npc = CreateRNPC("ZOMBIE");
and then use npc as target
Re: [HELP]NPCs aren't in my pos -
Saw® - 09.11.2013
Thanks ! but it doesn't work , I don't know why...
Re: [HELP]NPCs aren't in my pos -
ServerScripter - 09.11.2013
so as I understand you cannot use any functions of the in callbacks.... only cmds ?
I think there is a problem in SetRNPCPos(target,x+6.0,y,z);
it's like the server doesn't know what target means...
Re: [HELP]NPCs aren't in my pos -
Konstantinos - 09.11.2013
target will be always 0. Like iJumbo said, you need to store the ID CreateRNPC returned and use it.
Re: [HELP]NPCs aren't in my pos -
Saw® - 09.11.2013
I switched to
pawn Код:
forward ZombieBot(playerid, target);
public ZombieBot(playerid, target)
{
new npc = CreateRNPC("ZOMBIE"); // modified this
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x,y,z);
SetRNPCPos(npc,x+6.0,y,z); // modified target to npc don't thing if it has sence...
SendClientMessage(playerid,COLOR_WHITE,"It is in your pos !");
return 1;
}
still have the same problem
Re: [HELP]NPCs aren't in my pos -
Pottus - 09.11.2013
NPC's take lot of effort depending on how complex they are you can not solely rely on the forums for help every time you have a problem. Working with NPC's takes strong problem solving skills, a lot of time and a lot of trail and error.
Re: [HELP]NPCs aren't in my pos -
Saw® - 09.11.2013
Quote:
Originally Posted by [uL]Pottus
NPC's take lot of effort depending on how complex they are you can not solely rely on the forums for help every time you have a problem. Working with NPC's takes strong problem solving skills, a lot of time and a lot of trail and error.
|
Quote:
Originally Posted by Saw®
I switched to
pawn Код:
forward ZombieBot(playerid, target); public ZombieBot(playerid, target) { new npc = CreateRNPC("ZOMBIE"); // modified this new Float:x, Float:y, Float:z; GetPlayerPos(playerid, x,y,z); SetRNPCPos(npc,x+6.0,y,z); // modified target to npc don't thing if it has sence... SendClientMessage(playerid,COLOR_WHITE,"It is in your pos !"); return 1; }
still have the same problem
|
I understand it's very hard , I only want people to help me fixing the error I have nothing related to have script request or... thank u anyway
Re: [HELP]NPCs aren't in my pos -
Pottus - 09.11.2013
Well think about it, your trying to set the NPC position before it's even connected it takes a couple of seconds for that to happen but your trying to set the position right away.
Re: [HELP]NPCs aren't in my pos -
Saw® - 09.11.2013
No I set it after NPC's connection
I'm actually doing this :
1-The player spawns
2-start the ZombieBot timer (Waiting 4 sec).
3-spawing a bot in the player's position .
that's all