Hi I'm looking to Trigger a Random Fight Mechanic for my Map, say I have 4 possible Encounters in Region 001, a Zergling, a Zealot, a Marine, and a SCV.
Each with a 25% chance of being the Unit I Fight, but What if I want 8 Units the First 7 all having a 14.28% chance of being what you Fight and a Rare 8th Encounter with a 0.04% Chance of Fighting.
This needs to be a very Flexible Trigger that I can set up any Percentage for the encounter from 0.01% all the way to a 100% (as in it's the only Encounter) with any Number of Units (from only a Marine being what you can Fight up to Each Unit in StarCraft and Beyond [if you have custom models added]).
Rollback Post to RevisionRollBack
My Projects:
Sorted Multiplayer Leader Board
Card Shuffle Dialog Demo
Air Wars Mass
Blizzard Fan since Starcraft. The Single Player story is AMAZING IMO, I can't wait for the Expansions. In Warcraft 3 I only enjoy the Custom Maps scene (& Blizzards...
I'm look for how to Trigger a RPG style Random Enemy Encounter when you're not in a Town, City, or other Safe Zone. Similar to Final Fantasy Games where there are a Couple of different Enemy's you can fight while exploring the World. In a Forest you have a 50% to Fight a Wolf or a 50% chance it's a Plant type Monster, in a Cave you might face 80% of the time Bat's, 15% of the time a Bear, 5% of the time a Dragon.
Rollback Post to RevisionRollBack
My Projects:
Sorted Multiplayer Leader Board
Card Shuffle Dialog Demo
Air Wars Mass
Blizzard Fan since Starcraft. The Single Player story is AMAZING IMO, I can't wait for the Expansions. In Warcraft 3 I only enjoy the Custom Maps scene (& Blizzards...
I actually started working on such a system about an hour ago, lol.
My idea doing this was having two strings, one for storing unit groups (unit links of all units of the group) and one for storing the chances.
This is how it currently looks like (not tested yet, but that's the basic idea):
Group setup (for each region)
Get random encounter based on setup
The setup would then be used whenever a region is entered.
If you're using Strings to Store the Unit Groups (Unit Links of all Units of the Group) and one for storing the Chances, are you not adding extra steps and making it more complicated. Why not just use Unit Groups from the start and skip the String part, and How do you make a String of the Chance of Encounter do more than Show in a Chat Message the Encounter Rate. So it actually makes the Chance of the Encounter whatever Percent you say it is.
Take an integer make it random 1-4 and if int =1 then spawn boss one and so forth. This is closer to how I had hoped to Set up the Random Encounter's Except with Reals so I can get (with a out of 100.0) 0.04% Chances instead of having to make an Integer (4 out of a 10,000) to get a 4/10,000 = 0.0004 * 100 = 0.04%. With this I could Have 3 Units with a 33.32% of an Encounter, Say a if Real equals 1.0 to 33.32 then create 1 Marine for Player 15, if Real equals 33.33 to 66.64 then create 1 Zergling for Player 15, if Real equals 66.65 to 99.96 then create 1 Zealot for Player 15, if Real equals 99.97 to 100.0 then create 1 Stone Zealot for Player 15.
But I'm not sure how to do the Range the Real or Integer should be Between for it, I can do it as a 1 to 4 since there is only one Number Representing each Unit but that makes them all a 25% of being Encountered but not able to have a unique Percentage of being the Encounter. Maybe there's a way with looping or something similar but I've not figured out how which is why I'm posting here for the HOW TO.
The StarCraft 1 Method would work but it Wastes Map Space and does not allow for Control of what Chance you have to Encounter each Unit.
Thanks to Both of you for the Post.
My Projects:
Sorted Multiplayer Leader Board
Card Shuffle Dialog Demo
Air Wars Mass
Blizzard Fan since Starcraft. The Single Player story is AMAZING IMO, I can't wait for the Expansions. In Warcraft 3 I only enjoy the Custom Maps scene (& Blizzards...
The thing with storing unit groups is that I have to create the units first and in my system the units are created for each battle and after the battle they are dead, so the unit group is empty and I can't get the same encounter again. If you plan to always only fight against one unit at once, you could use a unit link array and a real array where you store your stuff (like unit[0] = bat, chance[0] = 0.5). Then you loop through your chance array and setup a random similar to my picture above:
if your chances sum up to 1 (or 100 or whatever your random number ranges between) then temp will also sum up to that total value (and stop as soon as the random number is reached).
If you have high varity in possible encounters between regions (like one encounter in region one and 20 encounters in region 2) you have ofcourse a lot of array space unused sometimes, that's why I am preferring the string method, but in the core, both ways are the same (since unit links are basically strings).
Reals are not an issue, theirs 2 ways to do it. the easy way is to just convert it using the convert real to int. this will drop all the decimals. the other is to do if(1<=x<2) or a range. so 1.33456756765845 will still trigger as 1 either way u go.
You could also just have a value for each unit, and then divide say 10,000 by the total of those values and that gives you a breakdown of the chance to hit on each of those pieces.
It's not as elegant as specifying a specific odds value, but the higher the number value you give it, the better chance it will have.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Hi I'm looking to Trigger a Random Fight Mechanic for my Map, say I have 4 possible Encounters in Region 001, a Zergling, a Zealot, a Marine, and a SCV. Each with a 25% chance of being the Unit I Fight, but What if I want 8 Units the First 7 all having a 14.28% chance of being what you Fight and a Rare 8th Encounter with a 0.04% Chance of Fighting.
This needs to be a very Flexible Trigger that I can set up any Percentage for the encounter from 0.01% all the way to a 100% (as in it's the only Encounter) with any Number of Units (from only a Marine being what you can Fight up to Each Unit in StarCraft and Beyond [if you have custom models added]).
Don't understand your Question? You are looking for an Library?
@oiisamiio: Go
I'm look for how to Trigger a RPG style Random Enemy Encounter when you're not in a Town, City, or other Safe Zone. Similar to Final Fantasy Games where there are a Couple of different Enemy's you can fight while exploring the World. In a Forest you have a 50% to Fight a Wolf or a 50% chance it's a Plant type Monster, in a Cave you might face 80% of the time Bat's, 15% of the time a Bear, 5% of the time a Dragon.
I actually started working on such a system about an hour ago, lol. My idea doing this was having two strings, one for storing unit groups (unit links of all units of the group) and one for storing the chances.
This is how it currently looks like (not tested yet, but that's the basic idea):
Group setup (for each region)
Get random encounter based on setup
The setup would then be used whenever a region is entered.
Take an integer make it random 1-4 and if int =1 then spawn boss one and so forth.
u can also do it sc1 style and make a pool on the map of bosses and just teleport a random one out to fight.
@Talon0815: Go
If you're using Strings to Store the Unit Groups (Unit Links of all Units of the Group) and one for storing the Chances, are you not adding extra steps and making it more complicated. Why not just use Unit Groups from the start and skip the String part, and How do you make a String of the Chance of Encounter do more than Show in a Chat Message the Encounter Rate. So it actually makes the Chance of the Encounter whatever Percent you say it is.
@SoulTaker916: Go
Take an integer make it random 1-4 and if int =1 then spawn boss one and so forth. This is closer to how I had hoped to Set up the Random Encounter's Except with Reals so I can get (with a out of 100.0) 0.04% Chances instead of having to make an Integer (4 out of a 10,000) to get a 4/10,000 = 0.0004 * 100 = 0.04%. With this I could Have 3 Units with a 33.32% of an Encounter, Say a if Real equals 1.0 to 33.32 then create 1 Marine for Player 15, if Real equals 33.33 to 66.64 then create 1 Zergling for Player 15, if Real equals 66.65 to 99.96 then create 1 Zealot for Player 15, if Real equals 99.97 to 100.0 then create 1 Stone Zealot for Player 15.
But I'm not sure how to do the Range the Real or Integer should be Between for it, I can do it as a 1 to 4 since there is only one Number Representing each Unit but that makes them all a 25% of being Encountered but not able to have a unique Percentage of being the Encounter. Maybe there's a way with looping or something similar but I've not figured out how which is why I'm posting here for the HOW TO.
The StarCraft 1 Method would work but it Wastes Map Space and does not allow for Control of what Chance you have to Encounter each Unit. Thanks to Both of you for the Post.
The thing with storing unit groups is that I have to create the units first and in my system the units are created for each battle and after the battle they are dead, so the unit group is empty and I can't get the same encounter again.
If you plan to always only fight against one unit at once, you could use a unit link array and a real array where you store your stuff (like unit[0] = bat, chance[0] = 0.5). Then you loop through your chance array and setup a random similar to my picture above:
if your chances sum up to 1 (or 100 or whatever your random number ranges between) then temp will also sum up to that total value (and stop as soon as the random number is reached).
If you have high varity in possible encounters between regions (like one encounter in region one and 20 encounters in region 2) you have ofcourse a lot of array space unused sometimes, that's why I am preferring the string method, but in the core, both ways are the same (since unit links are basically strings).
@DaFunk86: Go
Reals are not an issue, theirs 2 ways to do it. the easy way is to just convert it using the convert real to int. this will drop all the decimals. the other is to do if(1<=x<2) or a range. so 1.33456756765845 will still trigger as 1 either way u go.
You could also just have a value for each unit, and then divide say 10,000 by the total of those values and that gives you a breakdown of the chance to hit on each of those pieces.
It's not as elegant as specifying a specific odds value, but the higher the number value you give it, the better chance it will have.