#💻┃code-beginner
1 messages · Page 257 of 1
imma read the docs maybe i can figure it out alone now with the tips you gave me
ty both!
Any ideas on how I could fix this? or amI going to have to program my way around it 😛
Actually someone suggested changing this, oes anyone know what it does?
Okay nevermind I learnt what it does, but It doesnt seem to help.
the point of iterations is to give the physics system the ability to refine the result of a simulation
Yup, got that
okay i have made an advance
Sadly it doesnt seem to fix my issue
think of a simulation like trying to solve a math problem approximately. More iterations lets you put more effort into the solving, which makes it more accurate. But should not fix a problem
if it does fix a problem, then you were really truly fucked
maybe if I crank it really high, but Of course I dont really want to do that becuase of performance
i noticed it actually shoots, but somehow it doenst gives a velocity to the bullet , it rotates it just fine but somehow the velocity does not work
Hrm... Not sure how I can go about fixing this honestly
is your player’s rigidbody collision mode set to continuous or discrete?
yeah. that’s very wrong
OH and this all happens because the bullet actually searches with a tag instead of with getcomponent.
change it
or atleast thats what i think, but i dont know how that would interact with the way the bullet assigns the velocity
Yuup all fixed! Thank you
Honestly, Think im basically done with my entire controller!
here is the part of the code that should be affected by the bug.
if your collision detection mode is set to discrete, you check collision at specific points, instead of like a continuous line. Which means you land inside walls and blocks and shit, instead of going up to them
Gotcha
Worse for performance I assume
but for one character I imagine its negligible
sure. i remember i had the exact same problem, until someone else told me the same solution
hahaha
oral tradition
The control feels super good to use
Some really decent platforming I think. now I guess... art and levels + level mechanics
eesh this is gonna be "fun"
“fun” is code for garbage
My artistic skills are lacking
I could maybe buy some art assets but ehhh I dunno
then if I do still need to make some assets, the style wont match
make it work before you touch art
same with the character I guess
Oh its fully working!
Ive had some people playtesting too ^^
if you are not going to sell it or use it in a game jam and are just learning i dont see having fancy sprites as a must, but it can make the game feel fresh
I wish to potentially sell the game as my first indie game
I rewrote the entire code to be cleaner for future stuff just incase
i could also playtest if you want
Thatway if I make map mechanics that require controller edits, then I can come back and do so easily
Appreciate it, but the test map I have isnt really suitable for it and I am shattered. 2 hours sleep in 48 hours is taking a toll hahaha
Your game should be good without fancy art, and then you add art to enhance.
its a grappling hook based height platformer
I could just grey boy everything for now
and make a bunch of grey assets and replace them with proper sprites later
If you are like me and need some eye candy while developing, even if the style is mismatching use free asset packs first, and replace them with a consistent style later
that way you can block out your level but it doesnt look like a grey-block desert
loup can i ask for help in one thing, do you have a high knowledge on how references work ?
i know the basics
and FindGameObjectByTag is a noob trap
yeah i think that is what happend to me
because it has to search the whole scene for the reference
Those assets might not match the items I need so I think Ill just greybox everything and put a background on to make it easier to see everything
Then come back and make new assets matching the shapes I used before
and also it would need to be unique
yeah i have a prefab with that tag so i think thats where it all goes wrong
So ill prolly make like 20 or so different shapes for the platformers themselves + interactable objects, then come back and remake them in each map flavour
if you have a fixed object in your scene, then use SerializedField
let me give you a video so you can see what happens
(9 realms, so 9 different flavours some of which will be very similar)
yeah, that’s very wrong
its not fixed ( if fixed means what i think it does) it is a prefab that spawns randomly from a pool
are both of the referenced scripts in the prefab
does the object in the scene need a reference to the script in the prefab, or the other way around
the bullet needs to know which bullet number she is so she can have certain rb2d.velocity
so the script in the prefab needs to get information from the other object
and im thinking that somehow has a conflict with the other thing shooting
yep
isnt there a way to instantiate it ( the bullet) as a child and get the information of the father (pink enemy)
so you need to:
- When you Instantiate, keep reference to the object you made
- GetComponent on the thing you made, to search for a specific script.
- The script you find needs to have a public method in it so you can pass the necessary information in it
Instantiate returns a ref to the object made
it will seem like im just telling you the same that you did but i wanna see if i understood:
1st: when the bullet gets instantiated i need to keep a reference to the object that instantiated it
2nd: GetComponent on the bullet that searches for a script in the referenced gameobject previously mentioned
3rd: the script i find with the GetComponent needs to have the variable public
how?
the return type of Instantiate is GameObject
i havent really understood return completely
what i understood is that it returns a variable to something
but i dont know how to tell which one to whom it should be returning to
then you need to learn how return types work
it is a fundamental part of the language
alright !
but b4 going to read the docs
i think the problem is the previously mentioned
but how can it affect in that way
wouldnt the bullet just get instantiated in the same way that the ones from the other pink enemy do but just from the position of the new pink enemy ?
whenever you instantiate, you want to:
- Instantiate
- SetParent for the transform to the new parent gameobject
- Set the position
yes i know thats what i want to do
but the thing that is missing is not that it doesnt spawn
its just that it doesnt take a velocity
you need a reference to it to be able to tell it to be modified
and why does it work in the first pink enemy?
because you are probably getting a reference to the same one enemy when you FindGameObjectByTag
which is a function you should realistically not use
i dont understand it but i guess once i read the docs maybe it becomes clearer to me
ty for the help!
is it this what i want to do?
btw whenever i ask something its more like giving my pov or what i think is correct and questioning it
not like: idk if this is it but it may be so imma just ask
I've been trying to include the class of this script into another script to access it's variables by doing this
Public PlayerCombat playerCombat;
public int damage = 1;
Public void Damage Player()
{
playerHealth = playerHealth - damage
}
playerHealth is the currenthealth (sorry if its a bit confusing)
problem is, when I do it, the variable isn't recognized in the other script
I'm gonna try to replicate it again since I deleted it all yesterday
does anyone know where I go to fix this error? like what pannel?
Have you tried restarting?
twice.
yikes
is there a way to check if an object is attached to a canvas in script?
what would you need to do this for?
im setting up a cursor manually as a UI component, but i need to take it between scenes
Oh also I'm also looking for some help too.. we can talk here but DMs might be nicer
I'm trying to check on a specific layer if a particular region of space has any colliders. Google keeps leading me to methods like BoxCast and CheckBox, but they seem to have far too many arguments for what I'm looking for. How do I add something akin to a Collider to an object such that I can just get that attached collider-like-object to basically do a CheckBox by calling an argumentless method?
what part of this requires you to know if its under a canvas? this is something you do at editor time, so if you put it under a canvas then it is under one
moving it between scenes is at runtime though
do you mean to put 2 separate objects in 2 scenes
in charge of the cursor?
you can just move the canvas, but also this might be something you wanna put in DDOL
your closest option would be using a trigger collider, then keeping track of what enters through OnTriggerEnter and OnTriggerExit. Or just learn how to use any of the overlap functions https://docs.unity3d.com/ScriptReference/Physics.OverlapBox.html there are examples
is there a component that can call Physics.OverlapBox using public variables already set on the component?
a component? just call Physics.OverlapBox with the public variables that you want. it really isnt that complicated to use any of the physics methods and the docs i linked does show you an example. it even shows you with OnDrawGizmos where this box is
if you have a question about how to use it, then thats better to ask rather than trying to find an alternative
do I just make a new behaviour script?
Anyone know why a camera mode canvas rendering to a rendertexture displayed in a raw image doesn’t look exactly like what it shoud
i did it!
Above is the tmp text in the raw image, then theres the exact same tmptext but on a screen overlay canvas. i tried messing with the import settings, color format etc. to no avail
it looks like maybe its not supporting transparency correctly? which format would be correct:/
If you want to 🤷♂️
It's not needed though
Is there a way to pull all the information needed for the cast from the object?
or rather, a component on the object?
First figure out if the problem is with the render texture or the camera that renders to it.
I'm not sure what you're asking
the link above shows what you need with example code and everything
you may be overthinking this. this is just a simple method call, you provide it literally any information you want. the same way you call stuff like AddForce
haven't used that yet
It's a method. It's the same way you use ANY method
you might wanna do some basic c# lessons first then, if you arent sure about how to call a method
Here's an example of my code so far. I misunderstood a page that showed BoxCast listed under a heading of Methods under a heading of CapsuleCollider, and got a little too hopeful.
admittedly this is me modifying a far more complicated scene.
are you modding a game by chance?
Seems to be something from VR chat.
a VRChat world, though really more of a system someone set up for making certain kinds of worlds
oh i didnt see the last message, yea u should be asking for help in the games modding community instead
they're not particularly active right now.
Though, the reason I asked about making it a new script is because each zone being checked will be tied to an area, thus for that particular object, I want the variables stored with it.
the jist of what I'm trying to do is check to see if an object on the Walkthrough layer is on the runway I have here.
since there will be multiple runways, the thing that makes sense for me is to have each runway have its own "checker" to see if the runway is clear, returning a bool to another object on its status when asked.
though more and more, it looks like a premade solution doesn't already exist (unless there was some way to use CapsuleCollider.OnTriggerStay like some sort of pseudo-bool)
https://gdl.space/efarezesat.cs - CursorScript, https://gdl.space/jecisikimi.cs - SceneManager. Any idea why the CursorScript object is getting destroyed when changing scenes?
How would i go about doing that? I played with all the settings. RT dimensions is the same as game window size.
Either look at the camera preview window or make it a main camera temporarily to see how it renders to the screen.
seems like for some reason the render texture has this blueish gray outline instead of additive alpha. which is weird, because i dont know what could be saturating it 🤔
I just tried setting it as a child of the SceneManager gameobject and it still gets destroyed
i see ill try that, would help me narrow down if its a rendertexture/rawimage issue or not
A DDOL object must be the root
You are setting it to be the child of an object
this.transform.SetParent(FindAnyObjectByType<Canvas>().transform);
So the canvas is likely being destroyed (assuming THAT is NOT in DDOL), which of course destroys its children
before scene change I was setting it's parent to null
Ok, verify that is actually happening when you think it is with a debug.
Add a OnDestroy() method to the CursorScript and just log when it happens and its parent if it has one
Send a screenshot of your unity window with the cursorscript object selected, right before changing scenes
scenes change when I hit play
Hmm, that is not in DDOL
Cursor is not a DDOL object. It has a parent at the time you make it a DDOL
it returned "Canvas"
Only top-level objects can be made DDOLs
So, when you parent it, it moves OUT of DDOL
oh should I set it to DDOL when making it the root
Yes
And that means when it is destroyed, the canvas was still the parent I guess
btw is this the correct syntax for making it the root
Hey I need some assistance
i feel like i might be just doing some crazy stuff rn cuz ive never done this before
no need to do gameObject.transform
just go straight to transform
And do DontDestroyOnLoad(cursorScript.gameObject);
will this not work?
Ah, ok yea. It isn't necessary, but it will
also, you don't need the "this" anywhere like that
ill try your method because its way cleaner lol
gameObject already means that object the script is attached to
Im waiting to see if anyones available
I asked a few moments ago
Don't do that. Just ask. If it got buried, repost
Actually, a question: Why is CursorScript a DDOL? It's not a singleton, and it doesn't seem to have anything particularly important you need to carry across scenes
i just thought it might be better than having one in each scene
alr
tbh idk ive been coding for the past 18 hours
You've had to do so much parent shuffling and DDOLing instead of just like, having one in each scene
Do that and you basically cut out 80% of the code that's here
true
Im trying to get public variables from this script (related lines of code highlighted)
And here's the attempt
!code
📃 Large Code Blocks
Use links to services like:
https://gdl.space/, https://paste.ofcode.org/, https://hatebin.com/, https://paste.myst.rs/, https://hastebin.com/
📃 Inline Code
Surround code with three backquotes. Not quotation marks.
To format as C#, add cs to the first line:
```cs
// Your code here
```
Add a comment with a line number if there is an error message.
I'm not really sure what I might be missing here, my other codes are following the same thing
No they aren't. You don't have a reference here
You're trying to use a variable on Enemy that doesn't exist
Your other codes cannot be doing that without an error
If you want to use a variable on an instance of PlayerCombat you have to tell it which PlayerCombat you want to reference
Okay.. a bit lost here
you need a variable that holds a reference to the specific Player Combat component you want to get the playerHealth value from. Then you access playerHealth through that reference using dot notation
Which PlayerCombat do you want to access playerHealth of
there is only 1 playerCombat script
irrelevant
Your code doesn't know that
The game engine/ compiler doesn't know that
You could decide to make more at any point
How exactly do I specify which one?
There are many doors, Ed-Boy
#💻┃code-beginner message
If you can, you want a serialized reference
Otherwise, you are likely instantiating something, and Instantiate returns the object instance that was instantiated, so you just pass that where it's needed
is there smth that manages probability in Random.Range, for example: Random.Range(1f(10%), 2f(90%));
its something hard to explain so idk how to google it if it exists
Not that I know of, you could perhaps finagle the animation curve into doing something like that?
Find some random position on the curve
The term you're looking for is weighted random
finagle?
what is that
okay i will check into that
b4 all
Doesn't matter, just meant it as in fiddle with it
does it work is the range is larger than 2 ?
ohhhhh
but looking up the definition, the word doesn't really fit there
didnt understand the word
Random value between 0 and 1. If it's over 0.9, return 2. Else, return 1
wouldnt that make the code chunky once you have like 10 options?
Switch statement
true
my mind wanted to use that but went to a mix between that and ifs
i can just use switch and it would work
ty for the idea!
i think it wont work tho because on what i want to implement it
but i will try b4 making assumptions since it works strange and i need to sit there and think how i want to make that
Just found a post describing a way to do it with the animation curve just how I was thinking, but explained better
https://forum.unity.com/threads/making-random-range-generate-a-value-with-probability.336374/#post-2179247
So
public PlayerCombat playerCombat;
(the reference to PlayerCombat and its playerHealth variable) isn't going to do that?
No
that is a declaration
you need to actually populate that variable with the reference
So in unity's case... drag and drop it into the box in inspector?
You could drag the PlayerCombat script (that is attached to an object) into the field via the inspector
Yes, exactly
is there a quick and dirty way I could use a CapsuleCollider to pull parameters for a Physics.CheckCapsule?
Ok but here's the strange part, even though it's public, it doesn't appear in my inspector
the script is saved I assure
Is PlayerCombat a monobehaviour, or serialized?
monobehavior
(I think you showed it, but I can't remember)
Ok, hmm. Can you show the inspector and code?
quick question, how many does FindGameObjectsWithTag consume in the game?
I don't know what that means
How many what?
sure, also which code? the enemy or PlayerCombat
I'm not sure, I guess lets just do the inspector for now
How many what?
performance
Oh, how efficient is it? Not very
Avoid Find whenever possible
i reached to the same conclusion as the guy, since i only want this probability thing for 1 part of the game i will just hard code through it because it would take me less than to set up a whole data struct
any better solution?
almost every other solution is better
Serialized Reference is best
Ok weird. Nothing wrong looking there. Show the Player Combat script?
I have a CapsuleCollider on a gameObject. I want to pull certain variables from the CapsuleCollider, then use those variables to calculate the Start Point, End Point, Radius, and Layer Mask of a Physics.CheckCapsule() call.
I mean sure, then do that?
You can't get the layermask from it of course
wait, really?
Really what?
shoot, too large to but into the discord
CapsuleCollider has Layer Overrides. I thought I'd be able to pull those.
Just screenshot the top portion of it
Just make a LayerMask variable.
what would you even pull from the CapsuleCollider for layermask
that doesn't really make sense
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine;
public class Enemy : MonoBehaviour
{
//hp
public int maxHealth = 3;
private int currHealth;
public Animator animator;
public bool enemyAlive = true;
//fighting player
public int damage;
public PlayerCombat playerCombat;
// Start is called before the first frame update
void Start()
--rest of the script
And THIS is saved for sure?
yep, there's no * on any of the script headers (unsaved)
The only other thing I can think is that there are compiler errors?
and I double checked by saving even those
what doesn't make sense? All the information I need for where the CheckCapsule will happen would be on the CapsuleCollider.
Getting a layermask value from it. That doesn't make sense
Just MAKE the LayerMask variable and set it
set it off what?
I mean, you can just make variables for EVERY part of this, so I'm not sure what the fixation with the capsule collider is
Off what you want it to mask. It's a choice. You use the inspector to make that choice
what does that even mean?
okay then, should I make a script that stores all the variables for a CheckCapsule on the object itself?
Sure? You obviously need SOME script
I thought you had one already, since you are calling a method.... which needs to be done in a script
I would save the variables in that place
well, yes, but that's a different object, one that's gonna have to call a bunch of different areas
why is this happening? it says i cant convert int to string but the guy uses it and works just fine
OK WEIRD! it finally works now, someone told me to replace
private void OnCollisionEnter(Collision collision)
{
if (collision.gameObject.tag == "Player" && enemyAlive)
{
playerHealth.Takedamage(damage);
}
}
with
{
if (collision.gameObject.tag == "Player" && enemyAlive)
{
collision.gameObject.GetComponent<PlayerCombat>().TakeDamage(damage);
}
}
Im not too sure what he did there though..
but the damage amount can finally be changed in the inspector
That is psuedocode on the left
Make it an int[]
Nice ok, not sure either
should I be changing my workflow? Right now my logic is that the actual script that does things is on the panel/button that the player interacts with, and the variables for the object being affected remotely are on the object itself.
btw the [] means like a container right?
no, I mean, they had string[]
replace that with int[]
As the type
yes ik
Oh ok. The [] means array
but the [] in both means like a list/array
so, an array of ints, instead of an array of strings
array, not list. Yes
[] just means array
List<int> is list
thats what i mean
It's just how the syntax works
And yes, arrays are fixed length. Lists have an array internally and methods to resize it and make sure the indexes have no gaps
hmm, so my next question is: if I store the variables I need on the object, is there a way I can use those variables to draw a gizmo?
by methods you mean .add and .remove
Yeah exactly. And more stuff
List is a class
https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.list-1?view=net-8.0
This shows a lot about it
No problem!
i watched a video in depth of that they are pretty cool and can save a lot of time
C# is turing complete. You can do literally anything. But yes of course you can use values to make gizmos
It's a bit ambiguous the way you're asking though. So I'm not sure exactly what you mean
I mean so that I can actually see in the unity editor what the area where the CheckCapsule is defined would be.
a question about lists, if i write .remove (whatever i want to remove) it doesnt remove all of the items that match that description, is there a way of doing that?
for example a list that has (1, 1, 1, 2, 2)
is there a way to remove all 2?
Mornin' all.
I have a ship flying over the moon at a fixed height, conforming to the sphere. On the moon I have some objects placed based on long/lat coordinates and based on images etc. they're accurate, so this is good.
Now what I'm trying to do is get the ships 'live' long/lat position but I'm not entirely sure how to do this. (currently was playing around with an empty at the center of the planet always 'looking at' the ship, but obviously this has problems when crossing the poles etc.
Would anyone be able to point me in the right direction on how to achieve this (a resource etc?) Thanks.
it is private by default
int vs private int = private both?
yes
When you feel like it
I generally always write private. Some people don't. It's just a personal choice
Just keep it consistent at least
lol ah! i see Thank you for both of your answer
for the private variable so can i use the same variable name in diffenct script because it's private saparate from each other?
you could name it the same name even if public in different classes
can i change "other" in red circle to specific gameobject? i'd like to make a ball only to hit trigger
i mean other object which is not "ball" do not affect to this trigger
You can tell it to check the tag of the collider, if the collider other's tag == ball's tag, execute your existing isKickBallAttack
https://docs.unity3d.com/Manual/LayerBasedCollision.html
Or better yet only let it collide with that layer
That too 😉
thank you let me try
Hi, I hope I can get some help.
I have a question and have been tryin to understand this for awhile. I have my input system on a separate script and a character controller script to control the 2D gameObject which is my character. I don't know how to implement a sprint button so that when I hold it down, the movement speed changes.
In my Input script, I have a public void for Submitpressed and the function of if pressed true context.start and if not , canceled.
In my charactercontroller script, my movement section is the attached image. (I'm new to this so I followed someone else's tutorial)
When I pressed the sprint key, it only jerks forward and goes back to the normal walkspeed. Is there a code that I needed to implement to make sure when the sprint button is held down, the sprintspeed continues to hold until released? I look through a couple of other videos online to implement but can't stitch anything together that works.
InputScript: https://paste.ofcode.org/z2arnEyGpTTJTQGKK4nGQi
CharacterCode: https://paste.ofcode.org/qszfNXLgwh7e28wDag9zPn
Show the input manager code. No screenshots, !code 👇
📃 Large Code Blocks
Use links to services like:
https://gdl.space/, https://paste.ofcode.org/, https://hatebin.com/, https://paste.myst.rs/, https://hastebin.com/
📃 Inline Code
Surround code with three backquotes. Not quotation marks.
To format as C#, add cs to the first line:
```cs
// Your code here
```
Add a comment with a line number if there is an error message.
Sorry, I just updated. Is that ok?
public bool GetSprintPressed()
{
bool result = sprintPressed;
sprintPressed = false;
this sets sprintPressed to false the first time you read the value
I set it to false because I assumed it should be false when the game starts so only when I pressed it, it will be true. When I set it to true, the default move speed for the player just becomes the sprinting speed.
Is there another way I should have implemented this?
...why would that affect it when the game starts?
Are you mixing it up with private bool sprintPressed = false;
And obviously you shouldn't set it to true there. Just remove that line.
Sorry, I thought you were saying the line on 146 for InputManager.cs
Yes, that's what I'm talking about
Oh gosh. that worked.
You set the sprintPressed to false every time you check if the player is sprinting. So of course it will be false after that.
Ok, I kind of understand now. Thanks!
And if I want to add Animation to it, do I just add a line under the button pressed for move and run as well and linked that to the animation?
The difference between sprinting and the other actions like jumping is that for those other actions you don't want the action to trigger every frame while the player is holding the button so that's why you set the variable to false for them, so that it only registers for the first frame
Thanks for your explanation, I understand now.
Yes, in the player controller set the animation based on what the sprint status is
ok I'll try to figure this portion out
alright, so I ended up making a function that I think converts a capsule collider into the parameters needed for a CheckCapsule, but for some reason it keeps returning True, and I'm not sure how to troubleshoot.
https://hatebin.com/onsgobcdyq
!code
📃 Large Code Blocks
Use links to services like:
https://gdl.space/, https://paste.ofcode.org/, https://hatebin.com/, https://paste.myst.rs/, https://hastebin.com/
📃 Inline Code
Surround code with three backquotes. Not quotation marks.
To format as C#, add cs to the first line:
```cs
// Your code here
```
Add a comment with a line number if there is an error message.
any way to run OnPointerUp only if the mouse is still over the object that OnPointerDown was called on? I want the player to be able to drag the mouse off if they changed their mind and are still holding the left mouse button
What this causes is that the color changes, the player can drag the mouse off but the second they let go, no matter where their mouse now is, OnPointerUp is called
I'm just giving an example of what the issue I'm experiencing is, I know that code is wrong, I'm wondering if there is a different way of doing it
https://gdl.space/volopocutu.cs can anyone help me with this issue im having? somehow in the SetEnemyDifficulty function, the enemy.BaseStats which is on a scriptable object is getting changed even though im using a copy contructor
debug what eventData is on if its being called ur mouse is over an object in that hierarchy
what is Stats
seems like OnPointerUp takes "Press Raycast" whereas OnPointerDown takes "Current Raycast"
not sure what those are entirely
which one is the SO
you're changing stats on the same object then
wdym
What would be the "correct" way to implement crouching with the CharacterController? Modifying the controller height will make the player clip through the ground when the collider instantly expands (when uncrouching), but trying to LERP the height or do some wacky stuff with lerping player location while crouching and uncrouching feels really unprofessional/messy and causes tons of issues on slopes. Is there a better method that I'm not finding online?
to me it seems you're making a copy of the same object and setting the values on the same thing
i have two seperate stats, one on the base "Entity" which my enemy inherits from and then one on the EnemyData SO
enemy is just a monobehavior
i define my enemies base stats on the SO then copy it over to the monobehavior and increase it depending on the difficulty
i don't understand how my SO is getting changed
well if you're changing a reference type you're changingthe same object
but I used a copy constructor to create a new stats from the baseStats
does that not work?
you prob made shallow copy or whatever is called
You modify height and center simultaneously to avoid going through the ground (and ceiling)
well look at my copy constructor, is that a shallow copy?
you mean this cs public Stats(Stats stats) { foreach (Stat stat in stats.Keys) { Add(stat, stats[stat]); } } ?
yes
those are reference types
why modify the center? Wouldn't leaving it at the bottom and just having the character scale from that point make it smoother?
It just seems like a janky solution even if it's industry standard
this should work now yes? public Stats(Stats stats) { foreach (Stat stat in stats.Keys) { Add(stat, new StatValue(stats[stat])); } }
if its just stats make struct ?
To keep the bottom exactly where you want it
The center is not at the bottom. It's at the center..
If you don't move it then shrinking will make the model and collider float
When you say the bottom, I think you mean a pivot? That isn't what praetor is talking about
what is Stat ?
an Enum
also I need my StatValue to be a class since I change it in realtime
you can move the pivot (called the 'center' in the inspector for the charactercontroller for some reason) so I moved it to the bottom of the character just so it would scale from that point, thinking it would solve my issues.
alas it did not
Scaling is a bad idea
Changing the height and center is the way
basically when i pass my stats into a function, only a copy of the struct is passed
so I would have to make a new struct and assign it
just makes it more annoying
can anyone give me some advice on how to troubleshoot some code? I can't figure out how to check where it's going wrong.
https://hatebin.com/onsgobcdyq
am i correct in thinking this will check the OnPointerDown position against the current position of the pointer?
sorry, I meant changing the height. Not the actual scale of the charactercontroller. When adjusting the height it still uses the pivot point.
Use standard debugging techniques. Debug.Log and attaching the debugger
well yeah but now you have the reference issue where you're modifying the same ref lol
Height always grows in both directions from the center of the CC
well that issue only arose since my copy constructor was wrong
If you moved the center down, when you increase the height of will put the bottom underground
is it your code?
yes
purpose?
my Stats used to be a dictionary with Stat, float
but i changed it to StatValue which holds a max and current
forgot I had to change the copy constructor
I want the player to be able to click on an object to place down a tower, but be able to still change their mind until they let go - this lets them drag off of the object which will return
also update: it worked 🙂
this relies on ui space, even if you add threshold its not a tile or 3d space
what do you mean?
as in the IPointer interfaces?
im using them over getmouse.... because i dont want the player to be able to select towers etc while a UI component is in the way
it may break at specific angles scenarios because you are working in 2d ui space
probability is an array, and if an item exceeds the price i want to remove all the numbers assigned to that item in the array (which i cant since its an array) so i should convert it to a list, but then how can i delete, for example all "2" inside the list ? and is there a way to make a list contain all that an array has?
Example:
private int [] probability = {1, 1, 1, 1, 1, 1, 1, 1, 2, 2, etc etc
list<int> numbers = new list <int>();
numbers.add(probability);
or smth like that?
those interfaces are great at that, true and i might be misunderstanding your setup
AddRange or simply new List<int>(theArray)
is there a way I can highlight a point in the world given a Vector3 for debugging purposes?
one issue with the way i did it though is that the position has to be exactly the same, so if the player moves the mouse a bit while still hovering the object it wont work 😭
Gizmos
ill try ty!
I tried and failed this. Is there a way to make it really bloody obvious?
the object is a collider with IPointer interfaces, so just add IPointerEnter/Exit to notify you of hovered state
Look up the docs for OnDrawGizmos and Gizmos.DrawSphere. also don't forget to turn gizmos ON in the scene and game views
and only abort if not hovered
you are a genius
i can actually simplify is even further since im using the Enter and Exit for color changing already
so i can just compare the color
thank you!
is there something for lists that gets the lenght? like in arrays: "whateverTheArrayIsCalled".lenght;
.Count
that gives me a group of methods and i need it as a float
post code
wait i think i know where i f up
nope i dont
the error says: you cant convert "group of methods" to "float"
what type is enemyType what type is probability
i messed up the probability name
im an idiot
it was supposed to be numbers
it was an array
and it should have been a list
Even when you do it correctly it's going to be an int, not a float
i dont know why but afterwards the error didnt show up
how do I get a gizmo to fire just once after using a method?
Random.Range with two ints is a thing, and perfectly valid
wait, I see them!
oh now i understand what you mean
i was reading an error that said that
the one on here
i wasnt expecting an error but when you said it still wasnt a float i meant that the error wasnt showing up at that time
I found that using a single "gizmo manager" is convenient for that
you make a class that you can send requests to
huh, I wonder why they are so off from where they were supposed to be
like draw box for 5 frames with this color
for reference, those red and yellow boxes are supposed to be at the ends of the capsule collider
you can draw gizmos in local space btw
Gizmos.matrix = transform.localToWorldMatrix
then you can use your capsule end points as just offsets
📃 Large Code Blocks
Use links to services like:
https://gdl.space/, https://paste.ofcode.org/, https://hatebin.com/, https://paste.myst.rs/, https://hastebin.com/
📃 Inline Code
Surround code with three backquotes. Not quotation marks.
To format as C#, add cs to the first line:
```cs
// Your code here
```
Add a comment with a line number if there is an error message.
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
not sure why the offset of the capsule collider is so far off from the offset of those end points
Gizmos.matrix = OccupancyChecker.transform.localToWorldMatrix;
float capsuleHeight = OccupancyChecker.height;
Vector3 start = default;
Vector3 end = default;
start.y += capsuleHeight / 2;
end.y -= capsuleHeight / 2;
Gizmos.color = Color.red;
Gizmos.DrawWireCube(start, new Vector3(10, 10, 10));
Gizmos.color = Color.yellow;
Gizmos.DrawWireCube(end, new Vector3(10, 10, 10));
or start.y , whichever axis is "up" on the capsule
y probably
!code
📃 Large Code Blocks
Use links to services like:
https://gdl.space/, https://paste.ofcode.org/, https://hatebin.com/, https://paste.myst.rs/, https://hastebin.com/
📃 Inline Code
Surround code with three backquotes. Not quotation marks.
To format as C#, add cs to the first line:
```cs
// Your code here
```
Add a comment with a line number if there is an error message.
So, I'm trying to create the end game stats to appear when the timer hits 0, but when the timer hits 0, nothing appears to happen. Anyone know why? https://hastebin.com/share/neyonotugo.csharp
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
Starting with some log statements would be a good first step
what is Timer ?
this can take a long time to debug, or you can use debugger to step through line by line and see where it fails
But I'm not sure what else to do
Use logs in THIS script to make sure the code you expect to be running is running
All I can think of for a log statement would be the time. Would u be able to suggest some others?
Yes, put a log inside that if statement and that function
To make sure they're actually running
Ok
Basic stuff. Question your assumptions
Make sure there's no errors as well of course..
Yeah, there isn't :D.
ever used debugger?
No?..
good time to start
K xD
how to access components and game objects from scripts without having the variable public
SerializeField can serialize private variables
If you mean "without assigning in the inspector at all", then you have to get a reference some other way
Are there any bad practices that beginners would do that I would want to know?
No idea why, but this time the script worked? Debug.Log scripts are just fixers I guess
Maybe you forgot to save your changes earlier
can you get any off the top of your head?
Too lazy
I'm sure I did... Anyways, thanks for you help
spamming singletons instead of a single simple service locator
fair
relying on very specific paths, or tags in hierarchy instead of using interfaces or marker components to locate objects
how would you use interfaces to locate objects?
and what are marker components?
GetComponent<IMyInterface>()
e.g getComponent<TextMeshProUGUI>
since how would a component implement your own interface
Not sure I get it, do you have anything I can read?
from experience, a character rig, with bunch of hitboxes, mount points, etc
context for what im talking about
yes
public class DamageTrigger : MonoBehaviour, IDamagable
Yeah I get it
so then u can have some external thing access it through IDamagable instead of a direct reference to your class
alright, I got it this far! Thank you!
Presumably a player or a damagable box or something would implement that one
interfaces are used to implement a feature shared between many things but have very different implementations
this wasn't possible in java until java 17 😭
it doesnt make much sense to have a interface on a generic "DamageTrigger"
unless thats for your player or something specific
Hence why it didn't have the interface
ah i thought he wanted to know how to implement the interface on his class
didnt realize my fault
I'll be updating my doc to be clear about the usage example 👍
oh goddammit. Do you know what my issue ended up being? I read this backwards.
layermask: A Layer mask that is used to selectively ignore colliders when casting a capsule.
"Layermask" is actually a parameter for what layers not to ignore.
(ignore how i reset the game, i made a metho for it) what i dont understand is the error im getting
!code
📃 Large Code Blocks
Use links to services like:
https://gdl.space/, https://paste.ofcode.org/, https://hatebin.com/, https://paste.myst.rs/, https://hastebin.com/
📃 Inline Code
Surround code with three backquotes. Not quotation marks.
To format as C#, add cs to the first line:
```cs
// Your code here
```
Add a comment with a line number if there is an error message.
Hi all, would someone be able to check my maths on this bit of code please?
I'm trying to come up with a Long/Lat system and it's going pretty well. The Longitude calculation works fine, but my Lat calculation NaN's out almost immediately when I move and I'm not really sure where I've gone wrong.
void Update()
{
RaycastHit hit;
// Does the ray intersect the Moon's inner collider?
if (Physics.Raycast(eagleGPSRayEmitter.position, eagleGPSRayEmitter.TransformDirection(-Vector3.up), out hit, Mathf.Infinity, layerMask))
{
eaglePosX = hit.point.x;
eaglePosY = hit.point.y;
eaglePosZ = hit.point.z;
//Debug.Log("Hitting inner Collider");
}
longitude = (Mathf.Atan2(eaglePosZ, eaglePosX) * Mathf.Rad2Deg)-90f;
latitude = (float)Mathf.Acos(eaglePosY) * Mathf.Rad2Deg;
// this bit is to flip and quarter rotate the latitude number to put it where you would expect
// (assuming you are an earthling)
// with 0 at the equator, 90 at the north pole and -90 at the south pole
latitude = (latitude - 90f) * -1f;
Debug.Log("current long = " + longitude);
Debug.Log("Current Lat = " + latitude);
}
im getting an error that tells me that an index was out of range, i have went through the code and couldnt find why or how its happening.
https://gdl.space/esevorayuh.cs from lines 54 to 84 is the code that should be relevant and the error shown in the video is in line 56
Try debugging your list to check how many values are in there when you've assigned 'probability'
i dont see how this can fail only when you start moving
only possibility is that the raycast somehow returns 0 y
or some other crazy number resulting in infinity
try using debugger to see what exactly happens
which direction should I be moving the center in when crouching/uncrouching? Right now it seems like no matter what I do, the controller is pushing against the ground while the height is lerped which causes me to slide down slopes and stairs.
It definitely doesn't return Zero, the value does change based on movement, but nans pretty much straight away. This is way more complicate maths than I'm used to if honest. lol.
first establish exclude that its a faulty raycast
faulty can mean it stops at some other collider, inside the collider or something else similar
Assuming unity Mathf.Acos is wrapping the C# one, it would return NaN if the the input value is invalid(< -1 or > 1) it seems.
https://learn.microsoft.com/en-us/dotnet/api/system.mathf.acos?view=net-8.0
Ah crap. 😕
This could happen if the numbers list doesn't contain any elements. It would try to access index 0 which doesn't exist.
but i reset the list content after the while for that same motive
guys i am working on my enemy and he is supposed to shoot fireballs when the player is in range but when i enter the enemy range it doesn't shoot fireballs and i get this error i am not able to understand where i went wrong even my code has no errors
Debug you list to see what's actually in there?
omw
You're missing an assignment in the inspector by the looks of it.
Or 2.
Your variables enemy and anim are unassigned (Unity can't find them) in your EnemyPatrol script. How are you assigning them?
@vale cradle in your project panel, type into search t:RangedEnemy
okay
Guessing enemy is a gameobject and anim is your animation controller?
Hierarchy
i'll paste my code here?
it says enemy patrol is not assigned
yes
i dont see enemy patrol in that screenshot, im assuming its another component
just a min
I don't see how resetting is gonna help? If anything, that's probably the cause
i got where i missed it i didn't assign it to the animator
i got it
thankyou so much guys
that makes the list reset in case the engine tried to buy something it couldnt afford and therefore got removed from the list, which will be usefull for the next wave
Ok, but that doesn't change the cause of the issue as I described several messages earlier
wouldnt it answer this?
numbers array at [Random.Range(0, numbers.Count)] does sometimes not exist...basically
No it doesn't. As I said, it's probably the cause.
Imagine you have 0 apples.
And then you try to pick the first apple that you have. What would happen?
but how is there a moment where it doesnt exist?
but i always have apples
Apparently not. That's the only case that error would be thrown
yep apparrently not and thats what i dont get
since i have done the math so that doesnt happen
Well, debug it. Where are you clearing the list or removing stuff from it?
Hmmm. Would anyone have any clues as to how to fix my latitude issue please? Giving me a headache. lol.
i think its because the maxType gets reduced b4 the foreach
so it starts deleting the "1" inside the list
and since 1 is the lowest thing it cant afford anything and the error jumps
that should not even work
Debug it... So far these are just assumptions(that don't even make sense to me too)
my bad it should
xD
you cant modify collection while foreaching it, but you are removing from a different one
you should learn to use debugger
it will solve a lot of issues
what happens if you do....an error or what exactly?
i have debuged some things but idk how to debug this
exception
its just an int
Shenanigans! Shenanigans!
I've got a method attached to a button that is for some reason executing twice... 
Print the int
yes or learn to use the debugger
Might want to add some meaningful message to it too
yup - debugger is essential, and I'm only just getting used to it
debug.log("maxType" + maxType);
that?
you have to understand it...if this workds for you
I don't see how maxType is related to the issue though..?
yeah my code is a bit spaguetti rn
but max type tells the game what probability to "erase"
there are 2 qualitys at the moment
THe problem is not that a specific element is erased. But that all of them are erased
Despite using the debugger you also should do more logs and better logs, for understanding problems
if the engine cant afford quality 2(which costs 5) it will remove 1 from maxType
wait let me finish and you will understand the problem that i had/im having
this a help request xD?
Whatever logic you have doesn't matter. The issue is that the list is empty at some point. You need to debug where and why it's becoming empty. Assuming that's undesired behavior
... it might be - I'm in over my head; but I have had similar issues before & I've managed (somehow)
so in the foreach it removes each int = to maxType,
since i was doing Maxtype -= 1; before , the maxType dropped to 1 b4 entering the foreach cycle, which led to all "1" getting deleted and therefore being empty and making the game unable to choose a 1 from the list
so you did make sure that the method is not called by any other script or elsewhere, just the button?
so now that i moved it from b4 the foreach to after it it should work fine
I'm just thinking out loud about how a method might inadvertenly be triggered twice by one button interaction - I do have it rigged with an interface that's very one-sided...
which i just tried and doesnt
Then your assumption was just wrong
yep
You should debug properly
Wherever you remove elements from the list, debug the count of the elements in the list
log everything everytime, so you can understand what happens
so inside the foreach?
Is that where you remove stuff from it?
yep
Then yes
heh - deleting the interface didn't help
but it also didn't hurt 🙂
you also might want take a look at the debugger...note: debugger != debug.log
alright ill do once i finish with this
okay so what is happening is that once it beggins to delete an int from the list it just erases all of them
Sounds like a problem
yep
I have a lil problem, could somebody help me ?
Would need to debug why that happens. Or read the code and infer from it.
everyone here, just ask😁
(bites lip) >:)
what i am doing is that for each "maxType" (which starts at 2) inside an array called probability, it erases from the list numbers one "maxType"( a 2 )
or atleast that is my intention
I have a code that is supposed to allow the player to move arround and move the camera as well, but it just moves the camera in one way, dont know why.
"numbers.RemoveAt(i(maxType)); ...?
then probability contains the same elements as numbers causing erasing all the elements from numbers.
I cant share the code it's too long
!code
📃 Large Code Blocks
Use links to services like:
https://gdl.space/, https://paste.ofcode.org/, https://hatebin.com/, https://paste.myst.rs/, https://hastebin.com/
📃 Inline Code
Surround code with three backquotes. Not quotation marks.
To format as C#, add cs to the first line:
```cs
// Your code here
```
Add a comment with a line number if there is an error message.
Remove will remove all the maxType entries found
try a RemoveAt...
probability has two 2´s
so it should erase the other two 2´s from numbers
Then numbers contains two 2's as well
coz you've got it in a foreach
yes
And that's it
yeah but once they are deleted maxType changes to -= 1 so it becomes a 1
and shouldnt try to delete more 2´s
where do I find this quick-link?
No..? At least not in the loop
just below
Where? I don't see that in the loop
Why would it matter after the loop? Do you understand how code is executed on computers?
So, why would it matter what it becomes after the fact? Also, the maxType in the loop is a different variable
ok, it justed worked after 2 days... I did'nt changed anything...
gremlins on long-service leave...
Don't you see that they have different color?
and how can i make it the same
yeah i just noticed when you told they are not the same
- don't declare a local one
- that wouldn't fix the issue
yea xD
so i just delete the "int"?
it gives me an error if i do so
Yes, obviously that would make the loop syntax invalid
then how can i tell it to be the other maxType?
Maybe think again what you're trying to do. Why would you want to use max type in a for each loop?
foreach max type (which is 2) in probability
for each is giving you values from the collection. If you're not using them, there's no point in it
so for each 2 i have in probability it should repeat the code
Then maybe you should use a for loop instead? Since it doesn't seem like you need whatever is in the probability array/list.
i just have the probability array so in each end of a round i can make the numbers list = new list <Int>(probability);
That doesn't tell me anything.
im thinking of how i could do it
I'm sorry, but I really don't understand what you're trying to do. Not from a coding perspective, but from pure logic perspective.
Maybe write your logic down on paper(in the form of a blockscheme for example)
that whenever it cant afford an item erase it from the list so next time it tries to buy something the items it cant buy dont exist
i used a for instead of a foreach and it worked
i dont know why tho
then it would look something like this, no..?
if(can't afford item)
remove from list(item)
yes
but since i also have it done as a probability
Then I don't understand what probablilities and other stuff has to do with anything
i have more than one 1 and more than two 2
I don't understand
okay wait im going to try to explain everything
the engine has an amount of money
15 for example
each item has a price depending on quality:
q1 = 1$
q2 = 5$
so it chooses it random, but since i want that the higuer the quality the less chance there is to get it,
i have it choose from a random.range between 0 and the max amount of a list
lets say eight amounts of 1´s and two 2´s
so its 80% and 20%
once it decides which item to buy
lets say 1 q2
the money gets set to 10 since the price is 5
it chooses again
and its another q2
5 coins remaining
now its a q1
we have 4 coins
if the engine decides to buy a q2
for each 2 in probability it should erase one two in numbers
therefore the next time it tries to buy it it cant since there is no 2 in numbers
and can only buy q1 item
i think that summarizes it well
That sounds super convoluted and prone to bugs to me.
after that i reduce the maxType -= 1 so the next quality it should remove in case it can not buy it is q1
but that is for future enemies since i now only have 2 and the q1 is 1 coin so it is always affordable
i didnt think of a better way of doing it
For starters, it sounds like several independent systems are mixed together.
it was the form that i came up with that was inside my knowledge
One that should be selecting items randomly and one that maintains the list of available items?
digital when doing things like this do each step seperately
i started doing each thing once at a time
for example in my game, item drops are rolled first by deciding if it should even drop, then deciding the amount to drop, then deciding if it should upgrade the rarity, then rolling the modifiers based on everything before
by deciding an amount ?
fixed it
yeah i had something like that
but since its not an actual shop it doesnt fit what i need
this scritp i write for +1 increment why when i hit to 3 time and hit 4th it's back to count 1
what im i wrong or missing?
my game is a wave survival and what goes shopping is the engine for random waves of enemies, so it cant be once x quality and x amount and the next just 1 amount and from quality1 since it would be unbalanced
so i assign a price to each enemy and give money to the engine to go shopping
im confused as to what you want to achieve
so it doesnt matter the combination it always has the same amount of "goldvalue"
to balance out each wave
so it wont happen that in the first round you get 4 q2 enemies and the next 2 q1
i want to kick on football hit the goal
then +1 for each hit the goal
everything ok but when it cout 1 2 3 on hit no. 4 it count 1 again
i was talking to digital sorry
what is 4 q2 and 2 q1
i went through the code but i dont know what is happening
4 amount of quality 2 enemies
and 2 amount of quality 1
you are probabaly changing scoreGoal from somewhere else, there is no reason for it to be public
i have many goal the same script
so you want to pick a random amount of enemies that add up to 15 quality?
help, I wrote the same things in what was shown in Brackey's video but I keep getting an error
not to 15 quality but to 15 coins, and each quality has a price assigned
q2 enemies have a 5 coins value
and q1 have a 1 coin value
ball hit throug many goal
yes
just roll an amount of q2 then assign the remaining to q1
or roll q3, then roll q2, then assign rest to q1
to add up to whatever amount you want
but when i roll q3 i dont want there to be more q3 than q2 or q1
so with the probability system i add that factor
ok then roll only up to half of the gold value
no ;
makes completely sense
better
but i also want there to be a possibility to be just q3 for example
ok then just do random rolls like i said
the monobehaviour isnt orange and the Transform and Debug aren't either
is that a problem?
MonoBehaviour requires using System;
you want a sum of value of coins dropped from enemy is some given number?
you need backtracking in this case
no it doesn't
but in Brackey's vid he deleted them
it needs UnityEngine only
my bad - I knew it needed something
but i want a balance between probability quality and amount
make a function then
that does what?
anyone care to take a stab at why my code would be finding an object twice?
wdym?
& no - it's not being called elsewhere
it's attached to a button, & it gets an object from the button's parent title field...
post code man
where's hastebin?
idk what that is im not that advanced on coding
its not code, its just math
if you've done algebra in high school it should be simple to you
but since i managed to do a system on which i have been working for 2 days i wanna take a rest and do something else like a new enemy or something like that
i have done algebra but the level of the school where i went was honestly shit so i didnt really learn much
how do you want this balanced?
in what way
that would be how you define your function
ohhh
idk if there is a function for that
but i want there to be a possibility where all are high quality enemies,(just unlikely to happen)
maybe 1 quality 5 enemie and 3 q1
function as in f(x) = mx + b
you would define your own
yes i know but i dont know if i have the ability to do so
kewk
what is f(x) = mx + b?
okay well then there wont be some magical way to weight your results
isn't that base notation for fractals?
functions can be mapped to a graph using x,y coordinates
srry i didnt pay that much attention in math class
close to
tbh in no class
that is point intercept form, nothing to do with fractals
ouch
i dont know how to create functions it seems
for example, this is my function to determine the quantity of loot dropped
now you too can create a function!
it does look elegant
lol, it need to fix it though, right now enemies drop way to much loot
I always was greedy :))
so just a normal algebra equation?
is using Transform.Find() a bad habit? as it's basically hard coding and prone to failure if mistyped?
yes
how do I find the pastebin/hastebin links?
so this is my function mapped to a graph where the x-axis corresponds to the monsters level and G is the loot bonus based on the rairty (500 is boss for example)
you could do something similar to weight your output based on multiple parameters
yes but it is not directed only by two factors
haha, they drop about 500 items right now, too laggy
it has to include the amount of money currently the quality of the enemies the previously bought enemies and what qualities they were how much probable it is to choose 1 enemy etc etc
and to be honest i dont to involve myself in that now
since this isnt a definitive game but just a learning one
i dont see why it even needs to be that complex at all
but that would be possible
just use more parameters
in your function
but if you were to graph it, you would make x be whatever value you want to see on the x-axis unless you want to go into 3d planes lol
other parameters you can define like I did G
yeah seems like that is what my thing would point into
you seem pretty chill
can i add you ?
sure, but no haha you would only go into higher dimensions if you want to visualize more than 1 value changing
i want to see the amount of enemies and the quality of them change
so ig it would be 3rd dimensional?
i don't think you're understanding what im saying
it seems like im not
when you graph something on a 2d plane, you are visualizing the relationship between x, your input, and y, your output
you can define more parameters, but they would have to be defined like I did G and be changed manually
since any more variables would create more dimensions
its just for visualizing
nothing else
dont let it confuse you
im dumb i thought you were calling me G BHAHAHAHAHAHA H
yeye ik
what would your parameters be and what would be your singular output
then think about how much you want each parameter to affect the output
i want more than 1 output i think
imma talk about that with a friend that graduated something related to maths so he can explain it further and for people as dumb as me
and the quality
your quality would be an input since you want to have enemies for each quality
then your function would take the quality and reduce the output if the quality is higher
in relation to your other parameters
yes but i want there to be more than 1 enemy per thing
srry i think im dumb
xD
maybe im just not understanding it for some reason
you're fine but what do you mean more than one enemy per thing
f(enemy quality, total gold amount) -> some amount of that enemy to spawn
yes?
kind off but i want the quality to be random
with a lower chance of happening
but in case it decides to do a lot of high q enemies it will produce less since the gold can only afford that much
so just assign weights to each quality
and for each enemy spawned, loop through the weights and assign the highest enemy that rolled true
srry but my brainpower is kinda off
this is my code that loops through several stat tiers and chooses the highest tier than rolled true
i would love to understand it but i have been programming for 11 hours straight with no break for either water or food and im just completely empty rn
fair lol
indeed
i hated a specific part of maths but i cant remember
on the first part wouldnt //default to the lowest tier [9]
be "the higuest
or do you have an inverted system?
where quality 1/0 is the best
then rolls all the tiers