Skip to content

Problems with script names

chimericchimeric Member Posts: 1,163
On occasion the game - and I mean Near Infinity here, but while playing it happened as well - refused to recognize script names of my creatures. I make a CRE called Horga, the script name is "horga," right there, saved and everything, yet all scripts show warnings that such a name is not found and fail.

And what is happening right now is that a script refers to a wrong creature. There is Nexlit the Xvart with script name "nexlit," allegiance normally NEUTRAL, and a copy I made to use in another area, with a somewhat different Name1 and allegiance GOODBUTBLUE. The copy also had the "nexlit" script name at first, though not used for anything, and maybe this is why all scripts that refer to Nexlit, that is, the first file, began to point to the second file - because it's newer. Or maybe that was not the reason. In any event, they all show /// The other Name1, so pointing to the second file when "nexlit" is given. This continues to happen even now after I have changed the script name of the second file to "nextlit2."

Why is this happening and how can I stop it?

Comments

  • badungubadungu Member Posts: 53
    There is currently a bug in NI, the script names aren't reloaded on the fly, you'll have to close and reopen NI, after you've changed a script name...

    Script names should be unique, the name is a unique identifier for a creature, if you're using it multiple times it could lead to problems, NI does the right thing here, it lists the first creature with the scriptname found... ;)
  • chimericchimeric Member Posts: 1,163
    edited May 2017
    No, it lists the second creature. The original is the first one. And exiting/reloading doesn't help.

    Besides, there are sometimes reasons for a script name that isn't unique. For example, if you're spawning creatures off-screen, which is the coolest way to make someone appear, how do you make them come to the party or attack a character? You could script them, but then you'd have to make separate scripts and it isn't flexible. Instead I just string along CreateCreateOffscreen() + ActionOverride() + CreateCreateOffscreen() to command them as the name begins to change owners.
  • WarChiefZekeWarChiefZeke Member Posts: 2,651
    chimeric said:

    No, it lists the second creature. The original is the first one. And exiting/reloading doesn't help.

    Besides, there are sometimes reasons for a script name that isn't unique. For example, if you're spawning creatures off-screen, which is the coolest way to make someone appear, how do you make them come to the party or attack a character? You could script them, but then you'd have to make separate scripts and it isn't flexible. Instead I just string along CreateCreateOffscreen() + ActionOverride() + CreateCreateOffscreen() to command them as the name begins to change owners.

    Care to share scripts for doing such things? ;)
  • chimericchimeric Member Posts: 1,163
    edited May 2017

    Care to share scripts for doing such things? ;)

    What things? Spawning creatures off screen? It's a regular action. You could write, for example, at the conclusion of a reply in a dialogue, just before EXIT:

    DO ~CreateCreatureOffScreen("creature",N) ActionOverride("scriptname",MoveToObjectOffset(Nearest[PC],[5.5.])) CreateCreatureOffScreen("creature",N) ActionOverride("scriptname",MoveToObjectOffset(Nearest[PC],[5.5.])) CreateCreatureOffScreen("creature",N) ActionOverride("scriptname",MoveToObjectOffset(Nearest[PC],[5.5.]))~

    This will create three creatures and send them all to a point a little to the right and down from the closest PC. MoveToObjectOffset() is a life-saver for telling creatures to go towards someone, because with MoveToObject() they will shove each other and hover about the target uselessly. Of course, you can also use MoveToPoint(), if you have a definite location in mind. I used it for a rotation of couriers in a delivery service: once the party had made a purchase at the store, a nearby courier walked off with EscapeAreaDestroy(10) to imitate dispatch, and a different courier wandered in from a random direction to take his place. They all had the same script name.

    That creatures spawn separately in some random direction may be a drawback of CreatureCreatureOffScreen(). When they start coming, it will be from different corners of the screen. Sometimes this is what you want, if you wish to represent an ambush, but if you want a coherent group walking in as if, for example, answering a call, then you have to use an extra link: first you spawn an invisible creature, and then that creature creates the actors next to itself, orders them and disappears. Like so:

    IF

    OnCreation()

    THEN
    RESPONSE #100

    CreateCreature("creature",[-1,-1],S)
    ActionOverride("scriptname",MoveToObjectOffset(Nearest[PC],[5.5.]))
    CreateCreature("creature",[-1,-1],S)
    ActionOverride("scriptname",MoveToObjectOffset(Nearest[PC],[5.5.]))
    CreateCreature("creature",[-1,-1],S)
    ActionOverride("scriptname",MoveToObjectOffset(Nearest[PC],[5.5.]))
    Wait(1)
    DestroySelf()

    END

    Creatures don't need to See() a PC to walk towards one or attack, they can do it even across the map, but sometimes, spawned off-screen, they appear behind a wall that can't be crossed. There is only a handful of such areas, though, e.g. Candlekeep if you invoke the summons outside. Also, now that I think back on it, invisibles summoning creatures next to themselves (coordinates [-1.-1]) need an animation. They can't be without an avatar, they need to occupy some space. Regular invisibility may be dispelled by accident, so instead I put on these summoners a self-cast opcode 66, "Translucency," at the maximum amount - 255, which is invisible, plus 287, "Remove feet circle." Also you don't want an avatar that casts a shadow, so I go with BEHOLDER_SMALL, beholders cast none.

    It's a bit mysterious and playful to tune down the translucency a bit, to 230 or so. Then some foggy, see-through shape can be glimpsed moving majestically around. :)
    Post edited by chimeric on
Sign In or Register to comment.