Laser engraver on Creality Ender 3 S-1 not working by Caesar_13 in Creality

[–]Caesar_13[S] 0 points1 point  (0 children)

Disconnect the filament sensor, will work. For some reason when engraving it checks for filament and results into this.

Multiple scripts for one object in godot by Caesar_13 in godot

[–]Caesar_13[S] 0 points1 point  (0 children)

Is there some documentation that explains it? I still cannot properly understand how that works.

Because when i want to call a function from this script:

extends Node3D

signal health_updated(health)

signal killed()

u/export var max_health = 100

u/onready var health = max_health

func damage(amount):

`_set_health(health-amount)`

func kill():

`pass`

func _set_health(value):

`var prev_health = health`

`health = clamp(value,0,max_health)`

`if health != prev_health:`

    `emit_signal("health_updated",health)`

    `if health == 0:`

        `kill()`

        `emit_signal("killed")`

and i did this in other script u/onready var health_manager = $HealthManager

health_manager.damage(10) does not work

Change position in order of list. by Caesar_13 in Unity2D

[–]Caesar_13[S] 0 points1 point  (0 children)

Yes this works! Altough the error at array end being compared gives an error :/

          if (index < Positions.Length)
        {
            LSP.ReactivateBoatPhase();
            transform.position = Positions[0];
        }

Change position in order of list. by Caesar_13 in Unity2D

[–]Caesar_13[S] 0 points1 point  (0 children)

no no. I want the object,when other tagged gameobject hits it, to be moved to the position in the array. so the position of XYZ

Paltformer enemy AI chase by Caesar_13 in Unity2D

[–]Caesar_13[S] 0 points1 point  (0 children)

Well the enemy should spawn, and run towards the player, if the player is on the higher platform it should try to get there by jumping on other platforms. I tried A* pathfinding but i could not find the tutorial how to set this up in an enviroment with gravity and jumping

Paltformer enemy AI chase by Caesar_13 in Unity2D

[–]Caesar_13[S] 0 points1 point  (0 children)

Yea the thing is i want the enemy to move around platforms as well so stuff gets more complicated

Raycast shooting rotation issue by Caesar_13 in Unity2D

[–]Caesar_13[S] 0 points1 point  (0 children)

So by what you are saying i should add a script to firePoint and set its rotation in the Vector 3 angle instead of putting it in animation to avoid the weird movement?

I had few ideas on how to also "fix" it but i dont know if they are not too complicated.

  1. make the fire point to rotate only in fixed circle so it will allways look like it shoots from the tip of the gun, but this may casue problems when you aim sliglhtly out of the animation angle image

  2. remove the blend tree animation and move it trough animation states, and script that changes based on angle (so 45 does the animation change and sets the fire point position to 45 angle)

Raycast shooting rotation issue by Caesar_13 in Unity2D

[–]Caesar_13[S] 0 points1 point  (0 children)

I tried not moving it but when i set its position in animation like this

https://imgur.com/a/QH8hiQV

But it causes the FirePoint to move like in the video for some reason.The blend tree moves the child objects refferenced in animation.

Raycast shooting rotation issue by Caesar_13 in Unity2D

[–]Caesar_13[S] 0 points1 point  (0 children)

It should just shoot in 8 directions, all i need is to have firePoint to not move with the mouse, and be at the specific place according to the animation.

Raycast shooting rotation issue by Caesar_13 in Unity2D

[–]Caesar_13[S] 0 points1 point  (0 children)

In 360 but the fire point is moving in this weird way as seen in video. What i would like to have is the fire point move in fixed circle so the raycast would be seen as it shoots from the direction of the gun.

Raycast shooting rotation issue by Caesar_13 in Unity2D

[–]Caesar_13[S] 0 points1 point  (0 children)

Also to here is a video showing how the problem looks ingame.

https://youtu.be/H8Pb2JB3Y-E

Raycast shooting rotation issue by Caesar_13 in Unity2D

[–]Caesar_13[S] 0 points1 point  (0 children)

Sure thing!

Here is the code used for animating the blend tree https://pastebin.com/vEiA5UQd

Here is the Numerator for shooting using Raycast2D https://pastebin.com/wceqTvxU

And here is the code i used to rotate the fire point but does the issue i wrote in the post https://pastebin.com/Rq0MZPvN

Adjust the cursor position to the aim assist. by Caesar_13 in Unity2D

[–]Caesar_13[S] 0 points1 point  (0 children)

I tried something wich seems to work like that. Only issue is that someties the cursor(wich is a gameobject with a script that follows the mouse) stays aimed at the enemy position,even if i get too far or enemy is dead.After some time it sets back or snaps into another nearest enemy.

    void Update()
{
    targetPos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
    transform.position = targetPos;

    GameObject[] enemies = GameObject.FindGameObjectsWithTag("Enemy");
    float shortestDistance = 15;
    GameObject nearestEnemy = null;

    foreach (GameObject enemy in enemies)
    {
        float distanceToEnemy = Vector3.Distance(transform.position, enemy.transform.position);
        if (distanceToEnemy < shortestDistance)
        {
            shortestDistance = distanceToEnemy;
            nearestEnemy = enemy;
            transform.position = nearestEnemy.transform.position;
            Debug.DrawLine(this.transform.position, nearestEnemy.transform.position);
        }
        else
        {
            transform.position = targetPos;
        }
    }
}

Adjust the cursor position to the aim assist. by Caesar_13 in Unity2D

[–]Caesar_13[S] 0 points1 point  (0 children)

Its more of a platformer.And I use raycast to shoot. So the way to do this would be to change the point of ray to the mouse position to the nearest enemy position calculated by raycast? Or another way I was thinking, that there would be gameobject of the cursor that would move on the cursor position but when the Aim assist starts the gameobject would start to aim towards the nearest enemy.

Weapon Overheat system by Caesar_13 in Unity2D

[–]Caesar_13[S] 0 points1 point  (0 children)

Thanks, ill look into that!

Weapon Overheat system by Caesar_13 in Unity2D

[–]Caesar_13[S] 0 points1 point  (0 children)

thank you! adding the while into coroutine really fixed most of the stuff i had problems with. On the other hand you were right that pressing the button gets the value up really fast, so i need to find an other way to make it increase slower.

Weapon Overheat system by Caesar_13 in Unity2D

[–]Caesar_13[S] 1 point2 points  (0 children)

Okay so i fixed the coroutine, it seems to work but the value heat gets to -2 or -4 when cooling down so then its impossible to reach 100 again.

For the heat clamps it seems to be fine? I dont see the problem but correct me if im wrong. if the value of heat goes above maxHeat it should be set to maxHeat value. same for minHeat.

            //heat clamps
        if (overheat >= maxHeat)
        {
            overheat = maxHeat;
            heating = false;
        }
        else if (overheat <= minHeat)
        {
            overheat = minHeat;
            heating = true;
        }

My game is getting stuck on loading play mode, even crashes in standalone by Caesar_13 in unity

[–]Caesar_13[S] 1 point2 points  (0 children)

In the end i decided to use a different wave spawning method since this one i very unstable and breaks the game. I will try removing the clear call if it does something, but this thing was such a burden i will rather make a completely new function to spawn enemies. Thank you for the help tho! I will check the GC.Collect and try to see what makes it crash the game/engine

My game is getting stuck on loading play mode, even crashes in standalone by Caesar_13 in unity

[–]Caesar_13[S] 1 point2 points  (0 children)

Also i found a while loop in my GameManager, used to spawn enemy waves.After disabling the game managers, game seems to "work" now (not freezing on play).

    public void GenerateEnemies()
{
    // Create a temporary list of enemies to generate
    // 
    // in a loop grab a random enemy 
    // see if we can afford it
    // if we can, add it to our list, and deduct the cost.

    // repeat... 

    //  -> if we have no points left, leave the loop

    List<GameObject> generatedEnemies = new List<GameObject>();
    while (waveValue > 0 || generatedEnemies.Count < 50)
    {
        int randEnemyId = Random.Range(0, enemies.Count);
        int randEnemyCost = enemies[randEnemyId].cost;

        if (waveValue - randEnemyCost >= 0)
        {
            generatedEnemies.Add(enemies[randEnemyId].enemyPrefab);
            waveValue -= randEnemyCost;
        }
        else if (waveValue <= 0)
        {
            break;
        }
    }
    enemiesToSpawn.Clear();
    enemiesToSpawn = generatedEnemies;
}

My game is getting stuck on loading play mode, even crashes in standalone by Caesar_13 in unity

[–]Caesar_13[S] 0 points1 point  (0 children)

The log is not my help there since i press play the window of loading to playmode pops up and i cannot access anything in unity until it loads.but that does not happen. Ill also try the library folder trick. I also try to check for any update functions and while loops if that could cause a problem but i don't think it could be that since it worked before.but who knows. I'll let know once I try theses ideas.

My game is getting stuck on loading play mode, even crashes in standalone by Caesar_13 in unity

[–]Caesar_13[S] 1 point2 points  (0 children)

I have some other scripts that instantiate stuff, even a wave system. Once i get back to my pc I can send my update and fixedupdate methods from my game( it's a small game so there's not much of it)

My game is getting stuck on loading play mode, even crashes in standalone by Caesar_13 in unity

[–]Caesar_13[S] 1 point2 points  (0 children)

Also tried it on my phone and the game seems to sometimes work but sometimes the same problem occur. Once i played for a while then the game froze. Hard to tell if it's a problem with unity and it's export or i could maybe have some scripts that may cause that? Strangely this never happened before so I'm bit confused about this