So I put together something that can almost give you custom tokens like in NWN2 - maybe not as good, but something that would work in journal entries, conversations, and whatnot. In order to do so I'm abusing world map pins to hold the "state", since I need a bridge between DAScript and the UI. Token substitution seems to be normally done in the engine, called from the UI, but I don't have access to that.
The main thing is that you'd need to keep these "special" primary world map pins in sync. The primary world map doesn't change too often though, and I think you need to reset them when the game is reloaded. So I figure it's not that onerous and you define your own pin tag to keep from conflicting with other modules. (I altered the world map to hide pins above a certain state value, not just for the "not active" pin state.) It should also work with addins to other campaigns, since you can create child maps, although that might feel a little messy.
I'll release a test version of what I have in a couple of days or so, but mainly I'm just wondering if anybody can think of any problems with doing this or perhaps even an easier way. My main restriction is something that the user can set in DAScript and that the UI can read arbitrarily. E.g., inventory on another container doesn't really work because the UI seems to only know the current container and if I put it in the party's inventory then that would probably be even messier.
A simplified example of the token 2DA columns would be something like this:
- Token (e.g., "class")
- Strref (Tlk reference, String literal, or built-in player/party value like "[race]" where it looks it up itself dynamically).
- PlayerCondition (gender/race/class etc) - Optional.
- ForceHero (for player conditions: use the hero or first player in party)
- StateTag (tag of a map pin to be abused as a token state holder) - Optional
- State. Required state for StateTag in order to match - set in DAScript with WR_SetWorldMapLocationStatus(GetObjectByTag(StateTag), STATE_BASE + someState). - Optional
If it has no condition or states set, then the row is treated as fallback match if nothing else matches.
That way you could have multiple rows with the same token but with exclusive (or first to match) conditions leading to different Strref values that get subbed in.
I'm also still trying to see if I can't let you define a string within DAScript instead of a strref or string in the 2DA. SetName doesn't seem to work on map pins.
Modifié par FollowTheGourd, 08 novembre 2010 - 02:14 .





Retour en haut






