I want my actors to stay on top of the terrain while I'm deforming it. The only way I've found to place an actor on top of a terrain deformer, and stay there while it's deforming the terrain, is by placing an unit and attaching the actor to that unit. But this would force me to place 10000 units in my map, one for each cell, which would cause too much lag.
Is there some other way to attach an actor on top of a terrain deformer?
What I've already tried and didn't work:
- Doodads.
- Models.
- Model additions with a sop to attach them to the ground.
- Model additions attached to doodads.
If I understand right, your actors won't change height with terrain deformations but units will and you don't want to have a 1000 units for 1000 actors.
My idea, but the actors won't be interactive in the sense that you can't attack, harvest, and has no collision and I have no idea if this will work:
-Set the terrain deformations to have different levels, instead of random, so you can track them. Maps have a height of -100 to 100, so use something like 0.5 deformation.
Use triggers to:
-Make one unit in the bottom left of the map with a height of 0, use triggers to attach actors to it, and use actor messages to change the the actors height and offset to whatever position you want on the map. Put all the actors in a variable actor array.
-Track deformations started (ability), the position, and height changed to (you already know how much the deformations is going to effect the terrain height). Then look though the variable actor array for any actors in range/distance and use actor messages to modify the height of them, either instantly with quick loop to give the look of it moving with the deformation. I don't think you can do a change height over time with actors.
Second idea, similar to the first but might work better?:
-Trigger: whenever the deformation ability is used check all actors in range and use actor messages to modify the height. Use a loop with a short wait to change the actor height over time to match the deformation speed.
If you have multiple deformations going off and it's too much to handle use vectors.
-Store a x, y, and z in variables.
Whenever a deformation goes off, check all actors in range, put the actor in a separate array (so you know which actors are being effected), and have a trigger which modifies the vectors of the actors in range of the deformations by something like DeformationHeight/Distance.
- First you create the terrain deformer to an invisible unit. This will cause the terrain to be deformed.
- Make sure the terrain deformer isn't destroyed when orphaned.
- Add a timed life to the unit, so it gets killed after x seconds. x should be the blend time of your terrain deformer. This way, after x seconds, the unit will be killed, but the actor won't be destroyed.
- If you want to be able to modify the terrain later, you should save your terrain deformer actor into a variable.
I should be able to use the same workaround to place an actor on the terrain. Now I need a way to reattach the actor to a new unit... I'll try what DrSuperEvil told about the references. How do I attach an actor using actor messages?
zandose's workaround seems very resource consumming.
I give up. I've been trying to understand what leviathan does but... And it seems there is no guide about references on the forums.
Leviathan tentacle adds a custom reference as a hosted attach (TentacleAttack). Then when the missile is created and it starts its motion phase, it changes its reference (::Self) to TentacleAttack. On the other hand the main actor has its its reference (::Self) set to LeviathanTentacleA (::scope.TentacleA), and the actor has its supporter set to LeviathanTentacleA.
But what does it mean? I've already set these parameters to my own actors. Now what I want is to attach, deattach, then reattach an actor to different units via triggers. What's the next thing I need to do?
I want my actors to stay on top of the terrain while I'm deforming it. The only way I've found to place an actor on top of a terrain deformer, and stay there while it's deforming the terrain, is by placing an unit and attaching the actor to that unit. But this would force me to place 10000 units in my map, one for each cell, which would cause too much lag.
Is there some other way to attach an actor on top of a terrain deformer?
What I've already tried and didn't work:
- Doodads.
- Models.
- Model additions with a sop to attach them to the ground.
- Model additions attached to doodads.
Maybe use references and change hosting of your unit actor to the reference like the tentacles do with the missile actor.
Contribute to the wiki (Wiki button at top of page) Considered easy altering of the unit textures?
https://www.sc2mapster.com/forums/resources/tutorials/179654-data-actor-events-message-texture-select-by-id
https://media.forgecdn.net/attachments/187/40/Screenshot2011-04-17_09_16_21.jpg
If I understand right, your actors won't change height with terrain deformations but units will and you don't want to have a 1000 units for 1000 actors.
My idea, but the actors won't be interactive in the sense that you can't attack, harvest, and has no collision and I have no idea if this will work:
-Set the terrain deformations to have different levels, instead of random, so you can track them. Maps have a height of -100 to 100, so use something like 0.5 deformation.
Use triggers to:
-Make one unit in the bottom left of the map with a height of 0, use triggers to attach actors to it, and use actor messages to change the the actors height and offset to whatever position you want on the map. Put all the actors in a variable actor array.
-Track deformations started (ability), the position, and height changed to (you already know how much the deformations is going to effect the terrain height). Then look though the variable actor array for any actors in range/distance and use actor messages to modify the height of them, either instantly with quick loop to give the look of it moving with the deformation. I don't think you can do a change height over time with actors.
Second idea, similar to the first but might work better?:
-Trigger: whenever the deformation ability is used check all actors in range and use actor messages to modify the height. Use a loop with a short wait to change the actor height over time to match the deformation speed.
If you have multiple deformations going off and it's too much to handle use vectors. -Store a x, y, and z in variables. Whenever a deformation goes off, check all actors in range, put the actor in a separate array (so you know which actors are being effected), and have a trigger which modifies the vectors of the actors in range of the deformations by something like DeformationHeight/Distance.
I've found a partial workaround:
- First you create the terrain deformer to an invisible unit. This will cause the terrain to be deformed.
- Make sure the terrain deformer isn't destroyed when orphaned.
- Add a timed life to the unit, so it gets killed after x seconds. x should be the blend time of your terrain deformer. This way, after x seconds, the unit will be killed, but the actor won't be destroyed.
- If you want to be able to modify the terrain later, you should save your terrain deformer actor into a variable.
I should be able to use the same workaround to place an actor on the terrain. Now I need a way to reattach the actor to a new unit... I'll try what DrSuperEvil told about the references. How do I attach an actor using actor messages?
zandose's workaround seems very resource consumming.
@IliIilI: Go
Look how the leviathan tentacle model and the associated missile model do it.
Contribute to the wiki (Wiki button at top of page) Considered easy altering of the unit textures?
https://www.sc2mapster.com/forums/resources/tutorials/179654-data-actor-events-message-texture-select-by-id
https://media.forgecdn.net/attachments/187/40/Screenshot2011-04-17_09_16_21.jpg
I give up. I've been trying to understand what leviathan does but... And it seems there is no guide about references on the forums.
Leviathan tentacle adds a custom reference as a hosted attach (TentacleAttack). Then when the missile is created and it starts its motion phase, it changes its reference (::Self) to TentacleAttack. On the other hand the main actor has its its reference (::Self) set to LeviathanTentacleA (::scope.TentacleA), and the actor has its supporter set to LeviathanTentacleA.
But what does it mean? I've already set these parameters to my own actors. Now what I want is to attach, deattach, then reattach an actor to different units via triggers. What's the next thing I need to do?