Aller au contenu

Photo

Creature AI Question - Have Creature Use Spells Only


  • Veuillez vous connecter pour répondre
34 réponses à ce sujet

#26
ColorsFade

ColorsFade
  • Members
  • 1 267 messages

kevL wrote...

&ps. Another reason to like spawned creatures is that it's easier to modify them later. Like, in the middle of a saved game .... An instanced creature is stored right in the saved module; a blueprint, however, is subject to Override ( and Campaign folder, etc. )


That's a pretty strong argument, right there, for using blueprints. 

I've used script-hidden one time in my module. But reading all of this, I think I'll redo some events and spawn creatures in. 

This does answer a question I had though: I had a debug line writing to the chat window when my Necromancer's AI script runs. I jumped into the module to test a totally different area in the game, and I noticed the Necromancer's AI script was writing to the window. And I was like, "How the heck is that happening?" But as you say, if it's painted down, it's active. And that's not entirely what I want to have happen :)

#27
Tchos

Tchos
  • Members
  • 5 030 messages
kevL's reason is why I do it that way. Once I saw that instances were independent and when I found many occasions to modify their AI, stats, appearances, or anything else, and after seeing how SoZ did it, I switched entirely to spawning, though I don't use the encounter system.

I also had a debug line writing to the window, before I learned that all AI scripts run even in areas you haven't been yet. I believe I documented this when it happened.

#28
luna_hawke

luna_hawke
  • Members
  • 88 messages

kevL wrote...

luna_hawke wrote...

The comment on X2_L_BEH_MAGIC says it will always use magic if set to 100.
I have not confirmed that.

i have a /rather strong/ suspicion those variables are limited to use by the pre-MotB ai, eg. DetermineCombatRound() ... ( not HenchDetermineCombatRound() etc )


Those flags work.
Like if you make a gish, and want them to cast more vs doing melee compbat, use those flags. 
I can't recall though if setting X2_L_BEH_MAGIC will stop melee attacking completely.
I imagine though it would until the creature ran out of spells to use.

#29
ColorsFade

ColorsFade
  • Members
  • 1 267 messages

Tchos wrote...

kevL's reason is why I do it that way. Once I saw that instances were independent and when I found many occasions to modify their AI, stats, appearances, or anything else, and after seeing how SoZ did it, I switched entirely to spawning, though I don't use the encounter system.


Tchos, 

If you aren't using the encounter system at all, are you doing all your spawning then with OnClientEnter and door opening scripts? 

This is most what I'm converting to right now. I've only used two encounter spawns, because in those two instances it was the easiest thing to do. 

#30
Tchos

Tchos
  • Members
  • 5 030 messages
Yes, I use On Client Enter for the majority of them. I have several ways to do it, since I have both a generic On Client Enter script based on the SoZ script that I recommend reading, as well as a second optional script fired from that On Client Enter script that I can use to spawn anything that I don't want to open the area to add.

In rarer cases, I use triggers or conversation nodes to spawn things, almost always out of the player's sight. I hadn't thought of doing it on a door, but that's a good idea.

P.S.  Ah, to clarify why I recommend reading any of the SoZ On Client Enter scripts, it's because if you use their convention, it's very quick and simple.  Specify a resref once, name a waypoint with sp_+[resref], then copy that waypoint as many times as you want for as many spawned instances of that creature as you want.  Repeat for other kinds of creatures.

Modifié par Tchos, 07 avril 2013 - 07:59 .


#31
ColorsFade

ColorsFade
  • Members
  • 1 267 messages

Tchos wrote...Specify a resref once, name a waypoint with sp_+[resref], then copy that waypoint as many times as you want for as many spawned instances of that creature as you want.  Repeat for other kinds of creatures.


That sounds efficient. I'll give it a look. 

#32
Darin

Darin
  • Members
  • 282 messages
I always script-in creatures (not via encounter, but through generic triggers or at the OnClient) so at least they're not using processor until they're there...my next campaign will likely despawn townfolk when you leave town as well, but haven't played with that yet...

#33
Lemenhead22

Lemenhead22
  • Members
  • 17 messages
Just to make sure I'm understanding this whole AI thing correctly...If I made my own special AI conditions and actions in a script called "fancy_ai", all I'd have to do is:

SetLocalString(oTarget, "X2_SPECIAL_COMBAT_AI_SCRIPT", "fancy_ai");

I'm sure I jacked that all up, but if correct, that can be thrown in on any script whatsoever and then oTarget will know to look for a script titled fancy_ai to check what needs to go down???

#34
ColorsFade

ColorsFade
  • Members
  • 1 267 messages

Lemenhead22 wrote...

Just to make sure I'm understanding this whole AI thing correctly...If I made my own special AI conditions and actions in a script called "fancy_ai", all I'd have to do is:

SetLocalString(oTarget, "X2_SPECIAL_COMBAT_AI_SCRIPT", "fancy_ai");

I'm sure I jacked that all up, but if correct, that can be thrown in on any script whatsoever and then oTarget will know to look for a script titled fancy_ai to check what needs to go down???


Yes. 

But you are only half correct. 

What you just wrote is true: that allows the target to look for a script called fancy_ai and run it. 

The caveat is: Inside fancy_ai, you must set a local int to tell the default AI script that YOUR script has successfully run. 

SetLocalInt(oTarget, "X2_SPECIAL_COMBAT_AI_SCRIPT_OK",TRUE);

If you don't set that int at the end of a successful attack in your script, then no matter what fancy_ai does, the default will overwrite it before the round starts. 

#35
Lemenhead22

Lemenhead22
  • Members
  • 17 messages
Thanks, yeah I remember you saying to add that extra SetLocalInt earlier in this thread and in another thread. I appreciate the info. I'll have to store it in my memory bank for the future once I lose my training wheels.