Coder Social home page Coder Social logo

woutprovost / fcnpc-ai Goto Github PK

View Code? Open in Web Editor NEW
16.0 7.0 4.0 515 KB

A SA-MP library that adds a simple targeting and threat artificial intelligence system to the NPCs

License: MIT License

Pawn 100.00%
sa-mp include pawn pawn-package sa-mp-library

fcnpc-ai's People

Contributors

woutprovost avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

fcnpc-ai's Issues

Amx Request

Sir since am unable to compile please I need the amx file thats the only thing holding me back please sir it shows that most things are not defined when I tried to compile
Please sir just the amx that's all am asking for

Use npcid instead of custom boss ids

There's not really any good reason to use custom boss ids. They also create a problem that multiple scripts can have the same ids for different bosses and therefore the callbacks can't distinguish between which script the boss id belongs to. When using npcids this is not a problem anymore. It also removes the need to use FAI_GetBossNPCID/FAI_GetBossPlayerID and FAI_GetBossIDFromNPCID/FAI_GetBossIDFromPlayerID when you want to use an FCNPC function on the boss, which is just an unneeded hassle.

Line of Sight

Since FCNPC 2.0 we can use ColAndreas' CA_RayCastLine. Keep in mind situations when ColAndreas isn't included or when ColAndreas isn't inited.

When the NPC is idle, don't aggro when the player is not within LoS.
By default this feature should be disabled.
This stat should specifically be used only when the encounter hasn't been started yet.

native FCNPC_UseAggroLineOfSight(npcid, playerid, bool:use = true);
native bool:FCNPC_IsAggroLineOfSightUsed(npcid, playerid);

Error

Hi sir please sorry to disturb am having errors while trying to compile this
Please help out or give me the amx files
I really need this

Additional way of aggroing with sound

  • New getter and setter for this range
  • Use OnPlayerWeaponShot and FCNPC_OnWeaponShot
  • New function that allows users to let NPCs interpret other 'sounds' that are not weapon shots
  • Consider if a new behaviour has to be made for this, or if it can be merged with an existing one

Only create textdraws when needed

Right now textdraws are created for every boss slot. That means also for empty slots. This is a waste and they should only be created when the npc is created and destroyed when the npc is destroyed.

Also, when a 'show only these textdraws' feature is added, only create the textdraws that are actually going to be shown. For example: don't create the castbar textdraws when the castbar will never be shown for a particular NPC.

No single timer

Don't use a single timer for everything. The amount of used resources should increase with the amount of used NPCs. This means only creating a timer when the NPC is created and destroying it when the NPC is destroyed and don't create everything in advance.

If possible just hook FCNPC_OnUpdate.

Help Required

~~There are 2 include file.

The release has one include file and the The Source has another include file.~~

Which one to use.

Viewing angle

When the NPC is idle, don't aggro when the player is not within a certain viewing angle.
Default viewing angle should be 360.0 degrees.
This stat should specifically be used only when the encounter hasn't been started yet.

native FCNPC_SetAggroViewingAngle(npcid, playerid, Float:angle);
native Float:FCNPC_GetAggroViewingAngle(npcid, playerid);

Alert other NPCs in range

When an NPC aggroes a player for the first time, alert other NPCs in range.
Alternatively, when the NPC has a target, it will alert any other NPCs in range, until the encounter ends.

Maybe both can be implemented using an enum in which 3 types are defined:

  • don't alert
  • alert on first aggro
  • alert until encounter end

Also need functionality in which we can toggle responding to this alert on or off.

License

Choose a fitting license for this repository.

Lot of errors when included

I put up this include and alot of error came up.. im on 0.3.7-r2 server. And i also have working FCPNC plugin.

Aggro/threat

Currently the boss will only switch to another player if his target becomes invalid. You can't for example overaggro right now. The only thing you can do right now is manually switch the target with FAI_SetBossTarget.

Hook FCNPC functions instead of using custom Create/DestroyBoss functions

The custom create and destroy functions are stupid and should be replaced with hooking the FCNPC functions. The reason I previously decided to use custom functions was because I had long 'constructor' functions that had the possibility to set every variable. Since those long constructors are gone now, there's not really a point to not make it easier and hook the FCNPC functions.

FAI_INVALID_BOSS_ID will be replaced by INVALID_PLAYER_ID and FAI_MAX_BOSSES will be replaced by MAX_PLAYERS.

I should also look into how gmx would affect this change, since NPCs don't disconnect and reconnect on gmx and FCNPC_Create then just returns the npc id. Trying a fs reload doesn't seem to work then.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.