Jump to content

Displaying Global Values in Dialogue?


user826

Recommended Posts

Hey, all. I was wondering if anyone knows if it's possible to display the value of a Global variable in notes and dialogue? Much like how using &PCNAME; will replace the string with the Player's name, is there something I can put to display the value of the Global?

 

For example, let's say I have the Global aaaGLOBBasePrice, which defines the lowest cost of some item or service. The variable can change based on the decisions or actions of the Player. Can I somehow make a vendor say, "I can do it, but it'll cost you &aaaGLOBBasePrice;."? Or give the player a dialogue option like, "[barter] I can offer you &aaaGLOBBasePrice; for it."? This way, the dialogue dynamically reflects the change in price.

 

Thanks for your time!

Link to comment
Share on other sites

Well considering &PCNAME; has its toe in the door so to speak . What if you temporarily set the PC name to your global value ? But of course if it's even possible to set the PC name other than the "ShowNameMenu" ?

 

But anyways ... I'm guessing you have a range of dialogue that you want this global value range on ? Otherwise simply having 10ish different info responses conditionalized by your global wouldn't be that much work ?

 

So I would suggest , if the name swap doesn't work , or something else ? Have a generic topic with the global value ranges conditionalizing multiple info to display.

And make the NPC say this topic in the result script of the dialogue line proceeding it.

Link to comment
Share on other sites

I want to use this for my Vlad's Weapon Depot mod, where you can order custom guns to be built. All the guns cost either 6000 (Tier 3), 7500 (Tier 2), or 10000 (Tier 1) caps, and as originally made, the Player can say something like, "<6,000 caps> Can you build me a gun that [does whatever]?" but I recently changed the 6000, 7500 and 10000 caps to be Globals so that people using economy overhauls can raise or lower that value to match their overhaul mod. It's just that the dialog option will always say <6000/7500/10000 caps> no matter what, because I can't figure out how to display the Global value in its place. I have at least twenty different custom guns and no way to know what value the end user might change the Global to, so conditionalizing a whole bunch of possible topics likely won't be practical.

 

The way it works now isn't a gamebreaker, but it would be a quality-of-life improvement for people who change the Global for whatever reason. I'm not going to lose sleep over it if it's not possible, though.

Link to comment
Share on other sites

Well that is awful nice of you to be thinking down the road like that :thumbsup:

I myself would doubtfully even bother :ermm: . . . other than telling people where to edit such things.

 

But I do like trying to solve Geck puzzles ... seems even more so than actually making a mod for upload.

Anyways ... now that I better understand your intended outcome ... this might be what you are looking for if you had not seen it already ...

https://geckwiki.com/index.php?title=TopicInfoSetNthResponseString

 

Which yes means installing another plugin just for that had you not installed it already. But seeing how this is for future change on your mod , maybe not a big deal putting that onus on the user to decide.

 

I myself am a newb with respect to this new fangled scripting and string variables.

But from what I understand , you can insert a numeric variable to the string as in what this says https://geckwiki.com/index.php?title=ToString

And if it won't accept a global , you could do it from an Int variable in the script that uses these commands , which is set to the global.

 

Hope that helps ... but that is about the extent of my understanding in using that scripting as of yet.

 

Add Edit : Question about the global(s) . . . is it just a multiplier ? Or do you have 20 different globals , 1 for each gun ?

Link to comment
Share on other sites

This is great, thanks! I was hoping there might be a way to do it with vanilla GECK, but it seems not.

 

As for your question, I only have three Globals: aaaGLOBCustomTier1 (10000), aaaGLOBCustomTier2 (7500) and aaaGLOBCustomTier3 (6000) and my 20+ dialogue topics each reference one of those variables.

Link to comment
Share on other sites

This is great, thanks! I was hoping there might be a way to do it with vanilla GECK, but it seems not.

 

As for your question, I only have three Globals: aaaGLOBCustomTier1 (10000), aaaGLOBCustomTier2 (7500) and aaaGLOBCustomTier3 (6000) and my 20+ dialogue topics each reference one of those variables.

 

Okies one more question ... you created these 3 globals in anticipation you need 3 globals to adjust your 3 tier prices ?

And in your vanilla (original) mod functioning ... you have no need of these 3 globals ?

If you need and are using them ... plz explain how / why their input is used.

Link to comment
Share on other sites

All of the 20+ weapons in the mod cost either 6000, 7500, or 10000 caps. When I first made the mod years ago, I just hardcoded the values into the dialogue, so the condition checks if the Player has at least 6000 caps in their inventory, for example. That wasn't a problem, because the dialogue prompt reflected a hardcoded value -- that value was never going to change.

 

But then, I changed the dialogue condition to check the value of a Global variable, removing the condition that checks the Player's inventory for 6000 caps (or whatever the value for that particular gun is). The three Globals were set to the same values as the original condition checked for, but the benefit now is that a player can change the prices without having to individually edit every single line of dialogue. For instance, they can just type "set aaaGLOBCustomTier3 to 500" into the console, and all guns that used to cost 6000 caps will now only cost 500. But the dialogue prompt still says, "<6,000 caps> I'd like to buy Custom Gun #13" even though the gun now only costs 500 caps.

 

All I wanted to know was if there is a way to make the dialogue option change to reflect whatever custom cost the Player changed the Global to, so in this case, to make the dialogue option say, "<500 caps> I'd like to buy Custom Gun #13".

Edited by user826
Link to comment
Share on other sites

Ahhh so when you changed to the global ... was because you wanted the option (even though not dialogue) to adjust the 3 tiers of weap prices ?

And I see a history there in this thinking , hence not just an attempt to change the whole modus operandi .

 

Which I have to say ... trying to institute the string variable to topic. You can go back to hard coded dialogue lines (with that inserted integer) x (Global)

Basically with always inserting Tier 1 / Tier 2 / Tier 3 variable ToString ,,, that creates the dialogue line.

You can simply multiply it by 1 global that sets the economy scale. Global = .1 sets prices to 10% of your vanilla ... Global = 2.0 sets price to 200% of vanilla.

Which the only reason to have the 3 globals ... is if the tier ratio needs changing .

I suspect that would be next to nil ???

Link to comment
Share on other sites

The scaling multiplier idea is a good one. Although seeing as how I don't use third-party engine extensions for my mods, I don't think I can accomplish my goal using only vanilla GECK. I was hoping there was a function that I just didn't know about, kind of like how you can use "%.0f" to pass a value from a script to be displayed in messages, I'd hoped that there would be a way to use something like that to pass a value to a dialogue prompt.

Link to comment
Share on other sites

The scaling multiplier idea is a good one. Although seeing as how I don't use third-party engine extensions for my mods, I don't think I can accomplish my goal using only vanilla GECK. I was hoping there was a function that I just didn't know about, kind of like how you can use "%.0f" to pass a value from a script to be displayed in messages, I'd hoped that there would be a way to use something like that to pass a value to a dialogue prompt.

Did you try what I said about changing the player name ... look all functions concering name changes .

 

cuz then you could use the player name insert.

 

 

Ya needs testing .... you expecting me to test for ya ?

Which I would were my testing itinerary not already full .

Sorry :confused:

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...