Jump to content


Photo

The Specific function and marking a creature

specific specifics creatures marking AI

  • Please log in to reply
9 replies to this topic

#1 temnix

temnix
  • Member
  • 983 posts

Posted 26 July 2016 - 04:47 AM

How does the Specific function work? From the description here: http://gibberlings3....g2/specific.htm it seems that I use it through a script to set the value from SPECIFIC.IDS to what I want on a creature, and that I can extend the file with new entries. (In fact, BGEE with Shaman already added one value that isn't in that example, 250 for Spirit.) Then, apparently, I can use a trigger, also from a script, to check for that integer. However, there is also a Set AI Script action in Effects, and that allows you to change not only the creature's Default or Override scripts, but also its Specific script. The resource window there wants me to point it to a BCS, so to an actual script. My questions are, then:

 

1) Are these two - the integer-setting and checking and the Specific script - one and the same thing or not?

 

2) If they are not, then is there any way to force a change to a value from SPECIFIC.IDS through an effect rather than from inside a script? Suppose - a simpler case - I want to make someone into an Ogre through a spell. That ought to call on RACE.IDS, yes? Well, how do I do that by a spell?

 

2) When does the Specific script kick in? There is not even an entry for such a script in Near Infinity! The creatures have other scripts I can set and unset, but for specifics only a selection of integers from SPECIFIC.IDS.

 

4) More generally, when do all the different script types activate? A creature can have General, Default, Override, Race scripts and more. Override may be what it uses instead of everything else - am I right about this? Well then, what purpose do those others serve? And is there any way to force a switch between them, tell a creature to now use the Race script, for instance?

 

5) If you can answer this, you'll be invaluable, because all this is just about trying to figure out a way to MARK a particular creature by a spell - by setting it to a value in SPECIFIC.IDS or in some other way - so that a script from an outside can later look for that mark and single out that creature. Is there any way to do this at all?



#2 Fiann of the Silver Hand

Fiann of the Silver Hand
  • Member
  • 286 posts

Posted 26 July 2016 - 01:05 PM

A CRE's Specific entry is used by the InMyGroup scripting command by the AI.  It's not really used by vanilla until ToB, and I don't know if or how extensively it's used by the EEs or mods.

 

Generally, it's not a safe place to use as a marker.  Also, iirc, changing an IDS doesn't consider timers, so hoping for a temporary effect would need to rely on another mechanism to revert it to its original setting.

 

You want to use Opcode 265 if coming from a spell, or simply set the Global(LOCALS) on the CRE, then check it from a script with NextTriggerOverride (assuming ToBEx;  dunno if EEs have this yet).

 

edit:

 

Also, don't confuse the scripting levels with the IDS levels;  despite the shared nomenclature, they don't intrinsically have anything to do with each other.  I'm sure at some point in the engine's development, they were going to coincide, like all IDS:Race:Elf were going to get the same script "Elf" in the Script:Race slot, but that obviously fell apart.

 

The different levels of scripting is so groups of creatures can be given the same script, while still allowing for situation specific issues to be customized.  This is why Override tends to be combat scripts, and things like walking up to and talking to Charname are in Default.


Edited by Fiann of the Silver Hand, 26 July 2016 - 01:26 PM.


#3 The Imp

The Imp

    Not good, see EVIL is better. You'll LIVE.

  • Member
  • 5155 posts

Posted 26 July 2016 - 01:46 PM

The different levels of scripting is so groups of creatures ...
No-o. It's so that no matter what happens, the more primal script is always considered first... just like your brains are... the little brain is closer to your spine than the outer layers of your hemispheres, cause you don't want to burn yourself while remembering things from two years ago. Cause your hand slipped onto a hot plate.

Edited by The Imp, 26 July 2016 - 01:47 PM.

Yep, Jarno Mikkola. my Mega Mod FAQ. Use of the BWS, and how to use it(scroll down that post a bit). 
OK, desert dweller, welcome to the sanity, you are free to search for the limit, it's out there, we drew it in the sand. Ouh, actually it was still snow then.. but anyways.


#4 Argent77

Argent77
  • Administrator
  • 1434 posts

Posted 26 July 2016 - 01:48 PM

If you're coding exclusively for the EEs then you can use opcode 328 (Set State). In IWD2 mode (set via Special parameter) you can mark your creature with a value listed in SPLSTATE.IDS. The script trigger CheckSpellState(object, splstate) can be used to check for this mark afterwards.

You can remove the mark later with opcode 337 (Remove effects by opcode) if needed. Specify the effect to remove (i.e. opcode 328) in Param2 and the splstate value from opcode 328 in Param1.

These are pretty advanced coding techniques though, so make sure you understand everything before you attempt to implement it.
 



#5 temnix

temnix
  • Member
  • 983 posts

Posted 26 July 2016 - 01:58 PM

I'd rather fly blind! Well... I'd rather fly fast. But if I can achieve the marking with a simple GLOBAL after all, that's going to make me happy.



#6 Fiann of the Silver Hand

Fiann of the Silver Hand
  • Member
  • 286 posts

Posted 26 July 2016 - 02:00 PM

Is the IWD2EE stuff compatible with BG2EE?  (I've still got fingers crossed one day there'll just be one IE engine.)

The different levels of scripting is so groups of creatures ...

No-o. It's so that no matter what happens, the more primal script is always considered first... just like your brains are... the little brain is closer to your spine than the outer layers of your hemispheres, cause you don't want to burn yourself while remembering things from two years ago. Cause your hand slipped onto a hot plate.
 



Understanding the heirarchical nature of the scripts was presumed. He was asking more about the usefulness of it, not the implementation.

Edited by Fiann of the Silver Hand, 26 July 2016 - 02:39 PM.


#7 temnix

temnix
  • Member
  • 983 posts

Posted 27 July 2016 - 06:54 AM

But let me ask again more pointedly to be sure: will the LOCALS global allow me to select that one particular creature? Because it seems to be about all the creatures in the area. Can I get a quote on how to write that?



#8 temnix

temnix
  • Member
  • 983 posts

Posted 28 July 2016 - 04:22 PM

NextTriggerOverride appears not to be supported. I still don't understand how the LOCALS thing works. Doesn't it set the variable on all creatures in the area? But supposing I use that Set Local Variable effect for something like SetGlobal("TAUNTED","LOCALS",1). If that singles out the creature affected, then how do I check who has that marker from a script? If I just put a GLOBAL trigger in the script, won't it trigger just because someone in the area has been taunted? How do I make it apply to, for example, Nearest, SecondNearest and so - or go through the creatures in another way to find just the one that was hit?



#9 Fiann of the Silver Hand

Fiann of the Silver Hand
  • Member
  • 286 posts

Posted 28 July 2016 - 07:52 PM

Global variables are all stored in one place, and are accessible in a Trigger using Global("whatever","GLOBAL").

Local variables are stored... on the CRE, and are accessible only from that CRE's scripts unless NextTriggerOverride is available. Romance LoveTalks are a good example of Local.

Edited by Fiann of the Silver Hand, 28 July 2016 - 07:53 PM.


#10 temnix

temnix
  • Member
  • 983 posts

Posted 29 July 2016 - 01:30 PM

Okay then. Globals aren't good for marking a particular creature, because they don't refer to anyone in particular. Locals aren't good because they can't be used to find the marked creature except through a function that doesn't exist. My only idea at this point is to give the taunted creature an item for a couple of seconds when the Taunt spell is cast on it, and then search for a Nearest that has that item. The flaw in this plan is that if the the taunted creature's inventory is full, the new item is going to displace whatever there was in the first inventory slot to the ground, and for the PC party that would produce the "lost an item" message, plus clutter the soil. I could hope to avoid this by having the creature equip the token item directly, without it going in the inventory first, in some little-used slot like Cloak, but I don't think there are script actions or effects for that...

 

My OTHER only idea is to extend SPLSTATE.IDS and then... what? Do something else, I guess.

 

P.S. This is not related, but speaking of items left on the ground or corpses, is there any function for cleaning up an area?


Edited by temnix, 29 July 2016 - 02:07 PM.






Also tagged with one or more of these keywords: specific, specifics, creatures, marking, AI