Skip to content

Do SetToken() and SetTokenObject() work at all?

chimericchimeric Member Posts: 1,163
Do they?

Comments

  • PaulaMigratePaulaMigrate Member Posts: 1,201
    edited June 2017
    Yes, but values assigned by this action are not stored in saves. Custom tokens need to be reset every time the game is loaded.

    SetToken may have better been named *replace token* while SetTokenObject does what it says.
  • chimericchimeric Member Posts: 1,163
    Thanks. It should still be helpful in a pinch.

    Beamdog, how about a permanent CopyName() action? Would really go for a lot of things.
  • PaulaMigratePaulaMigrate Member Posts: 1,201
    edited June 2017
    If it's only to change a name then SetName would do it. Unless the name is not pre-set and you have something in mind like copy creature stuff. Only kind of reverse like replace the creature but give it the copied name.
  • chimericchimeric Member Posts: 1,163
    No, SetName() requires a definite string number. I suppose you could give it a @X from the TRA file if you were compiling the script from a BAF, and the @X would be the name of some one creature, but that's not copying a name. I want something to latch on to one of the creatures wandering around and change a name into its name, and there is flat no function for that.

    But I've been able to permanently copy a creature's name with SetTokenObject + SetName. My idea was that tokens aren't permanent, so there are going to be blanks and gaps. But recorded names of creatures should stay, if they were copied from another creature whose name is a fixed strref rather than something you insert on the fly and that will be empty on the next reload. Pull someone's name into the token, then set the name of the second one to read from the token, and after a reload there'll be no reason for that change to be unmade. I made two override scripts to put on creatures, identical, really, but they work in some very confusing way. I can't easily wrap my head around tokens, I'll be honest. I perceive them differently and I'm too tired right now. I'm going to publish the scripts and let anyone guess why they work as they do. I can't even understand what's affecting what here.

    Script 1:

    IF True() THEN RESPONSE #100 SetTokenObject("CRENAME",Nearest([0.0.OGRE])) SetName(34854) // <CRENAME> Wait(1) ChangeAIScript("",OVERRIDE) END

    Script 2:

    IF True() THEN RESPONSE #100 SetTokenObject("CRENAME",Nearest([PC])) SetName(34854) // <CRENAME> Wait(1) ChangeAIScript("",OVERRIDE) END

    Again, I'm not in the right state of mind to figure this out, but one of the creatures, depending on how you put on these scripts, cross-wise and what-have-you, takes on the name of the other. And the name remains in the saved game. Whoever wants the honor of discovering just this works - because this could go a long way, e.g. if you want to summon invisible minions with the name of the summoner, for spells, cutscenes and such - should create some item with charges (I made a ring), charge two powers with effect 82 in them with these scripts, type in an ogre and try them every which way.
  • chimericchimeric Member Posts: 1,163
    I did a little more testing and found out that tokens get saved within the same game session, with the method above at least, but reset to nothing the next time you start the game.
Sign In or Register to comment.