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
special forces attacking npc with karma < 0
Author Message
Kanibal
Master
**

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



Post: #11
RE: special forces attacking npc with karma < 0
Code:
ON=@NPCSeeNewPlayer
src.timerf 3, f_special_forces_attack // delay 3 sec

[FUNCTION f_special_forces_attack]
forchars <serv.distanceyell>
  if (<npc> && <brain> && (<OBODY> == c_ranger)||<OBODY> == c_ranger_f))
    ref687=<uid>
    forchars <serv.distanceyell>
      if (<karma> < -799)
        ref687.attack <uid>
      endif
    endfor
  endif
endfor

Grandmaster Localhost Admin
(This post was last modified: 02-02-2016 11:18 PM by Kanibal.)
02-02-2016 11:14 PM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
[+] 1 user Likes Kanibal's post
rastrero
Master
**

Posts: 250
Likes Given: 41
Likes Received: 28 in 24 posts
Joined: Jan 2016
Reputation: 3



Post: #12
RE: special forces attacking npc with karma < 0
This code is bad.
U cant put timer like that on npcs or players.
It will not work.

Anyway u dont need to make a forchars or anything if u are going to use @npcseenewplayer
Its not neccesary. The scripts we writte for u are usefull for "talk orders" or other ways, but not in this trigger.

Try this better on your ranger npc script.
Code:
[chardef c_ranger]  /your npc ranger
id, bla bla bal

On=@npcseenewplayer
if (<src.karma> < -799)
attack  //or attack <src>
else
return 1 //this make the npc tp check karma again and again until target go out of range.
endif

Or this other in any npc u want.It makes npcs to attack and call rangers in area for help if they see a criminal.
Code:
On=@npcseenewplayer
if (<src.karma> < -799)
say Help Rangers! Help ME!!!
attack  //or attack <src>
ref500=<src.uid>
forchars 18 //yelldistance
if <tag0.ranger>
attack <src.uid>
endif
endfor
else
return 1 //this make the npc to check again later if karma > -799
endif

i think this is the best way to do what u want...
(This post was last modified: 02-02-2016 11:45 PM by rastrero.)
02-02-2016 11:30 PM
Find all posts by this user Like Post Quote this message in a reply
[+] 1 user Likes rastrero's post
Berkley
Journeyman
*

Posts: 54
Likes Given: 28
Likes Received: 2 in 2 posts
Joined: Jul 2015
Reputation: 0



Post: #13
RE: special forces attacking npc with karma < 0
thanks a lot, Kanibal and Rastrero.
I'm still learning and speak the sphere language with a little akcent :-)

Your help is very useful to gain in scripting.

Great idea, the "help yell" script.

Best regards, Lars
02-03-2016 04:02 PM
Find all posts by this user Like Post Quote this message in a reply
Berkley
Journeyman
*

Posts: 54
Likes Given: 28
Likes Received: 2 in 2 posts
Joined: Jul 2015
Reputation: 0



Post: #14
RE: special forces attacking npc with karma < 0
it it possible to add something like this to the script?

if (<karma> < -799) && ->>not tamed by anyone<<-

Best regards, Lars
02-12-2016 12:11 AM
Find all posts by this user Like Post Quote this message in a reply
Berkley
Journeyman
*

Posts: 54
Likes Given: 28
Likes Received: 2 in 2 posts
Joined: Jul 2015
Reputation: 0



Post: #15
RE: special forces attacking npc with karma < 0
i tried out this but id does not work:

if ((<karma> < -799) && (<ACTPRI> = null))

if karma less -799 and <ACTPRI> is not existing

best regards, Lars
02-16-2016 06:53 AM
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: #16
RE: special forces attacking npc with karma < 0
Try this:
Code:
if ((<karma> < -799) && (!<owner>))

Grandmaster Localhost Admin
02-16-2016 07:06 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
[+] 1 user Likes Kanibal's post
Berkley
Journeyman
*

Posts: 54
Likes Given: 28
Likes Received: 2 in 2 posts
Joined: Jul 2015
Reputation: 0



Post: #17
RE: special forces attacking npc with karma < 0
(02-16-2016 07:06 AM)Kanibal Wrote:  Try this:
Code:
if ((<karma> < -799) && (!<owner>))

Perfect!

many thanks
02-16-2016 07:59 AM
Find all posts by this user Like Post Quote this message in a reply
Khaos
Master
**

Posts: 595
Likes Given: 166
Likes Received: 83 in 51 posts
Joined: Mar 2012
Reputation: 11



Post: #18
RE: special forces attacking npc with karma < 0
The original post asked for rangers to attack monsters, not players. Also @SeeNewPlayer?! It should be @NPCSeeNewPlayer.

Just put this on your ranger's. Attach it in their core code or use events. Whichever you choose. Technically this is NOT what you asked for. If you get into more detail I can script what you originally wanted. You asked for Ranger's WITHIN Yell distance to attack for your char. This script works a bit different. This will fire off with a ranger in a sector that is not asleep. It will attack anything -800 or worse in karma and call for aid of other rangers within yell distance to attack that same target.

Code:
// This fires when a Mobile looks at ANY character (not just a player).
on=@NPCLookAtChar
if (<src.karma> > -800)
return 1 // We want to keep looking for evil.
endif

if (<src.isowner> == 1)
return 1 // I won't attack my owner if I am hired.
endif

attack <src.uid> // We will attack the mobile we see

ForChars <serv.distanceyell> // more accurate if you parse a different value.
if (<src.baseid> == c_ranger) || (<src.baseid> == c_ranger_f)
  attack <src.uid>
endif
endfor

Code:
[speech spk_ranger_aid]
on=*Help*
if (!<isowner>)
return 1
endif

forChars <serv.distanceyell>
if (<<local._for>.npc> != 0) && (<<local._for>.uid.karma> < -799)
   attack <<local._for>.uid>
   return 0
endif
endfor

I think this is more what you were looking for. Add this via tspeech. When the NPC's hears a player yell for HELP. It will attack the first EVIL NPC within yell distance.

This can be refined more to store the players position and ranger's and only attack things within that distance. Though, we are getting awfully technical at that point.
(This post was last modified: 03-02-2016 04:26 AM by Khaos.)
02-17-2016 05:03 PM
Find all posts by this user Like Post Quote this message in a reply
Khaos
Master
**

Posts: 595
Likes Given: 166
Likes Received: 83 in 51 posts
Joined: Mar 2012
Reputation: 11



Post: #19
RE: special forces attacking npc with karma < 0
Fixed a typo in the for call. I was too tired last night writing this. Sorry ^_^
02-18-2016 09:12 AM
Find all posts by this user Like Post Quote this message in a reply
Berkley
Journeyman
*

Posts: 54
Likes Given: 28
Likes Received: 2 in 2 posts
Joined: Jul 2015
Reputation: 0



Post: #20
RE: special forces attacking npc with karma < 0
(02-17-2016 05:03 PM)Khaos Wrote:  The original post asked for rangers to attack monsters, not players. Also @SeeNewPlayer?! It should be @NPCSeeNewPlayer.

Using Forchars also checks <distanceyell> in characters. Just use FOR.

Just put this on your ranger's. Attach it in their core code or use events. Whichever you choose. Technically this is NOT what you asked for. If you get into more detail I can script what you originally wanted. You asked for Ranger's WITHIN Yell distance to attack for your char. This script works a bit different. This will fire off with a ranger in a sector that is not asleep. It will attack anything -800 or worse in karma and call for aid of other rangers within yell distance to attack that same target.

I think this is more what you were looking for. Add this via tspeech. When the NPC's hears a player yell for HELP. It will attack the first EVIL NPC within yell distance.

This can be refined more to store the players position and ranger's and only attack things within that distance. Though, we are getting awfully technical at that point.

Very nice! I think this works fine on my server. Many thanks for this.

Best regards, Lars
02-25-2016 04:12 AM
Find all posts by this user Like Post Quote this message in a reply
[+] 1 user Likes Berkley's post
Post Reply 


Forum Jump:


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