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-nmm6 (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-nmm6 (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-nmm6 (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
NPCs not fighting back?
Author Message
Arathil
Apprentice
*

Posts: 1
Likes Given: 1
Likes Received: 0 in 0 posts
Joined: Oct 2016
Reputation: 0



Post: #1
NPCs not fighting back?
I have some NPC guards in a city with a very simple script that fires when they see a flagged criminal player.

Essentially:
ON=@NPCSeeNewPlayer
IF (<SRC.FLAGS>&STATF_CRIMINAL)
ATTACK <SRC.UID>
SAY=Meet your fate, criminal!
...
...
...

It seems to fire correctly, You see a *Guard is attacking Criminal* emote, and the guard gets into war mode, but the NPC doesn't actually start attacking and wanders away.

If the Criminal makes an effort to attack the guard and hits them, then it will fight back as it should. I cannot figure out for the life of me why this is happening. Any ideas?
10-01-2016 04:19 PM
Find all posts by this user Like Post Quote this message in a reply
Kanibal
Master
**

Posts: 255
Likes Given: 6
Likes Received: 30 in 28 posts
Joined: Jun 2012
Reputation: 0



Post: #2
RE: NPCs not fighting back?
.GM and .INVUL must be off Big Grin

Grandmaster Localhost Admin
10-01-2016 09:16 PM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
x77x
Master
**

Posts: 488
Likes Given: 0
Likes Received: 15 in 15 posts
Joined: Mar 2012
Reputation: -4



Post: #3
RE: NPCs not fighting back?
it does in to regular accounts too...

its like the memory deletes after a few seconds

Dragons of Time 2000-2020
http://dragonsoftime.com
(This post was last modified: 10-02-2016 01:46 PM by x77x.)
10-02-2016 01:46 PM
Find all posts by this user Like Post Quote this message in a reply
Coruja
Sphere Developer
*****

Posts: 987
Likes Given: 5
Likes Received: 226 in 187 posts
Joined: Jul 2012
Reputation: 7

Dimension Shard

Post: #4
RE: NPCs not fighting back?
I found an problem where guards NPCs already placed on world are not attacking criminal/murderer chars nearby
but I already fixed it on latest build, try using it:
https://ci.appveyor.com/project/coruja74.../artifacts
10-06-2016 08:34 AM
Find all posts by this user Like Post Quote this message in a reply
x77x
Master
**

Posts: 488
Likes Given: 0
Likes Received: 15 in 15 posts
Joined: Mar 2012
Reputation: -4



Post: #5
RE: NPCs not fighting back?
but if hes using the above, i doesnt have a guard brain =P
mine looks like this
Code:
[events e_army_soldier]
ON=@NPCLookAtChar//TO INTERACT WITH NPCS
IF (<SRC.TAG0.MILITARY>)
    IF !(<SRC.TAG0.ARMYNUMBER>==<TAG0.ARMYNUMBER>)
    ATTACK <SRC>
    ELIF (<SRC.FLAGS>&statf_criminal) || (<SRC.KILLS> >= 3 ) || (<SRC.KARMA> <= -2000 )//ATTACK MILITARY CRIMINALS
    Say Beat it military criminal!
    ATTACK <SRC>
    ELIF (<SRC.MEMORYFINDTYPE.0400.LINK> > 040004010)//ATTACK every PLAYER made guild
    ATTACK <SRC>
    ENDIF
ELSEIF (<SRC.FLAGS>&statf_criminal) || (<SRC.KILLS> >= 3 ) || (<SRC.KARMA> <= -2000 )//ATTACK CIVILIAN CRIMINALS
    Say Beat it civilian criminal!
    ATTACK <SRC>
ENDIF

ON=@NotoSend//2 ALLY 5 ENEMY 6 RED    
IF (<SRC.TAG0.MILITARY>)
    IF !(<SRC.TAG0.ARMYNUMBER>==<TAG0.ARMYNUMBER>)
    //IF !<GUILD>
    ARGN1=5
    ELIF (<SRC.TAG0.ARMYNUMBER>==<TAG0.ARMYNUMBER>)
    //ELIF <GUILD>
    ARGN1=2
    ENDIF
ENDIF

ON=@GetHit
IF (<SRC.TAG0.MILITARY>)
    IF (<SRC.TAG0.ARMYNUMBER>==<TAG0.ARMYNUMBER>)
    src.criminal 1
    ENDIF
ENDIF

Dragons of Time 2000-2020
http://dragonsoftime.com
10-06-2016 09:16 PM
Find all posts by this user Like Post Quote this message in a reply
Leonidas
Master
**

Posts: 277
Likes Given: 3
Likes Received: 13 in 12 posts
Joined: May 2013
Reputation: 1



Post: #6
RE: NPCs not fighting back?
Did you ever figure this out because I'm having a similar issue.

Code:
ON=@NPCSeeNewPlayer
IF (<SRC.FLAGS>&statf_criminal) || (<SRC.KILLS> >= 5 )
Say Criminals are not allowed here!
ATTACK <SRC.UID>

They go into war mode, they say "Criminals arent allowed" then they start walking around.
(This post was last modified: 11-05-2016 05:10 AM by Leonidas.)
11-05-2016 05:09 AM
Find all posts by this user Like Post Quote this message in a reply
Coruja
Sphere Developer
*****

Posts: 987
Likes Given: 5
Likes Received: 226 in 187 posts
Joined: Jul 2012
Reputation: 7

Dimension Shard

Post: #7
RE: NPCs not fighting back?
I think it makes more sense use 'brain_guard' (which already attack criminal/murderers nearby) instead use another custom brain with @NPCSeeNewPlayer -> ATTACK

just set brain_guard on NPC and use @NPCSeeNewPlayer -> return 1 if you want skip the internal check (eg: don't attack if outside region X, don't attack targets that doesn't have TAG.LOL, etc)
11-05-2016 01:15 PM
Find all posts by this user Like Post Quote this message in a reply
Anarch Cassius
Master
**

Posts: 273
Likes Given: 19
Likes Received: 10 in 9 posts
Joined: Mar 2012
Reputation: 2



Post: #8
RE: NPCs not fighting back?
The problem is that neither ATTACKER.ADD or ATTACK reliably cause an NPC to attack another NPC anymore. This has made pretty much all NPC fight scripts useless. All my faction AI is broken.

Current Projects: Necromancy SCP overhaul. Custom Faction AI/System. Imbuing.
01-26-2017 04:48 PM
Find all posts by this user Like Post Quote this message in a reply
massis87
Journeyman
*

Posts: 82
Likes Given: 0
Likes Received: 1 in 1 posts
Joined: Jan 2017
Reputation: 0

D&W 8thAge

Post: #9
RE: NPCs not fighting back?
same as cassius, you have to change brain and karma of the npc like u want.
Code:
[CHARDEF C_Guardia_Umana]
NAME=#NAMES_HUMANMALE Guardia Umana
SOUND=snd_HUMAN_M_DIE_01
ID=C_MAN
DESIRES=i_gold,t_wand,t_reagent,t_bone
AVERSIONS=t_TRAP,t_eerie_stuff
CAN=MT_EQUIP|MT_RUN|MT_USEHANDS|MT_WALK
DEF=200
ARMOR=1000
MOVERATE=100
DAM=5,10
TEVENTS=e_Human_guardie_click
CATEGORY=Seven - Npg Razze
SUBSECTION=Guardie Razziali
DESCRIPTION=Guardia Umana

ON=@Create
NPC=BRAIN_animal
STR=150
DEX=500
INT=1
TAG.NAME.HUE=0065
MAXHITS=9000

//EVENTS=+E_Rigenerazione_Fisica


HEALING=100.0
MAGICRESISTANCE=100.0
PARRYING=100.0
SWORDSMANSHIP=100.0
FENCING=100.0
MACEFIGHTING=100.0
TACTICS=100.0
ANATOMY=100.0

KARMA=-2000
FAME={1000 1500}
COLOR=colors_skin

ITEMNEWBIE=i_hair_long
COLOR=colors_hair
ITEMNEWBIE=I_Spada_delle_Guardie_Umane
ITEMNEWBIE=i_platemail_gloves
NAME=Human steel armor
COLOR=0698
ITEMNEWBIE=i_platemail_arms
NAME=Human steel armor
COLOR=0698
ITEMNEWBIE=i_platemail_gorget
NAME=Human steel armor
COLOR=0698
ITEMNEWBIE=i_platemail_chest
NAME=Human steel armor
COLOR=0698
ITEMNEWBIE=i_platemail_leggings
NAME=Human steel armor
COLOR=0698
ITEMNEWBIE=i_cape
NAME=Cape human guard
COLOR=0073e
ITEMNEWBIE=i_SASH
NAME=sash human guard
COLOR=0073e
ITEMNEWBIE=i_shield_round_metal
NAME=Shield human guard
COLOR=0698


////////////////////////////////////////
//--- Evento : @NPCSeeNewPlayer ------//
////////////////////////////////////////

ON=@NPCseenewplayer

    IF (<SRC.FLAGS>&000000001)
       RETURN 1
    ENDIF

    IF <SRC.FINDID.I_Memory_Messaggero>
        RETURN 1
    ENDIF


//--- Attacco su Drow - Vampiro - Efreet ---//
  
   IF (0<src.tag.razzadef>=1) || (0<src.tag.razzadef>=5) || (0<src.TAG.RAZZADEF>=2)
       ATTACK
       IF  <SRC.STAMINA>>0
            SRC.STAMINA=0
         ENDIF      
   ENDIF

this is my custom guard

There are worse ways to understand the sense of the word: no. Ranting
(This post was last modified: 01-26-2017 08:20 PM by massis87.)
01-26-2017 08:19 PM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Anarch Cassius
Master
**

Posts: 273
Likes Given: 19
Likes Received: 10 in 9 posts
Joined: Mar 2012
Reputation: 2



Post: #10
RE: NPCs not fighting back?
Quote:same as cassius, you have to change brain and karma of the npc like u want.

No. I explained in the other thread. NPCs should attack when ordered by script regardless.

ATTACK does not work, this is a bug.

Changing karma is a crude workaround people should have stopped using years ago. We want this user controlable, not relying on the hard code to allow a few predetermined behavoir types.

Current Projects: Necromancy SCP overhaul. Custom Faction AI/System. Imbuing.
(This post was last modified: 01-27-2017 05:13 AM by Anarch Cassius.)
01-27-2017 05:07 AM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


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