Jump to content


Photo

I need a way to store token content


  • Please log in to reply
8 replies to this topic

#1 temnix

temnix
  • Member
  • 983 posts

Posted 06 May 2018 - 04:36 PM

I'm working on a naming function, to give one of many available names to a custom object - a creature. The basic mechanism I described here a few months ago: a name is chosen, and this dialogue option sets a global. When the creature appears, it scans a list of values of that global, and finding the right one fixes its name with SetName(,,,). This name-setting persists in saved games, because it doesn't use tokens. But I also want to name an inventory item this way, to match the creature's name, and here I've been using a token. The item is called, let's say, <ITEM>, and then at some point outside scripts include the action SetTokenObject("creature"). The token and so the item takes on the creature's name. The problem here is that while the name stays on reloads, it disappears if one exits and game and starts it again. The token empties. I'm open to ideas about how to either do this, rename items, without tokens, or where to hang such a list of global checks. With the creature renaming is easy - it has an Override script, finds the matching name and phases out the script. But items don't have running scripts. I don't want to insert this long list into BALDUR.BCS. What else can I hang these checks on?



#2 -humungus-

-humungus-
  • Guest

Posted 07 May 2018 - 03:44 AM

- Use a local var for player1 charname (that will refresh with the new game too) as a conditional flag.

- Add a little snippet of code that will summon an invisible creature and set the flag if is not set. This should guarantee that it executes only one time every time you start a new game or a reload.

- This creature will run your big script with renaming procedures.

- This will probably take some time every time you load/reload. Maybe use a cutscene effect for aesthetic purposes.



#3 temnix

temnix
  • Member
  • 983 posts

Posted 07 May 2018 - 11:09 PM

Yes, I can put the naming inside a minion's script. Good idea.



#4 Almateria

Almateria

    most garbage person

  • Modder
  • 969 posts

Posted 08 May 2018 - 02:38 AM

I'm absolutely loving your topics and how for some reason invisible minions become the easiest solution for anything the engine can't do

 

https://www.kotaku.c...ld-of-warcraft/

 

reminds me of the article



#5 temnix

temnix
  • Member
  • 983 posts

Posted 08 May 2018 - 08:53 AM

You'll forgive me for not reading that article. And you will provide an alternative solution.



#6 Mirandel

Mirandel
  • Member
  • 64 posts

Posted 08 May 2018 - 10:03 AM

I'm absolutely loving your topics and how for some reason invisible minions become the easiest solution for anything the engine can't do

 

https://www.kotaku.c...ld-of-warcraft/

 

reminds me of the article

 

This one is a better illustration to invisible minions :) http://www.shsforums...-scam/?p=602349



#7 -humungus-

-humungus-
  • Guest

Posted 08 May 2018 - 12:35 PM

I'm absolutely loving your topics and how for some reason invisible minions become the easiest solution for anything the engine can't do

 

https://www.kotaku.c...ld-of-warcraft/

 

reminds me of the article

 

This one is a better illustration to invisible minions :) http://www.shsforums...-scam/?p=602349

 

Invisible minions basically circumvent the "event driven programming" limitations of bg2-tobex and bg2ee engine (the triggers are very limited). The engine basically provide some limited actions that can be used to trigger script and the rest is 100% resolved by creature scripts and the main game script.

The trick is that every time you have code that need to execute under some circunstances and is just too big to be firing every time on the main game script then is candidate to execute on a invisible creature. Use a global variable as a flag and a invisible creature as a "trigger" to fire the script.

This is a good example. You have a big chunk of code that circumvent the temporary token limitations setting tokens based on global variables and obviously you don't want that code firing in the game main script.

Just use a creature that will be invoked and run the script one time every time you reload and be happy.



#8 Almateria

Almateria

    most garbage person

  • Modder
  • 969 posts

Posted 08 May 2018 - 02:55 PM

<blockquote class='ipsBlockquote'data-author="temnix" data-cid="602355" data-time="1525798382"><p>
You'll forgive me for not reading that article. And you will provide an alternative solution.</p></blockquote>

You will piss off buddy

#9 temnix

temnix
  • Member
  • 983 posts

Posted 09 May 2018 - 11:52 AM

How can people be so useless? A timeless mystery only geneticists of the future may hope to solve.