How to replacen in-game actr with a different actor

Hey guys,

Im working on a tower defense game in which i want to be able to destroy a tower using left click and instantly replace it with a new tower, therefor creating an ‘upgradeable tower’ mechanic.

All of the above tecthnically works except for the fact that i cannot seem to get the new actor to get the correct location therefor when it spawns it seems to spawn at the centre of the map, whereas i want it to spawn in the same position as the original tower.

Below is the blurpritnt script i am working with:

is there something else i could try as popposed to ‘getactorlocation’? if you could suggest any tweaks i could make that’d be great.

Thanks! :slight_smile:

Add a breakpoint to the spawn node and check what variable the vector provides.
All i can think of is that u have a logical error… That the Actor u want to get the location from doesn’t exist…
Think about that…
First u destroy the actor and than u want to spawn an actor and this actor should get its location from an actor u destroyed a second before…

TRY THIS

  1. : Save the vector in a variable (The one u get from GetActorLocation())
  2. : Destroy the actor
  3. : Spawn the new actor with the vector from the variable

I hope I could help you

Thank you it is working now you have been very helpful. :slight_smile:

However after further testing im now having the issue where i can spawn multipes of the same ‘upgraded’ tower on top of one another by spamming the left mouse button.

What can i do to get around this?
I’ve tried the ‘do once’ node but its not really suiting the purpose as it works once, then the left mouse button only deletes the actor when clicking on the tower to upgrade it which is useless since i want to player to be able to upgrade more than one tower should they want to do that,

i’m korean.
i don’t speak English…T.T…
this way use!
transform is location and angle included…