The following warnings occurred:
Warning [2] Use of undefined constant SAPI_NAME - assumed 'SAPI_NAME' (this will throw an Error in a future version of PHP) - Line: 3388 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3388 errorHandler->error
/showthread.php 116 build_archive_link
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/inc/functions.php 3324 build_forum_breadcrumb
/showthread.php 195 build_forum_breadcrumb
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/showthread.php 195 build_forum_breadcrumb






Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
NPC AI Sphere vs RunUO
Author Message
Barnabus
Journeyman
*

Posts: 124
Likes Given: 0
Likes Received: 3 in 2 posts
Joined: Apr 2012
Reputation: 1



Post: #16
RE: NPC AI Sphere vs RunUO
Lets have a look then... Ill start ....

Anyhow, so we would need a line of sight check ..... something simple like below, this is because NPC trigger See New Player, can see through walls, meaning if there is a wall between, the NPC will most likely run into it before it trys get around it.
( If i remeber correctly )

Code:
[FUNCTION CheckLineOfSight]
IF <ARGV[0]>
    REF1=<SERV.UID.<ARGV[0]>>
ENDIF
IF (<CANSEELOS <REF1.P.X>,<REF1.P.Y>,<REF1.P.Z>,<REF1.P.M>>)
    RETURN 0
ELSE
    RETURN 1
ENDIF

so we could go ahead with the trigger NPCSeeNewPlayer

Code:
ON=@NPCSeeNewPlayer
    TAG.LastLookedAt=<SRC.UID>
    IF <CheckLineOfSight <SRC.UID>>
        SAY I see <SRC.UID> and im gonna kill him
        ATTACK
        RETURN 0
    ELSE
        SAY I sense someone but i cannot see them
        GO <HOME> // Go Home or Pathfind ????
        RETURN 1
    ENDIF

The next trigger we have is ACTFOLLOW
Code:
ON=@NPCActFollow
    IF (<REGION.UID>=<SRC.REGION.UID>)
        RETURN 2
    ELSE
        FINDID.i_memory.REMOVE // This is dirty not being specific
        RETURN 1
    ENDIF

Above basically means if the player you are following leaves the region you are in dont follow anymore (Return 1) , Return 2 means follow.

Now I guess we can improvise on this, pathfinding someone would have to test this act follow to find out how clever it really is.

Because if there is no way around we really dont wanna follow, but if there is a way around we do want to follow.

^^ Its a start lets make something out of it !|

Scrambles through revisions to see whats been done on it -


20-08-2006, Nazghul (Changes only for servers with EF_NewPositionCheck on)
- Fixed #304: NPCs are dumber in pathfinding with EF_DiagonalWalkCheck on
(fixed only with EF_NewPositionCheck and EF_WalkCheck on).

21-01-2008, MrSugarCube
- Fixed #1311: NPC Pathfinding failing when EF_DiagonalWalkCheck is enabled.

28-04-2008, MrSugarCube
- Fixed #1394: Advanced pathfinding (NPC_AI_PATH) allowing NPCs to make invalid movements
(for example walking whilst paralyzed). Some other adjustments have also been made,
allowing NPCs to properly assess characters that may be blocking the way (to walk around
them), negotiate corners with EF_DiagonalWalkCheck enabled, and attempt to compensate
when new obstacles block a previously valid path.

09-09-2008, MrSugarCube
- Fixed #1516: NPCs unable to use pathfinding when trying to follow or walk up to another character.

^^ Quite alot of fixed there,
EF_DiagonalWalkCheck and EF_NewPositionCheck and EF_WalkCheck ,,,, looks like a good start

Im gonna have a little test myself

OK, check this out guys as far as im concerned it works fine, I couldnt shake that vampire bat, it just chased me all over.

I did this in sphere.ini...

NPCAI = 0001|0002|0004|0008|0010|0040|00100|00200

Experimental = 01|08|040|080|0100|0400|02000|010000

then i made the event ....
Code:
[EVENTS e_NPCBrains]
ON=@NPCSeeNewPlayer
    TAG.LastLookedAt=<SRC.UID>
    IF <CheckLineOfSight <SRC.UID>>
        SAY I see <SRC.UID> and im gonna kill him
        ATTACK
        RETURN 0
    ELSE
        SAY I sense someone but i cannot see them
        GO <HOME> // Go Home or Pathfind ????
        RETURN 1
    ENDIF

ON=@NPCActFollow
    IF (<REGION.UID>=<SRC.REGION.UID>)
        RETURN 2
    ELSE
        FINDID.i_memory.REMOVE // This is dirty not being specific
        RETURN 1
    ENDIF

I put it on a bat then ran for my life.... I think the NPCAI in sphere ini is good myself..
(This post was last modified: 10-02-2012 08:15 AM by Barnabus.)
10-02-2012 07:26 AM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Messages In This Thread
NPC AI Sphere vs RunUO - WRWR - 07-28-2012, 08:41 PM
RE: NPC AI Sphere vs RunUO - Shaklaban - 07-28-2012, 09:32 PM
RE: NPC AI Sphere vs RunUO - darksun84 - 07-29-2012, 12:59 AM
RE: NPC AI Sphere vs RunUO - WRWR - 07-29-2012, 02:09 AM
RE: NPC AI Sphere vs RunUO - ShiryuX - 07-31-2012, 01:21 PM
RE: NPC AI Sphere vs RunUO - Barnabus - 10-02-2012, 12:22 AM
RE: NPC AI Sphere vs RunUO - JeBu - 10-02-2012, 02:43 AM
RE: NPC AI Sphere vs RunUO - Mordaunt - 10-02-2012, 03:27 AM
RE: NPC AI Sphere vs RunUO - gokku - 10-02-2012, 05:44 AM
RE: NPC AI Sphere vs RunUO - Extreme - 10-02-2012, 07:01 AM
RE: NPC AI Sphere vs RunUO - Shaklaban - 10-02-2012, 07:09 AM
RE: NPC AI Sphere vs RunUO - Extreme - 10-02-2012, 07:23 AM
RE: NPC AI Sphere vs RunUO - Shaklaban - 10-03-2012, 01:42 AM
RE: NPC AI Sphere vs RunUO - Barnabus - 10-02-2012 07:26 AM
RE: NPC AI Sphere vs RunUO - Barnabus - 10-02-2012, 09:52 AM

Forum Jump:


User(s) browsing this thread: 1 Guest(s)