Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Npcs attacking each other
Author Message
Gil Amarth
Journeyman
*

Posts: 189
Likes Given: 2
Likes Received: 1 in 1 posts
Joined: May 2012
Reputation: 0



Post: #1
Npcs attacking each other
I´m thinking about a faction system that allow npcs player attack other npcs, even if there is no player near around.

I had used till now the @NpcSeeNewTrigger to see if there is any enemy nearby, but this is a bit expensive if every npc has to trigger that script every 5 seconds.

What trigger or system would you use to attack npcs with one specified Tag:

For example, how to attack every npc who has TAG.Faction not equal the npc TAG.Faction,
and in a cheap way of course. Tongue

Thanks in advance.
09-24-2014 02:09 AM
Find all posts by this user Like Post Quote this message in a reply
Skul
Master
**

Posts: 413
Likes Given: 0
Likes Received: 19 in 15 posts
Joined: Jun 2012
Reputation: 9



Post: #2
RE: Npcs attacking each other
best option i can provide is a timerf function that loops every minute or two, example:
Code:
[function f_faction_npcattack]
local.uid=<uid>
forchars <serv.distancetalk>
  if (<npc>)
    if (<tag0.faction>)
      uid.<local.uid>.attack=<uid>
      break
    endif
  endif
endfor
timerf 60, f_faction_npcattack
You can chance the interval of timerf to a higher amount to use less resources.

"I ask a question to the answer I already know."

Marchadium :: http://www.marchadium.ca/ :: Join us!
(This post was last modified: 09-24-2014 03:47 AM by Skul.)
09-24-2014 03:46 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Gil Amarth
Journeyman
*

Posts: 189
Likes Given: 2
Likes Received: 1 in 1 posts
Joined: May 2012
Reputation: 0



Post: #3
RE: Npcs attacking each other
Finally I did it with @NPCLookAtChar trigger.

This trigger fires a lot, but it fires every time a npc look other npc, so it is pretty fast in combat situations. But cheap... it is not cheap in resources. Smile
(This post was last modified: 09-24-2014 05:06 PM by Gil Amarth.)
09-24-2014 05:05 PM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


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