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
magery and npc
Author Message
admin phoenix
Master
**

Posts: 354
Likes Given: 1
Likes Received: 23 in 13 posts
Joined: Mar 2012
Reputation: 3



Post: #1
magery and npc
I know if a npc has enough magery he will cast hardcoded spells.
but how do I know which spells the npc will be cast?
is there a chance to define it?
I know there was an option doing it via spellbook?
but long time ago...
I saw that when I give my dragon 100.0 magery he cast spells after spells Smile
what I want to say him, which spellshe should speak....

gr

phoenix
07-19-2012 05:24 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: #2
RE: magery and npc
Its conditional. They start with offensive spells. Unless they are hurt. Then they will heal/cure. I also remember some conditions set for them to use debuffs/buffs (Curse/Bless, etc).

You could just recode your spell system. Anarch Cassius could give you some pointers. His is completely custom.
07-19-2012 06:29 AM
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: #3
RE: magery and npc
http://forum.spherecommunity.net/sshare.php?srt=0&cat=5

You can find it in my AI pack.

Just add the magery (and/or Necro and Chivalry events) and skip the rest of the system. You can copy and/or edit the events to create unique casting patterns.

I do intend to add a system to check the spellbook but that would be using my custom crazy spellbook system.
07-19-2012 12:42 PM
Find all posts by this user Like Post Quote this message in a reply
Q23A
Apprentice
*

Posts: 30
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Apr 2012
Reputation: 0



Post: #4
RE: magery and npc
I have something like this:

[ITEMDEF i_monster_cast]
NAME=Monster cast
ID=i_memory
TYPE=t_eq_script

ON=@CREATE
ATTR=attr_decay|attr_invis

ON=@EQUIP
IF (<MORE2>==101)
TIMERD=34
ELIF (<MORE2>==102)
TIMERD=20
ENDIF

ON=@UNEQUIP

IF (<TAG0.FIZZLE>==1)
RETURN 0
ENDIF

// -===================== if player can see - fizzle ==
IF !(<LINK>==04ffffffff)
IF (!<LINK.CANSEELOS>)
EFFECT 3,14133,5,30,1
RETURN 1
ENDIF
ENDIF


// -========================== Teleport to player ==
IF (<MORE2>==99)
IF (!<LINK.CANSEELOS>)
CONT.P=<LINK.P>
CONT.UPDATE
RETURN 0
ENDIF
ENDIF

// -============================= Attack spells ===
IF (<MORE2>==101)
LINK.SPELLEFFECT s_flamestrike,2000
ELIF (<MORE2>==102)
LINK.SPELLEFFECT s_lightning,2000
ENDIF

ON=@TIMER
REMOVE
RETURN 1
07-19-2012 09:43 PM
Find all posts by this user Like Post Quote this message in a reply
admin phoenix
Master
**

Posts: 354
Likes Given: 1
Likes Received: 23 in 13 posts
Joined: Mar 2012
Reputation: 3



Post: #5
RE: magery and npc
@Anarch Cassius
I think I opend it yesterday and I remember that this script is based on timer?
Q23A script is based on timer for example and this is not what I want.
If you put the magery skill to the npc he will cast every x sec/min. Don´t know from what this this is depented or which trigger is triggered Smile
What about the special action trigger. Can we control the spells with this one?
Maybe it will be nice, if we have a tag.override.spell
there you can put your spell like
tag.override.spell=s_bless|s_fireball
and give the npc the magery skill Smile

Very nice and I like my idea Wink
07-19-2012 11:37 PM
Find all posts by this user Like Post Quote this message in a reply
darksun84
Sir Spamalot
****

Posts: 1,687
Likes Given: 245
Likes Received: 162 in 151 posts
Joined: Mar 2012
Reputation: 35



Post: #6
RE: magery and npc
I just enabled NPC_AI_EXTRA, with the trigger @NPCAction you can set and know the spell you want!
Actarg1 holds the spell.

ON=@NpcAction
if <action> == skill_magery // 25 is magery
say I am Casting <serv.spell.<actarg1>.name> !
return 0
endif


Still, @NpcAction it's called everytime a npc do something, so it can be very laggy or no?

I am super dumb, instead of using @NpcAction you can control spell npc cast with trigger @Spellcast (it does the same thing)

ON=@Spellcast
argn1 = 30
say Casting <serv.spell.<argn1>.name> //always cast lighting

For field spells, you have to set act = 0 otherwise the npc will always fizzle.
(This post was last modified: 07-20-2012 01:41 AM by darksun84.)
07-20-2012 12:54 AM
Find all posts by this user Like Post Quote this message in a reply
admin phoenix
Master
**

Posts: 354
Likes Given: 1
Likes Received: 23 in 13 posts
Joined: Mar 2012
Reputation: 3



Post: #7
RE: magery and npc
@darksun84
yes, that´s a very good solution with spellcast

thanks!
07-20-2012 05:44 AM
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: magery and npc
@admin phoenix. Yes and no. The timers are only for squads, to coordinate healing and group attacks. The casting events in their basic forms use @NPCActFight and other triggers.

@darksun. I don't use @Spellcast because that means letting the default AI decide when its a good time to cast. That's a fine approach but I wanted more control of the behavior of different NPCs.

See the NPCCast function at the bottom of the attack events file in my script. Also look at the functions for various types of spellcasting. That's really the simplest core without any of my AI.
07-20-2012 07:15 AM
Find all posts by this user Like Post Quote this message in a reply
darksun84
Sir Spamalot
****

Posts: 1,687
Likes Given: 245
Likes Received: 162 in 151 posts
Joined: Mar 2012
Reputation: 35



Post: #9
RE: magery and npc
Your system looks impressive !

Do you have any performance issues with it ?
07-20-2012 06:07 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: #10
RE: magery and npc
No but I haven't done serious stress testing. It involves a lot of checks but most of them are pretty streamlined.

This is one reason so many events like potion use and casting are separated, I wanted them addable to NPCs who didn't need the full bulk of the faction AI. The Swarm event in the NPC abilties is meant for factionless animals that fight in groups. It calls all nearby NPCs with the user's type in their desires who aren't already in combat. Attack one animal and the whole herd moves in.
07-21-2012 07:16 AM
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)