I'm using a placeholder trigger to play around with creating random loot. I'm going to modify it later, but so far it looks like the following.
Anyway, my problem is that I'm stuck on trying to figure out how to edit the item's descriptions. How can I randomly set the name of the item? For example, Poisonous Badass Sword of the Bear?
How can I set the descriptions to correspond with the item's stats? For example, if the item was created with a roll of 3 Lethality, how can I make my players know that?
Events
Unit - Any Unit creates a unit with ability Any or behavior No Game Link
Local Variables
Conditions
And
Conditions
((Triggering unit) is Invulnerable) == True
(Number of weapons on (Triggering unit)) == 0
Actions
Unit - Add (Random integer between 0 and 3) Hero - Lethality to (Triggering unit) from (Triggering unit)
Unit - Add (Random integer between 0 and 3) Hero - Brilliance to (Triggering unit) from (Triggering unit)
Unit - Add (Random integer between 0 and 3) Hero - Vitality to (Triggering unit) from (Triggering unit)
Edit: I'm confused, are you having trouble coming up with a way to determine random names or are you trying to figure out how to set an item's name in data via triggers? Either way, wrong forum, but if it's the former, then here is my solution:
local variable lethality_roll = (Random integer between 0 and 3)
local variable brilliance_roll = (Random integer between 0 and 3)
local variable vitality_roll = (Random integer between 0 and 3)
local variable item_name = "Badass Sword"
Unit - Add lethality_roll Hero - Lethality to (Triggering unit) from (Triggering unit)
Unit - Add brilliance_roll Hero - Lethality to (Triggering unit) from (Triggering unit)
Unit - Add vitality_roll Hero - Lethality to (Triggering unit) from (Triggering unit)
if lethality_roll == 3
set item_name = item_name + " of the Tiger"
else if brilliance_roll == 3
set item_name = item_name + " of the Eagle"
else if vitality_roll == 3
set item_name = item_name + " of the Bear"
Display text message for player "You picked up a " + item_name
You have to decide how to handle cases where you roll things like 3 lethality and 3 brilliance. you might choose to add more else-ifs i.e. else if lethality_roll == 3 and brilliance_roll == 3 then item_name = item_name + " of the Trout". You would then have to modify to others to say if lethality_roll == 3 and the others are less than 3 then set it to "of the Tiger." The more prefixes and suffixes you want to add the longer this else-if statement is going to get. In a real programming situation you would use a pre-determined hash that has all of the possible prefixes and suffixes instead of a massive else-if statement, but alas, we are working with triggers.
Thanks for responding. Basically, what I'm trying to figure out is how to set item descriptions based upon its roll.
For example, let's say I picked up an item with +3 Strength and +3 Vitality... how would I know that? There doesn't seem to be a way to modify item tooltips - like, the text that pops up when you hover over something.
Thanks for responding. Basically, what I'm trying to figure out is how to set item descriptions based upon its roll.
For example, let's say I picked up an item with +3 Strength and +3 Vitality... how would I know that? There doesn't seem to be a way to modify item tooltips - like, the text that pops up when you hover over something.
Unfortunately data and triggers don't work very well together. So in your case you will need to create all of the possible items in data (with 3 stats all with possible values 0-3 that is 64 different items) with the appropriate tooltips and have the trigger be used only for deciding what drops. You'd create a global array of items called loot_table or something and set all of its values to a different item during map initialization. Then you can just say when unit dies, create item loot_table[random integer] at location of dying unit.
Upgrades can change tool tips and basically any info stored in the data editor. Then trigger the upgrade to be finished researching.
An important note about changing tool tips with upgrades is that it changes the tool tip you are using and not the content of the tool tip. For example I am using this for easy normal and hard difficulty settings, so for each tool tip there is a hard normal and easy version of it. Example:
Button/Tooltip/GenerateMineralsEasy
50 Minerals per minute
Button/Tooltip/GenerateMineralsNormal
25 Minerals per minute
Button/Tooltip/GenerateMineralsHard
10 Minerals per minute
Seemingly anything that an upgrade changes can be changed in triggers using Catalog functions. You can change them per-player, but you cannot change them per-item. So you can't change a button per item, as far as I can see. However, you could use triggers to change the Highlight Tooltip of the item to display what it does. The Highlight Tooltip shows up when you hover over an item on the ground. Or conversely, you can change the InfoText, which shows up when you select the item in the info pane. Both are changed using "Set Unit Info Text." I recently discovered though that you cannot have both InfoText and a tooltip; if you put InfoText, no tooltip will show up at all. Also, if you want to have a tooltip, make sure in the unit data's Unit Flags "Cannot be Highlighted" is unchecked.
Also, if you do make all of the items in data (which is time consuming but certain to get what you want), I do believe there's a way to make items drop from specific units by using the Loot array in the unit data. I have never tried it though, so look on the forums for more info.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Greetings,
I'm using a placeholder trigger to play around with creating random loot. I'm going to modify it later, but so far it looks like the following.
Anyway, my problem is that I'm stuck on trying to figure out how to edit the item's descriptions. How can I randomly set the name of the item? For example, Poisonous Badass Sword of the Bear?
How can I set the descriptions to correspond with the item's stats? For example, if the item was created with a roll of 3 Lethality, how can I make my players know that?
Events
Unit - Any Unit creates a unit with ability Any or behavior No Game Link
Local Variables
Conditions
And
Conditions
((Triggering unit) is Invulnerable) == True
(Number of weapons on (Triggering unit)) == 0 Actions
Unit - Add (Random integer between 0 and 3) Hero - Lethality to (Triggering unit) from (Triggering unit)
Unit - Add (Random integer between 0 and 3) Hero - Brilliance to (Triggering unit) from (Triggering unit)
Unit - Add (Random integer between 0 and 3) Hero - Vitality to (Triggering unit) from (Triggering unit)
Thanks,
Potfish
@Pottfish: Go
Edit: I'm confused, are you having trouble coming up with a way to determine random names or are you trying to figure out how to set an item's name in data via triggers? Either way, wrong forum, but if it's the former, then here is my solution:
You have to decide how to handle cases where you roll things like 3 lethality and 3 brilliance. you might choose to add more else-ifs i.e. else if lethality_roll == 3 and brilliance_roll == 3 then item_name = item_name + " of the Trout". You would then have to modify to others to say if lethality_roll == 3 and the others are less than 3 then set it to "of the Tiger." The more prefixes and suffixes you want to add the longer this else-if statement is going to get. In a real programming situation you would use a pre-determined hash that has all of the possible prefixes and suffixes instead of a massive else-if statement, but alas, we are working with triggers.
@peranzormal: Go
Thanks for responding. Basically, what I'm trying to figure out is how to set item descriptions based upon its roll.
For example, let's say I picked up an item with +3 Strength and +3 Vitality... how would I know that? There doesn't seem to be a way to modify item tooltips - like, the text that pops up when you hover over something.
Unfortunately data and triggers don't work very well together. So in your case you will need to create all of the possible items in data (with 3 stats all with possible values 0-3 that is 64 different items) with the appropriate tooltips and have the trigger be used only for deciding what drops. You'd create a global array of items called loot_table or something and set all of its values to a different item during map initialization. Then you can just say when unit dies, create item loot_table[random integer] at location of dying unit.
It's either that or live with generic tooltips.
Upgrades can change tool tips and basically any info stored in the data editor. Then trigger the upgrade to be finished researching.
An important note about changing tool tips with upgrades is that it changes the tool tip you are using and not the content of the tool tip. For example I am using this for easy normal and hard difficulty settings, so for each tool tip there is a hard normal and easy version of it. Example:
Button/Tooltip/GenerateMineralsEasy 50 Minerals per minute
Button/Tooltip/GenerateMineralsNormal 25 Minerals per minute
Button/Tooltip/GenerateMineralsHard 10 Minerals per minute
Seemingly anything that an upgrade changes can be changed in triggers using Catalog functions. You can change them per-player, but you cannot change them per-item. So you can't change a button per item, as far as I can see. However, you could use triggers to change the Highlight Tooltip of the item to display what it does. The Highlight Tooltip shows up when you hover over an item on the ground. Or conversely, you can change the InfoText, which shows up when you select the item in the info pane. Both are changed using "Set Unit Info Text." I recently discovered though that you cannot have both InfoText and a tooltip; if you put InfoText, no tooltip will show up at all. Also, if you want to have a tooltip, make sure in the unit data's Unit Flags "Cannot be Highlighted" is unchecked.
Also, if you do make all of the items in data (which is time consuming but certain to get what you want), I do believe there's a way to make items drop from specific units by using the Loot array in the unit data. I have never tried it though, so look on the forums for more info.