Skip to content

A few uses for invisible minions

GoidaGoida Member Posts: 118
edited December 2018 in General Modding
Invisible creatures running scripts are very helpful and for many tasks indispensable. Here are some ways I've been using them which may not be widely known.

Template minion files should be kept on top of your override listing, if you plan to experiment with them a lot. I have standard files in mine which I copy and rename for new uses, each starts with + so that it shows on the very top of the Near Infinity Tree:

+EFF.EFF, a Summon Creature file, "shskull" in Resource 2 so the minion appears without a cloud of smoke;

+MINION.CRE, with the following statistics: Allegiance: NEUTRAL, General: BELT (or another items type to keep them immune to General-targeting spells), 1000 hit points, effects: Immunity to Effect: Damage (to avoid accidental hits and blood splashes), Protection from Creature Type: EVILCUTOFF (to keep enemies from hitting them by accident), NULL_ANIMATION. Sometimes I instead use some animation from the drop-down list, but with additional effects: Remove Animation and/or Remove Feet Circle. Minions with feet circles can be talked to and interacted with. Remove Creature, Self, at some seconds ahead is another good idea to avoid cluttering areas and having forgotten OnCreation actions firing again on reload. The Override Creature Data effect with personal space at 0 helps with strangely unwalkable spots occupied by NULL_ANIMATION creatures, but for big-circle creatures, with regular-size characters walking through them, there are sometimes snags and walkers can get stuck.

+MINION.BCS, the minion's Override script.

Now to the actual uses:

1) Area features without area editing or copies. I think I've seen this done but not often. When you want to put a statue on a town square, a cart on a marketplace, a boat on a shore and later remove them, you can create an item such as a ring, undroppable, with an Instant/While Equipped effect Play Visual Effect, Self. A minion wearing this ring, with all of the above effects to make it undetectable, unattackable and bloodless, will provide the permanent feature you need. The looped effect plays constantly, unlike regular Play Visual Effect uses, it persists in saved games, and, unlike regular map features, you can include animations and looping sounds. It's possible to put several effects on the ring. One can be a lighting-only illumination: use a VVC with a blank BAM and enable Special Lighting and Light Source to create a circle of light, better noticeable in shadows and late hours. With a separate VVC just for the backdrop you can use the Dream Palette and Time-Stopped options to turn the light golden and white respectively without affecting the colors of other, visible animations. With Blended enabled the light is hard and glaring, without it is softer.

Use increased personal space to prevent characters from walking through your feature as though through a mirage. They will have to go around. You will need to test and find out where to center the BAM. When the right script command is given the minion will disappear and free the space. If you want the feature interactive, use a large animation, like a dragon, with the Remove Animation effect, but keep the circle. Don't use DOOMGUARD_LARGE, it has a shadow and sounds.

Here is an example. The picture is not so great, it has no shadow, but this conveys the idea:



2) Phasing scripts in and out. A minion can be given a Delayed Set AI Script effect and so timed to run a different set of actions some time in the future. For example, in five hours of game time you can have a minion spawn a horde of monsters at specified points, proceeding where you want etc. Or you can use a Cast Spell on Condition effect, Self, containing this kind of script replacement, if the monsters need to appear at, say, nighttime. Doing these things with scripts for minions instead of just effects gives you much more control over details. To make a creature activate or deactivate you can switch it between a working script and a blank one.

3) Copying summoner name. A minion listed in the toolset as having no name (-1 or 0) will take on the name of the target of the EFF. Thus, any dialogue that you want to pretend is, say, Montaron's can be started by using the summoning EFF on him, and Montaron will be listed as the speaker (though you won't get the portrait).

4) Token names. If you want to change a minion's name in a flexible way, name it with a custom token. In your Weidu installaton write: COPY_EXISTING ~MINION.CRE~ SAY NAME1 ~"MINIONNAME"~ (actually angle brackets, not quotes in this case, but they don't show here). The minion will end up with a blank token for the name, ready to be filled. Then write in your script:

SetTokenObject("MINIONNAME",LastHitter/LastTalkedToBy/LastSeenBy/Player1 or whoever you want)

The minion will be christened as that object. Make sure to refill the token OnCreation, though, or at any rate every time you intend to use it, because they are emptied on reload. It is even easier to use one of the existing tokens, preferably the "GABBER" (angle brackets not quotes again) token, which is unique in that it is only used in dialogs and gets reset in every dialog that you begin. This makes it safe to use elsewhere. Name the minion "GABBER" (again) in the tp2 and in the script use:

SetGabber(LastSummonerOf/LastSeenBy etc.)

Now you can imitate someone's actions in all contexts. The minion can never copy someone's Major color, though, used in their name, so that may be a giveaway. Use an unobtrusive color like gray and hope no one will notice.

5) Pseudospeak when silenced. If you wish to assign custom sounds to a creature temporarily and want this to be a general method, useful with anyone, you are in tough luck: you must either change their sound lines with scripts, which is irreversible, unless you know just which lines to give them back later, or you have to Silence them. Silence comes with its own issues; unless you negate it briefly to make your creature converse, you have to imitate the conversation. You can do the above for the name, and the invisible minion will do the talking, with LastSummonerOf instead of Myself for all purposes. Excellence requires this pseudospeak to be convincing, though, so you need the full illusion - a pulsing selection circle.

For this use an invisible minion with an animation and a feet circle but with the Remove Animation effect on and with personal space at 0 and write in its script:
JumpToObject(LastSummonerOf)
StartDialog(etc.)
Insubstantial minions land right on top of summoners, so the talk they begin seems to be genuine, with a pulsing circle and all. The circle is even of the right size for the summoner, even if the minion's animation is small. So you could have an animation-erased xvart jump on top of a silenced dragon, and the dragon would flash an immense circle. Just end all branches of the talk with DestroySelf().

6) Back-and-forth shouting. A minion has only one "attachment" in this life - LastSummonerOf. This is its flexible and enduring referent. All other objects you could use are either fixed like Player1 or there is no certainty what they will refer to, like LastSeenBy, LastHitter, Nearest and so on. A minion only really knows its summoner - the target, so if you summon one on a creature to do a series of actions to it, the minion won't know to take account of the state of the party, other enemies and so on.

Example: you use +EFF above from a spell to summon +MINION on an enemy and write some ActionOverride commands to make the enemy's life difficult. But let's say this is a Conjuration/Summoning spell and you also wish you could make the minion recognize that it was cast by a conjurer, if such was the case, and do something extra nasty to the target. How would the minion detect the caster's kit? It won't even know who to look at. You could put a trigger in the minion's script to search for all conjurers in the vicinity, and for spell states and local variables hung on them, but this is slow, unreliable and inflexible. Instead you should summon another minion, this time on the caster, and in its script put all of the profound and clever checks you care to. Then this second minion would shout for the first:
IF

Kit(LastSummonerOf,MAGESCHOOL_CONJURER)
!CheckStatGT(LastSummonerOf,15,INT)

THEN

RESPONSE #1

GlobalShout(3642)
DestroySelf()

END

IF

Kit(LastSummonerOf,MAGESCHOOL_CONJURER)
CheckStatGT(LastSummonerOf,15,INT)

THEN

RESPONSE #1

GlobalShout(8964)
DestroySelf()

END

IF

True()

THEN

RESPONSE #1

GlobalShout(5534)
DestroySelf()

END 
The first minion's code would, naturally, have Heard() checks for all of these options: a specialist without extra smarts, a supersmart specialist and a mage, and proceed accordingly against its own LastSummonerOf. If you were to try and do checks like these through effects, you would be mired in subspells at best. You could also make this work in reverse - have the first minion report on the state of the enemy, e.g. on one of many stats not detected in Apply Effects List, and the second minion would put a custom spell on the party wizard, with bonuses, penalties, rewards and so on.

Minions do their job, if their instructions are clear and simple, quickly and efficiently and go away. Having a set of templates handy, with all the right immunities and safeguards, makes using them not exactly a blast, but simple enough. And they are indispensable for creating atmosphere, like scripts in general. A minion can start a cutscene mode for your unfolding spell. It can force ActionOverride(PlayerX,SetSequence(SEQ_X)) gesturing on the party, which delivers a much more pronounced performance than the Set Animation Sequence opcode. And it can write DisplayStringNoName(Player1,X) for general messages spoken by the engine, the narrator or the gods.

Comments

  • UlbUlb Member Posts: 295
    stumbled in here looking for another thread but this is a very useful one so I'm bumping it for others to see..
  • GoidaGoida Member Posts: 118
    edited March 2019
    Here are a few more uses:

    1) If you want music to stop instantly. You might want to make a spell with a sound effect that would clash with current day-night music, which is calm, or battle music, which is standard-chopchop. If you want to emphasize that sound effect or a dramatic silence, you can put a Summon EFF in the global effects of the spell and write:

    StartMusic(1000,FORCE)
    DestroySelf()

    Less radical changes like QUICK_FADE don't work for non-existant tunes like 1000.

    2) Weather indoors. To have it rain or snow in a building or dungeon summon a minion with:

    AddAreaType(WEATHER)
    Weather(RAIN) or StartRainNow()
    DestroySelf()

    and another, delayed, with RemoveAreaType(WEATHER), or put a timer in the same minion's script to undo the changes. (Only make sure to use Weather(CLEAR) before you remove the WEATHER type, otherwise rain freezes in midair.) You can also switch on the OUTDOOR type to enable spells like Call Lightning or Clairvoyance.

    3) Sick creatures on the caster. Enemies or neutrals or other targets don't know who they have been targeted by, unless it's an attack, and you can't tell them to pursue, act, use items, run away from a specific creature unless you have that creature prewritten in their scripts. The best and sometimes the only way around this is to summon 2+ minions, rather with like the method above: 1 for each of the targets and 1 for the caster. The ones for the targets are waiting for their owners to heard a triggering call, and then they will order them to pursue the summoner of the caller, i.e. of the minion shouting on the caster side.

    Let's say you are making an ability called Scare, which forces everyone around the scaring one save vs. spell or run away for a around. How would you go about that? Horror and other effects like that only make creatures scramble randomly, not retreat, much less specially from that character. You could instead insert a behavior at the empty AREA level with opcode 82, and that would probably be the best way of doing this. But if you are not comfortable with changing the AI, you can instead put EFF-Summon for the spell projectile, at Preset Target, vs. spell, and another EFF-Summon for Self. Then in the home minion's script you would write:

    IF

    OnCreation()

    THEN

    RESPONSE #1

    Shout (12345) (or GlobalShout(12345))
    Wait(2)
    DestroySelf()

    END

    And in the Preset minions':

    IF

    TriggerOverride(LastSummonerOf,Heard([NEUTRAL],12345))

    THEN

    RESPONSE #1

    ActionOverride(LastSummonerOf,RunAwayFromNoInterruptNoLeaveArea(LastSummonerOf(LastHeardBy), 90))
    DestroySelf()

    END

    A final point is that anchors like LastSummonerOf, LastHeardBy, LastAttackerOf and probably all the others of this type get reset and lost when a game is reloaded.
  • jasteyjastey Member Posts: 2,780
    edited March 2019
    A small heads up concerning using invisible cres: In the old engine, only a definite (not too high) number of invisible creatures could be handled. I am not sure the EE can handle more, but at least for lower versions, the Clear Fog of War did only work for a maximum of x (8?) non-party creatures. I.e., adding too many would leave other cutspies in (original game) cutscenes remain in the dark. I am not sure this is expanded/fixed for v2.5.
    EDIT: What I meant was: it is essential that invisible cres of mods always DestroySelf() after they served their purpose.
  • GrammarsaladGrammarsalad Member Posts: 2,582
    jastey wrote: »
    A small heads up concerning using invisible cres: In the old engine, only a definite (not too high) number of invisible creatures could be handled. I am not sure the EE can handle more, but at least for lower versions, the Clear Fog of War did only work for a maximum of x (8?) non-party creatures. I.e., adding too many would leave other cutspies in (original game) cutscenes remain in the dark. I am not sure this is expanded/fixed for v2.5.
    EDIT: What I meant was: it is essential that invisible cres of mods always DestroySelf() after they served their purpose.

    Yeah, last I remember it was 8. And there are certain cut scenes where the other two are used (and won't be visible if those slots are taken up)

    Not sure if this is the case in version 2.5
  • jasteyjastey Member Posts: 2,780
    Yeah, last I remember it was 8. And there are certain cut scenes where the other two are used (and won't be visible if those slots are taken up)

    Not sure if this is the case in version 2.5

    You are right, it was 8 including the NPCs, I think? so, not many possibilities to use clear FoW with invisible cres.
    But also without clear FoW, the number should not go overboard, unless a dev gives the all-clear. :)
  • GoidaGoida Member Posts: 118
    edited March 2019
    The limit only matters for Clear Fog of War. Otherwise you can have hundreds of minions (or other creatures) in an area. You shouldn't, but the engine handles them without difficulty.

    NvaAP1D_gIU.jpg

    What affects performance is if you have complex spawning/destroying algorithms running, shuffling minions about all over. There are more important things to keep in mind with them, for example, that they must have some kind of animation (not NULL_ANIMATION), if you want to use them for actions that require [X.Y] position, like CreateCreatureObjectOffset("minion",Player1,[-50.-50]) or MoveToObjectOffset(Myself,[-50.-50]). The former can be used to create objects and effects exactly where you need them. This can be done with secondary minions. For instance, if your spell involves three giant lightning bolts coming down to strike the ground around the caster, in a triangle, you have no option but to summon an invisible minion1 who will run the action above for the summoner/caster: CreateCreatureObjectOffset("minion2",LastSummonerOf,[-150.-150]) and likewise for two others at the right offset distance, which you have to test for to see what looks best. These secondary minions will have the Play Visual Effect opcode on them, with your lightning, and Remove Self, both Instant/Permanent but the removal under the visual in the list. You can orchestrate all sorts of dramatic sequences this way and also, if necessary, use ActionOverride on the summoner to make him face South, i.e. the camera, gesture, swing a weapon etc.

    But coordinates require an avatar; however, you can equip your minions with the Remove Animation + Remove Feet Circle effects. I usually choose DOOMGUARD, because that one is mostly silent, and your minion will also have immunity to opcode 12, damage, so there is no need to fear accidental fireball hits and hisses out of nowhere. The other action I mentioned, of the MoveToObjectOffset(Myself,[-50.-50]) type, isn't limited to minions, obviously, but with them it can be used to scatter items in an area. If you want some kind of equipment to appear on the ground, you spawn minions with the items in their inventory, put a delayed local variable on them, a few seconds' worth, reduce their movement rate to 1 or 2 and send them walking:

    IF

    Global("MYDEATH","LOCALS",1)

    THEN

    RESPONSE #1

    Kill(Myself)

    END

    IF

    OnCreation()

    THEN

    RESPONSE #1

    MoveToObjectOffset(Myself,[-50.-50])

    RESPONSE #1

    MoveToObjectOffset(Myself,[50.-50])

    RESPONSE #1

    MoveToObjectOffset(Myself,[-50.50])

    RESPONSE #1

    MoveToObjectOffset(Myself,[50.50])

    END

    The equipment will end up dropped more or less randomly around. Again, you have to test everything for movement rate, delay before death and so on to make sure your items aren't dropped too far away or too near where they can get heaped with other lying stuff, and so on. You may also want to Override Creature Data to set their personal space to 0 sometimes so they walk through other creatures.

  • kjeronkjeron Member Posts: 2,368
    Well, areas do eventually overload to the point of corrupting the save file if they have too many creatures. I don't know what the limit is, but I know I've reached it before, and it was less than the maximum value the "Number of Creatures" field could hold.
  • GoidaGoida Member Posts: 118
    I never said there was no limit. But it's whopping huge.
  • GrammarsaladGrammarsalad Member Posts: 2,582
    @Goida
    Can you confirm that the fog of war limit is still 8?
  • kjeronkjeron Member Posts: 2,368
    Can you confirm that the fog of war limit is still 8?
    It is.
  • GoidaGoida Member Posts: 118
    kjeron wrote: »
    Can you confirm that the fog of war limit is still 8?
    It is.

    Now that's not nice, answering a question directed at someone else. The real answer is:

    It is.
  • GoidaGoida Member Posts: 118
    Here is another use I came up with. It solves the problem of "Any point in range" effects and Summon creature. Summon creature opcodes must have a target to establish the LastSummonerOf relationship, usually the target is the caster/user of the item. The need for a summoner means it's impossible to bring a creature into the game without tying it to another. It would be great to just have a straight Create creature effect, with no obligations, but alas. Even if you force a creature to replace itself with someone else, the original must have been summoned with one of the opcodes (unless the creature was present in the area from eternity, obviously).

    Because there needs to be a summoner, Summon creature effects fail if you cast them on a point in space as a Preset target. There is just no one there. If Self is used, however, the creatures appear instantly at the destination as though with the "None" projectile. That is not always good. You can't throw a fire bolt at a point and make it sprout an ogre or have a lightning descend and shake air elementals out of the ether. If you use these custom projectiles, the creatures will pop up on the spot long before the missiles cross the distance, ruining any immersion. With invisible minions, however, there is a way to tie spawning to your own projectile.

    What you need is a hark-back setup: first the spell or item uses a typical Self-targeted Summon effect to instantly and invisibly, as usual, put a minion where your future projectile will go. Then this NULL_ANIMATION character runs its script:

    MakeGlobal()
    ActionOverride(LastSummonerOf,ReallyForceSpellRES("SPELL2","minion"))

    This second spell with your custom projectile will be fired instantly and without additional gestures. When that projectile hits the minion at its proper speed, it will then put it through Replace Self with the actual menials you need or other effects, when and how you want them. Timing is very good here - the whole arrangement is practically seamless.

  • kjeronkjeron Member Posts: 2,368
    Goida wrote: »
    Because there needs to be a summoner, Summon creature effects fail if you cast them on a point in space as a Preset target.
    Well, don't use "Preset Target".

    Set op67 to target:9 (Original Caster).
    Set the projectiles explosion size to 32767 and set Area Flag BIT12 (ignore LOS).
    Set the remaining fields as desired (speed, animation, etc...).
    As long as any creature is within range of the blast (the largest maps top out under 5k IIRC, so someone should always be in range), the caster will summon the creature at the targeted point when the travel animation reaches it.

    Note - this likely won't work on older game versions.
  • GoidaGoida Member Posts: 118
    edited March 2019
    All right. I'll try this. Would be good to have something easier.

    Edit: tried it. Original Caster works like Self, the creature appears next to the caster.
  • kjeronkjeron Member Posts: 2,368
    Which parameter2 are you using for op67? Only 0, 1, or 2 will work.
    Or just try this modified grease spell/projectile:
  • GoidaGoida Member Posts: 118
    Before I test with new settings, won't this method cause one invisible minion to appear for every creature caught in the area of effect?
  • kjeronkjeron Member Posts: 2,368
    Goida wrote: »
    Before I test with new settings, won't this method cause one invisible minion to appear for every creature caught in the area of effect?
    No, but it will if you set the projectile's extended flag BTI31 (Caster affected).
  • GoidaGoida Member Posts: 118
    It works as you say, but I must say I don't understand this. The AOE projectile is supposed to define who receives the effects included in the spell, with "Preset target." "Original caster," like "Self," doesn't have anything to do with the projectile, so why would a minion materialize when someone falls in the scope of the AOE?
  • kjeronkjeron Member Posts: 2,368
    Original Caster does involve the projectile - it affects "Self" when the projectile hits it's target.
  • GoidaGoida Member Posts: 118
    In that case why doesn't a single-target PRO produce the same effect when it strikes a creature? Why does it have to be an AOE?
  • kjeronkjeron Member Posts: 2,368
    A single target PRO cast at a location normally doesn't hit anything, so it never triggers.
Sign In or Register to comment.