SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Plugin Development

Reply
 
Thread Tools Display Modes
Old 11/03/2018, 01:20 PM   #3541
jop9888
Big Clucker
 
Join Date: Mar 2009
Posts: 150
Reputation: 6
Default Re: FCNPC - Fully Controllable NPC

So, i've put some more intensive logging into place and see that when they become invisible, they instantly call FCNPC_OnReachDestination when you use FCNPC_goto on them:

Code:
[14:07:09] [FCNPC_OnReachTaskDest] Gangbot[0][9]: X: 2415.91, Y: -1223.22, Z: 24.62
Code:
[14:07:11] [HandleFCNPCGangBotExitVeh] Gangbot[0][9]: X: NaN, Y: NaN, Z: 24.48
[14:07:11] Calculating route to Node 9 from Node 0 for GangBot_0_9
Code:
[14:07:11] [HandleFCNPCGangBotExitVeh] Gangbot[0][9]: X: NaN, Y: NaN, Z: 24.48
[14:07:11] Calculating route to Node 9 from Node 0 for GangBot_0_9
[14:07:11] Path finding algorithm stopped, path found for destination node: 9
[14:07:11] Path: 0, 1, 11, 10, total dist: 34.00
[14:07:11] Path calculate time: 0:00.3
Hence, it should take at least a minute before the NPC walked though those nodes, but instantly FCNPC_OnReachDestination got called several times as if the NPC is instantly at the desired location.

Code:
[14:07:11] GangBot_0_9 reached his destination, setting up new route...
[14:07:11] Calculating route to Node 36 from Node 21 for GangBot_0_9
[14:07:11] Path finding algorithm stopped, path found for destination node: 36
[14:07:11] Path: 21, 18, 5, 6, 15, 14, 8, 16, total dist: 104.00
[14:07:11] Path calculate time: 0:00.3
jop9888 is offline   Reply With Quote
Old 11/03/2018, 01:49 PM   #3542
jop9888
Big Clucker
 
Join Date: Mar 2009
Posts: 150
Reputation: 6
Default Re: FCNPC - Fully Controllable NPC

Ok so i found the part of code that is causing the bug, but i have no clue why though:

Thanks to NaS i've found my way around the quaternions, so i'am adjusting them for NPC's in vehicles with FCNPC_SetQuaternion.
When i comment the one line where i adjust the quaternions the bug is gone, but i dont adjust the quaternions during the exit time:

Code:
[14:40:31] Quaternions adjusted for gangbot[0][0]
[14:40:33] [FCNPC_OnReachTaskDest] Gangbot[0][0]: X: 2415.91, Y: -1223.43, Z: 24.61
[14:40:35] [HandleFCNPCGangBotExitVeh] Gangbot[0][0]: X: NaN, Y: NaN, Z: 24.47
jop9888 is offline   Reply With Quote
Old 11/03/2018, 02:17 PM   #3543
jop9888
Big Clucker
 
Join Date: Mar 2009
Posts: 150
Reputation: 6
Default Re: FCNPC - Fully Controllable NPC

Ok i found it, since it didn't happen to all the NPC's i found a relation.

It happends to NPC's that drive a greater distance to their last node, then when FCNPC_OnReachDestionation gets called they still have alot of speed and sort of jump out of the vehicle. Then they get bugged.

I've had more problems with this, as it seems FCNPC_OnReachDestination gets called to early, when you stop a NPC that reaches a node in a vehicle, he stops quite a distance before the node itself.

Setting the quarternion of the vehicle makes it crash because i suppose the OnReachDestination got called to early and the NPC's jump out of a vehicle with quarternions set or something?

The problems are gone now i added an extra node close to the end node, so the NPC's don't jump out of their vehicle.
jop9888 is offline   Reply With Quote
Old 15/03/2018, 09:50 PM   #3544
beybedragon
Banned
 
Join Date: Dec 2013
Posts: 38
Reputation: 1
Default Re: FCNPC - Fully Controllable NPC

Dependencies link please!
beybedragon is offline   Reply With Quote
Old 15/03/2018, 11:08 PM   #3545
Freaksken
Gangsta
 
Freaksken's Avatar
 
Join Date: Mar 2009
Location: Belgium
Posts: 612
Reputation: 278
Default Re: FCNPC - Fully Controllable NPC

Quote:
Originally Posted by beybedragon View Post
Dependencies link please!
See this wiki page.
__________________
Always keep in mind that a lot of people are active on this forum in their spare time.
They are sacrificing time they could easily spend on things they would rather do, to help you instead.


[Include] FCNPC A.I. - [Tutorial] Speedometer - [WIP] Single-player-like co-op mission - [Other] List of all my work
Freaksken is offline   Reply With Quote
Old 03/04/2018, 06:19 AM   #3546
maxisaibot
Big Clucker
 
maxisaibot's Avatar
 
Join Date: Jun 2011
Location: Israel
Posts: 64
Reputation: 3
Default Re: FCNPC - Fully Controllable NPC

This functions at under of the FCNPC_OnSpawn

FCNPC_SetInvulnerable
FCNPC_SetAngle
SetPlayerColor

not working. Any solution?
__________________
maxisaibot is offline   Reply With Quote
Old 05/04/2018, 03:25 AM   #3547
Freaksken
Gangsta
 
Freaksken's Avatar
 
Join Date: Mar 2009
Location: Belgium
Posts: 612
Reputation: 278
Default Re: FCNPC - Fully Controllable NPC

I've made a small script in which I've converted the standard NPC pilots and traindrivers to FCNPC.
If anyone is interested, maybe we can add it to the main repository as an example on how to convert standard NPCs to FCNPCs.

@ZiGGi what do you think?
__________________
Always keep in mind that a lot of people are active on this forum in their spare time.
They are sacrificing time they could easily spend on things they would rather do, to help you instead.


[Include] FCNPC A.I. - [Tutorial] Speedometer - [WIP] Single-player-like co-op mission - [Other] List of all my work
Freaksken is offline   Reply With Quote
Old 05/04/2018, 07:48 AM   #3548
ZiGGi
High-roller
 
ZiGGi's Avatar
 
Join Date: Sep 2008
Location: Russia
Posts: 1,736
Reputation: 355
Default Re: FCNPC - Fully Controllable NPC

Quote:
Originally Posted by Freaksken View Post
I've made a small script in which I've converted the standard NPC pilots and traindrivers to FCNPC.
If anyone is interested, maybe we can add it to the main repository as an example on how to convert standard NPCs to FCNPCs.

@ZiGGi what do you think?
It would be nice, just make a Pull Request.
ZiGGi is offline   Reply With Quote
Old 09/04/2018, 06:40 AM   #3549
Dice_
Huge Clucker
 
Dice_'s Avatar
 
Join Date: Sep 2015
Location: Indonesia
Posts: 489
Reputation: 56
Default Re: FCNPC - Fully Controllable NPC

I'm currently using ColAndreas and want to use the latest FCNPC version,do I really need to load MapAndreas and ColAndreas at the same time? I'm sure it will cause high usage of ram.
__________________
Dice_ is offline   Reply With Quote
Old 09/04/2018, 08:33 AM   #3550
ZiGGi
High-roller
 
ZiGGi's Avatar
 
Join Date: Sep 2008
Location: Russia
Posts: 1,736
Reputation: 355
Default Re: FCNPC - Fully Controllable NPC

Quote:
Originally Posted by Dice_ View Post
I'm currently using ColAndreas and want to use the latest FCNPC version,do I really need to load MapAndreas and ColAndreas at the same time? I'm sure it will cause high usage of ram.
You don't need to load these plugins at the same time.
ZiGGi is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Include] Controllable NPC Lorenc_ Includes 101 02/06/2014 06:08 AM
[Plugin] FCNPC - Fully Controllable NPC sa-mp 0.3x R2 [LCK]Chris Plugin Development 82 16/05/2014 02:16 PM
Controllable HighPitchedVoice Scripting Help 5 25/05/2012 09:38 PM
[?]New SZR fully controllable NOS system Qeux Help Archive 3 17/03/2011 02:24 AM
Controllable NPC Andreq Русский/Russian 5 25/10/2010 07:57 AM


All times are GMT. The time now is 01:13 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.