[Solved] Spawner, How to distinguish the entities spawned?

0

I am trying to have characters spawn in on a spawner. It is all working so far, but if I hit one of them and do 50 damage to there 100 health, all of them that are spawned take 50 damage, because they are all using the same script canvas graph. Does anyone know how to give every child that spawns from a spawner its own health that gets damaged only if he gets damaged? I cannot seem to be able to figure this out for Script Canvas. This is the graph I am using to do damage to the Character. The Hit Test is a Script Event Sent over every time I hit a character. REMOVEDUPLOAD

asked 4 years ago203 views
10 Answers
0
Accepted Answer

@REDACTEDUSER

HitPoints2.zip|attachment (108.0 KB)

See the above zip. It has four slices and four script canvases. This is a way to use collision events.

Place the spawner slice in a level (it's just a marker, it has no mesh). Place the player slice facing the spawner about 20 meters away and maybe 4-5 meters in the air (it has a camera, no mesh).

Hit play.

The spawner will eject a cube every second with a random number of hit points, 1-3. Each cube will show how many points it spawns with. Each time a cube collides with an entity with a projectile tag, it loses a point and displays its hit points. At 0 hit points the cube is destroyed.

The player camera fires a sphere projectile every 0.2 seconds that can live for two seconds. If the projectile hits a few entities with an enemy tag, it's destroyed.

The spawner and fire script canvases both use OnTIck. In a game I wouldn't do this, just doing it to automate the spawning of many cubes and projectiles.

Edit: This little demo can reach a point where there are too many collisions happening. Turning on Continuous collision detection in the PhysX Configuration tool helps.

answered 4 years ago
0

I Solved for you , I publish a video tutorial for you ... soon 😉

answered 4 years ago
0

You must use Raycast(Hit Point)+Tag(your character/your enemies)+ number variable(health) , You do not use Script Event , cause script send/rec signal for all your character in one time (you trying use GunHit Event but it is not logical correct) 🙂 I hope useful my tips 😊

answered 4 years ago
0

@REDACTEDUSER PhysXRaycast & Global Variable Script Canvas Graph 👇 PhysXRayCastGlobalVariableAhmadKarami.zip|attachment (26.6 KB)

Part10_PhysXRayCast and Global Variable Tutorial_Kurdish Language_Lumberyard 1.25 👇 https://www.youtube.com/watch?v=caqpRv4h0g4

answered 4 years ago
0

I watched this, and copied everything exactly, but still no luck. I made a cube and added everything that should be needed. Is there something else needed on the Player? Because my Cube looks just like your cubes with the tag Box, but the Raycast does not pick it up when I look at it. Plus I do not have the UI you have when you start draining the multiplier. Is that needed? With whats in this video I do not believe this can be replicated.

answered 4 years ago
0

[quote="_AhmadKarami, post:4, topic:9210"] PhysXRaycast & Global Variable Script Canvas Graph 👇 PhysXRayCastGlobalVariableAhmadKarami.zip (26.6 KB) [/quote]

I inserted my graph in top 👆 I did this without ui-target-point, cause PhysXRaycast running in game, you can add ui-target-point but without ui-target point physx raycast does work 🙂 yes you need to 1000 meter(custom number by weapon range you want) by multiplier node for forward direction , also you must use point light(diffuse multiplier param in point light) for health box , yes , you must use point light component , you can turn off light(visible=false) but you must use point light component , cause this replace for global variable, that is all , very easy 😉

answered 4 years ago
0

Also you must use physX collider/physX rigid body or physX character component + tag component , you do not forget , you must the graph top add to your camera player entity , I hope you do it , you get good result like me 😊

I used tag for all boxs , if tag = "Box" decrease health else if tag!="Box" like MyBox or any string value , no change health 🙂

answered 4 years ago
0

@REDACTEDUSER

Are the entities you are spawning dynamic slices?

Tell me a bit about how this is all set up and I will try to help.

Raycasts are fantastic in certain situations, but not necessary depending on what you are doing.

Also, recommend you do not do things on tick unless you have to. For example, if your game has a score board and you want to make it roll like a pinball machine, where instead of just adding 1,000 points for something, it adds some fraction of points until it reaches 1,000, you do that sort of thing on tick. Updating a timer on screen, do that on tick.

The health of every entity running that script is getting checked every tick whether it changes or not. Using events and event handlers is way more efficient for this sort of thing. For what you have in your current script, a better way would be to just check the health at the end of the hit, and if it's 0 or less, destroy the entity.

answered 4 years ago
0

@REDACTEDUSER

answered 4 years ago
0

Hi Thank you all for helping out on this problem! 👍 But I have finally figured it out, I did use @REDACTEDUSER

answered 4 years ago

This post is closed: Adding new answers, comments, and votes is disabled.