SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 27/05/2020, 02:47 PM   #1
jasperschellekens
High-roller
 
jasperschellekens's Avatar
 
Join Date: Dec 2016
Location: Holland
Posts: 1,077
Reputation: 126
Default Pamdex Pathfinder and streamer(objects)

Hi everyone,

I finally got Pamdex's pathfinder to work with my NPC system.
It works perfect for samp default objects but it does not for custom placed objects.
Note: I do not know if this applies for dynamic one's only as I don't use statics but my assumption is that it doesn't work with streamer objects because they aren't static.

Does anyone know a work around for this? To make the pathfinder also calculate paths around streamed objects?

My code:
pawn Code:
//Chase player , playerid is zombie playerid
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
PathFinder_FindWay(playerid, x, y, pos[0], pos[1]);  // Pos[] holds the value of the victim's position

public OnPathCalculated(routeid, success, Float:nodesX[], Float:nodesY[], Float:nodesZ[], nodesSize)
{
    if(success)
    {
        RNPC_CreateBuild(routeid,PLAYER_RECORDING_TYPE_ONFOOT);
        for(new i; i < nodesSize; i++)
        {
            ApplyAnimation(routeid,"RYDER","RYD_DIE_PT1",4.1,1,1,1,1,1);
            RNPC_AddMovement(nodesX[i], nodesY[i], nodesZ[i]+0.3, nodesX[i+1], nodesY[i+1], nodesZ[i+1]+0.3, RNPC_SPEED_WALK);
        }
        RNPC_FinishBuild();
        RNPC_StartBuildPlayback(routeid);
    }
    return 1;
}
__________________
If you want to have your own custom script, or even want to have one of our already released scripts, join our SCRIPTING SERVICES DISCORD, or send me a private message!


Undead Wasteland Roleplay - The year is 1996. San Andreas is a wasteland ruled by the undead. the once so glorius landscape of San Andreas, is now a shattered decayed place that is only a vague memory of the world as we used to know it.
Discord - Website
jasperschellekens is offline   Reply With Quote
Old 27/05/2020, 08:08 PM   #2
Dignity
High-roller
 
Dignity's Avatar
 
Join Date: May 2013
Location: Belgium
Posts: 1,660
Reputation: 1211
Default Re: Pamdex Pathfinder and streamer(objects)

Considering it uses MapAndreas, maybe it's worth a try to switch to ColAndreas and using CA_CreateDynamicObject on custom objects to create collision walls. (natives should be the same been a few years since I converted MapAndreas to ColAndreas)

Other than the above you have no solution - the plugin has no way to "read" the custom objects unless you do the above.
Dignity is offline   Reply With Quote
Old 28/05/2020, 11:38 AM   #3
jasperschellekens
High-roller
 
jasperschellekens's Avatar
 
Join Date: Dec 2016
Location: Holland
Posts: 1,077
Reputation: 126
Default Re: Pamdex Pathfinder and streamer(objects)

ColAndreas is certainly an option for me, but I'm not sure if it's an option for Pathfinder.

This is how Pathfinder is initiated using a MapAndreas address:
pawn Code:
MapAndreas_Init(MAP_ANDREAS_MODE_FULL, "scriptfiles/SAfull.hmap");
printf("MapAndreasAddress: %x", MapAndreas_GetAddress());
PathFinder_Init(MapAndreas_GetAddress(), 100);
// mapAndreasAddress <- mem address of CMapAndreas class

How could I change Pathfinder to work with ColAndreas instead?
__________________
If you want to have your own custom script, or even want to have one of our already released scripts, join our SCRIPTING SERVICES DISCORD, or send me a private message!


Undead Wasteland Roleplay - The year is 1996. San Andreas is a wasteland ruled by the undead. the once so glorius landscape of San Andreas, is now a shattered decayed place that is only a vague memory of the world as we used to know it.
Discord - Website
jasperschellekens is offline   Reply With Quote
Old 28/05/2020, 04:43 PM   #4
NaS
High-roller
 
NaS's Avatar
 
Join Date: Mar 2008
Location: 🇩🇪
Posts: 1,783
Reputation: 619
Default Re: Pamdex Pathfinder and streamer(objects)

It would probably be easier to generate a custom hmap that include your static mappings than to change the plugin to use CA, because you can't simply replace the MA functions with CA functions. MapAndreas and ColAndreas are vastly different.
NaS is offline   Reply With Quote
Old 29/05/2020, 12:14 PM   #5
jasperschellekens
High-roller
 
jasperschellekens's Avatar
 
Join Date: Dec 2016
Location: Holland
Posts: 1,077
Reputation: 126
Default Re: Pamdex Pathfinder and streamer(objects)

Thank you for the information.
I've been searching on how to do it and then I stumbled onto this:
https://github.com/Fleynaro/PathFind...de4ccd35325949

This person has already done it and released it, but I am stuck on how I would make an useable dll and/or inc file. I have no experience in plugin development.
__________________
If you want to have your own custom script, or even want to have one of our already released scripts, join our SCRIPTING SERVICES DISCORD, or send me a private message!


Undead Wasteland Roleplay - The year is 1996. San Andreas is a wasteland ruled by the undead. the once so glorius landscape of San Andreas, is now a shattered decayed place that is only a vague memory of the world as we used to know it.
Discord - Website
jasperschellekens is offline   Reply With Quote
Old 30/05/2020, 05:23 PM   #6
NaS
High-roller
 
NaS's Avatar
 
Join Date: Mar 2008
Location: 🇩🇪
Posts: 1,783
Reputation: 619
Default Re: Pamdex Pathfinder and streamer(objects)

Oh nice.. If you want I can try compiling it and see if it works.
NaS 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
[Plugin] PathFinder by Pamdex pamdex Plugin Development 150 28/07/2020 12:14 PM
Pathfinder for FNCPC? Z3nx31L Scripting Help 1 07/01/2020 10:34 PM
[Plugin] PathFinder jeanluc162 Plugin Development 19 05/09/2015 07:39 PM
Dominator's Object Streamer - a wize and new streamer - invisible objects fix tsha Filterscripts 23 19/09/2009 08:37 PM


All times are GMT. The time now is 09:34 AM.


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