GregTheEgg
GregTheEgg
CC#
Created by GregTheEgg on 7/17/2024 in #help
attempting to solve error, need help :(
the main issue is coming from the bottom (the result2) as it's never decreasing the counter somehow
3 replies
CC#
Created by GregTheEgg on 7/17/2024 in #help
attempting to solve error, need help :(
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class enemyScript : MonoBehaviour
{
[SerializeField] Interact inter;
[SerializeField] Image healthBar;
int random;
public int[] combo = new int[3];
public int health;
int counter = 0;
int buff = 0;
int damageActive = 0;
[SerializeField] Text text;
void Start()
{
// This is just for grabbing variables from the Interact script
text.text = health.ToString();

}
void enemyHealthBar(){
healthBar.fillAmount = (health/100f)*3.3333333333f;
}
void healthChange(int eHealth, int pHealth){
inter.health = inter.health - pHealth;
health = health - (eHealth + (buff * damageActive));
text.text = health.ToString();
inter.playerHealthBar();
enemyHealthBar();
}
void damageBuffStart(){
Debug.Log("damage+ buff active");
damageActive = 1;
buff = 3;

}

// Update is called once per frame
void Update(){
if (inter.value > 0){
random = Random.Range(1,4);
string result = (inter.value, random) switch
{
(1, 3) or (2, 1) or (3, 2) => "win",
(1, 2) or (2, 3) or (3, 1) => "lose",
(1, 1) or (2, 2) or (3, 3) => "tie",
_ => "default case because I hate yellow squiggly lines"
};
Debug.Log("Player picked " + inter.value + " and AI picked " + random + " the result is a " + result);
if (result == "win"){
healthChange(3,1);
} else if (result == "lose"){
healthChange(1,3);
} else {
healthChange(2,2);
}
if (damageActive == 1){
buff--;
}
Debug.Log(counter);
try {
combo[counter] = inter.value;
} catch {
Debug.Log(result2);
}
if (counter == 1){
int result2 = (combo[1], combo[2], combo[3]) switch {
(1,2,1) => 1, // Damage buff
(2,2,3) => 2,
(2,1,3) => 3,
_ => 0
};
Debug.Log(result2);
if (result2 == 1){
damageBuffStart();
counter = 0;
} else {
counter = 0;
}
} else {
counter++;
}
inter.value = 0;
}
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class enemyScript : MonoBehaviour
{
[SerializeField] Interact inter;
[SerializeField] Image healthBar;
int random;
public int[] combo = new int[3];
public int health;
int counter = 0;
int buff = 0;
int damageActive = 0;
[SerializeField] Text text;
void Start()
{
// This is just for grabbing variables from the Interact script
text.text = health.ToString();

}
void enemyHealthBar(){
healthBar.fillAmount = (health/100f)*3.3333333333f;
}
void healthChange(int eHealth, int pHealth){
inter.health = inter.health - pHealth;
health = health - (eHealth + (buff * damageActive));
text.text = health.ToString();
inter.playerHealthBar();
enemyHealthBar();
}
void damageBuffStart(){
Debug.Log("damage+ buff active");
damageActive = 1;
buff = 3;

}

// Update is called once per frame
void Update(){
if (inter.value > 0){
random = Random.Range(1,4);
string result = (inter.value, random) switch
{
(1, 3) or (2, 1) or (3, 2) => "win",
(1, 2) or (2, 3) or (3, 1) => "lose",
(1, 1) or (2, 2) or (3, 3) => "tie",
_ => "default case because I hate yellow squiggly lines"
};
Debug.Log("Player picked " + inter.value + " and AI picked " + random + " the result is a " + result);
if (result == "win"){
healthChange(3,1);
} else if (result == "lose"){
healthChange(1,3);
} else {
healthChange(2,2);
}
if (damageActive == 1){
buff--;
}
Debug.Log(counter);
try {
combo[counter] = inter.value;
} catch {
Debug.Log(result2);
}
if (counter == 1){
int result2 = (combo[1], combo[2], combo[3]) switch {
(1,2,1) => 1, // Damage buff
(2,2,3) => 2,
(2,1,3) => 3,
_ => 0
};
Debug.Log(result2);
if (result2 == 1){
damageBuffStart();
counter = 0;
} else {
counter = 0;
}
} else {
counter++;
}
inter.value = 0;
}
}
}
3 replies
CC#
Created by GregTheEgg on 7/16/2024 in #help
Need help compressing an RPS system
that works
8 replies
CC#
Created by GregTheEgg on 7/16/2024 in #help
Need help compressing an RPS system
ooh
8 replies
CC#
Created by GregTheEgg on 7/16/2024 in #help
Need help compressing an RPS system
what's tuples?
8 replies
CC#
Created by GregTheEgg on 7/16/2024 in #help
Need help compressing an RPS system
:Sadge:
8 replies
CC#
Created by GregTheEgg on 7/16/2024 in #help
Need help compressing an RPS system
I'm really struggling to think of ways to compress the code
8 replies
CC#
Created by GregTheEgg on 7/10/2024 in #help
✅ anyone know why I'm getting this error
nvm goti t
2 replies
CC#
Created by GregTheEgg on 7/10/2024 in #help
✅ Variable access help :(
ah cool thanks again
27 replies
CC#
Created by GregTheEgg on 7/10/2024 in #help
✅ Variable access help :(
should I delete my post now or do I just leave it
27 replies
CC#
Created by GregTheEgg on 7/10/2024 in #help
✅ Variable access help :(
I understand now, thanks 🙂
27 replies
CC#
Created by GregTheEgg on 7/10/2024 in #help
✅ Variable access help :(
oh ok
27 replies
CC#
Created by GregTheEgg on 7/10/2024 in #help
✅ Variable access help :(
or atleast the publics are?
27 replies
CC#
Created by GregTheEgg on 7/10/2024 in #help
✅ Variable access help :(
so it's entirely connected now?
27 replies
CC#
Created by GregTheEgg on 7/10/2024 in #help
✅ Variable access help :(
that worked but then how do I get access to the individual variables?
27 replies
CC#
Created by GregTheEgg on 7/10/2024 in #help
✅ Variable access help :(
ah ok
27 replies
CC#
Created by GregTheEgg on 7/10/2024 in #help
✅ Variable access help :(
which is in basic movement in a seperate script
27 replies
CC#
Created by GregTheEgg on 7/10/2024 in #help
✅ Variable access help :(
trying to access this speed
27 replies
CC#
Created by GregTheEgg on 7/10/2024 in #help
✅ Variable access help :(
No description
27 replies
CC#
Created by GregTheEgg on 7/10/2024 in #help
✅ Variable access help :(
the speed in phones isn't what I'mt rying to access
27 replies