Quantcast
Viewing all articles
Browse latest Browse all 100

Gap in requirements in GUI based game

I have a game that is GUI based, as the questions name implies, and the problem I have is that in a dialogue window, a text can be clicked to execute an event, and once clicked, the event has two outcomes. the character has a multitude of skills, and the text will require the character have a certain number of the skill in order to get the good outcome, otherwise they get the bad outcome. how it works, is that the script generates a number between 0, and the listed variables for the skill test. but the problem is that even if the character has no skill in the required section, they still win the event. I know it's a problem with the scrip, because I ran a test with every skill requirement at one million, and the maximum the character can have is 100, and still came out successful. TLDR: the script has two outcomes, good and bad. the character needs a certain amount of skill to get the good, but they get it regardless. here is the script. var playerholder : GameObject; var player : Player_health; var parent : GameObject; var parentframe : GameObject; var continuebutton : boolean = false; var isachoice : boolean = false; var quitconversation : boolean = false; var nextview : GameObject; var failview : GameObject; var Strength1 = 0; var Strength2 = 0; var Strength3 = 0; var Agility1 = 0; var Agility2 = 0; var Agility3 = 0; var athletics1 = 0; var athletics2 = 0; var athletics3 = 0; var heal1 = 0; var heal2 = 0; var heal3 = 0; var speech1 = 0; var speech2 = 0; var speech3 = 0; var will1 = 0; var will2 = 0; var will3 = 0; var build1 = 0; var build2 = 0; var build3 = 0; var weapons1 = 0; var weapons2 = 0; var weapons3 = 0; var other1 = 0; var other2 = 0; var other3 = 0; var item1 = 0; var item2 = 0; var item3 = 0; var item4 = 0; var item5 = 0; var item6 = 0; var item7 = 0; var good1 = 0; var good2 = 0; var good3 = 0; var good4 = 0; var good5 = 0; var good6 = 0; function Start(){ playerholder = GameObject.FindGameObjectWithTag("Player"); player = playerholder.GetComponent(Player_health); } function OnMouseDown(){ if(continuebutton == true){ nextview.SetActive(true); parentframe.SetActive(false); } if(isachoice == true){ if(player.strength_legs < Random.Range(0,Strength1)){ if(player.strength_arms < Random.Range(0,Strength2)){ if(player.strength_core < Random.Range(0,Strength3)){ if(player.reflexes < Random.Range(0,Agility1)){ if(player.balance < Random.Range(0,Agility2)){ if(player.stealth < Random.Range(0,Agility3)){ if(player.running < Random.Range(0,athletics1)){ if(player.climbing < Random.Range(0,athletics2)){ if(player.vigor < Random.Range(0,athletics3)){ if(player.poison < Random.Range(0,heal1)){ if(player.healing < Random.Range(0,heal2)){ if(player.disease < Random.Range(0,heal3)){ if(player.haggling < Random.Range(0,speech1)){ if(player.persuasion < Random.Range(0,speech2)){ if(player.lying < Random.Range(0,speech3)){ if(player.composure < Random.Range(0,will1)){ if(player.focus < Random.Range(0,will2)){ if(player.command < Random.Range(0,will3)){ if(player.repair < Random.Range(0,build1)){ if(player.construction < Random.Range(0,build2)){ if(player.electronics < Random.Range(0,build3)){ if(player.guns < Random.Range(0,weapons1)){ if(player.explosives < Random.Range(0,weapons2)){ if(player.turrets < Random.Range(0,weapons3)){ if(player.cooking < Random.Range(0,other1)){ if(player.mathematics < Random.Range(0,other2)){ if(player.sewing < Random.Range(0,other3)){ if(player.item_1 < Random.Range(0,item1)){ if(player.item_2 < Random.Range(0,item2)){ if(player.item_3 < Random.Range(0,item3)){ if(player.item_4 < Random.Range(0,item4)){ if(player.item_5 < Random.Range(0,item5)){ if(player.item_6 < Random.Range(0,item6)){ if(player.item_7 < Random.Range(0,item7)){ if(player.good_1 < Random.Range(0,good1)){ if(player.good_2 < Random.Range(0,good2)){ if(player.good_3 < Random.Range(0,good3)){ if(player.good_4 < Random.Range(0,good4)){ if(player.good_5 < Random.Range(0,good5)){ if(player.good_6 < Random.Range(0,good6)){ failview.SetActive(true); parentframe.SetActive(false); }}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}} else{ nextview.SetActive(true); parentframe.SetActive(false); } } if(quitconversation == true){ Destroy(parent); } } the 'isachoice' boolean would be set to true, while 'continuebutton' and 'quitconversation' would be set to false.

Viewing all articles
Browse latest Browse all 100

Trending Articles