Hello,
I've attached an actor to a unit, but I'm now having issues on if there was a way to remove that actor. The actor I'm attaching is Medium Fire. Is there anyway to remove the attached actor from the unit?
Send a destroy message to that actors. So in the actor events of the unit actor, have it do a destroy message, and for the Target, put the ID of the attached actor.
I'm sending a Destroy message to the unit, though that only destroys the Unit's model rather than the attach unit's model. I don't see any place to put in the ID.
When you select the destroy message, there is a blank field above everything, with the label of "Target". Put the ID in there, it is not a drop down, you must type the ID in (since it takes more then just ID's).
In your medium fire actor, put in a Signal event with a subname "destroyfire". And have that signal Destroy the actor.
Then use a trigger to send actor message "Signal destroyfire" to all actors in actor scope (actor scope for the unit).
This will signal every actor attached to the unit, and if the actor has the subname "destroyfire", it will activate the signal which is to destroy that actor.
Attaching:
Actor - Attach Fire Medium to Head on (Picked unit)
Actor - Send message "Signal MediumFire" to actor (Last created actor)
Removing:
Actor - Send actor message "Signal MediumFire" to main actor of unit (Picked unit)
Actor - Send actor message "Destroy" to all actors in actor scope (Actor scope for (Picked unit))
Sorry, I forgot to mention. You have to go into the data editor to add a signal event.
In the data editor of your Fire Medium actor, add a new event called Signal. Put in a name in the subname area. Then put in Destroy under the signal event.
Then to remove the fire medium actor with trigger, you send an actor message "Signal .. " to actor scope of unit. It has to be actor scope in order to hit every actors attached to the unit.
Its pretty complicated that needs some data editing. But there's no way around it. You cannot just send a destroy message to actors because that just destroys every actor. Signal is needed so only actors with the correct signal name will react.
edit
Actually, there's a way to not do data editing. Just set a variable for the actor fire medium actor after you attach it. Then send destroy message directly to the that variable instead. That should work too.
That's something I wanting to attempt, but I need multiple variables with an Array as this will happen to the Picked Unit meaning what should the Array be to mark it on the specific unit the fire medium has spawned on?
You could save the array index of the actor in your array as a custom value in the unit.
Set custom value 0 of the unit to (a number). Now in your Picked Unit, get the custom value 0 from your unit. That's how array index can be stored directly to a unit.
All custom values are stored as real, it will need to be converted from Real to Integer. And you can store a bunch of other custom values to each unit too. Custom values is very useful.
You can also use the data table feature. Simply get the unit ID, convert it to a string and use it as key. Then, add the attached actor as value.
Later you can simply look up the actor in the data table and send the destroy event.
I haven't touched the Data table feature. Just looked at it briefly and it gave me a big headache. :p
One question, how to get the unit ID? Does the game itself assigned each unit an unique ID, or do you have to manually assign it ( by setting it in the custom values)? There doesn't seem to be a retrieve unit ID function in the editor..
Maybe I'll start using data tables, but right now, I'm just using records + presets to create my own data structures.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Hello,
I've attached an actor to a unit, but I'm now having issues on if there was a way to remove that actor. The actor I'm attaching is Medium Fire. Is there anyway to remove the attached actor from the unit?
Send a destroy message to that actors. So in the actor events of the unit actor, have it do a destroy message, and for the Target, put the ID of the attached actor.
@ArcaneDurandel: Go
I'm sending a Destroy message to the unit, though that only destroys the Unit's model rather than the attach unit's model. I don't see any place to put in the ID.
@Darkblizzard: Go
When you select the destroy message, there is a blank field above everything, with the label of "Target". Put the ID in there, it is not a drop down, you must type the ID in (since it takes more then just ID's).
@ArcaneDurandel: Go
There is no textbox to insert the ID as this is what I currently have.
"Actor - Send message "Destroy" to actor (Actor from reference "MediumFire")"
@Darkblizzard: Go
In your medium fire actor, put in a Signal event with a subname "destroyfire". And have that signal Destroy the actor.
Then use a trigger to send actor message "Signal destroyfire" to all actors in actor scope (actor scope for the unit).
This will signal every actor attached to the unit, and if the actor has the subname "destroyfire", it will activate the signal which is to destroy that actor.
@Darkblizzard: Go
Oh, I misunderstood, I forgot this was in the triggers section.
In which case, you need to get the actor from the unit actor scope, then send the destroy message to it.
@sandround: Go
Well, not sure if this is right.
Attaching:
Actor - Attach Fire Medium to Head on (Picked unit)
Actor - Send message "Signal MediumFire" to actor (Last created actor)
Removing:
Actor - Send actor message "Signal MediumFire" to main actor of unit (Picked unit)
Actor - Send actor message "Destroy" to all actors in actor scope (Actor scope for (Picked unit))
@Darkblizzard: Go
Sorry, I forgot to mention. You have to go into the data editor to add a signal event.
In the data editor of your Fire Medium actor, add a new event called Signal. Put in a name in the subname area. Then put in Destroy under the signal event.
Then to remove the fire medium actor with trigger, you send an actor message "Signal .. " to actor scope of unit. It has to be actor scope in order to hit every actors attached to the unit.
Its pretty complicated that needs some data editing. But there's no way around it. You cannot just send a destroy message to actors because that just destroys every actor. Signal is needed so only actors with the correct signal name will react.
edit
Actually, there's a way to not do data editing. Just set a variable for the actor fire medium actor after you attach it. Then send destroy message directly to the that variable instead. That should work too.
@sandround: Go
That's something I wanting to attempt, but I need multiple variables with an Array as this will happen to the Picked Unit meaning what should the Array be to mark it on the specific unit the fire medium has spawned on?
@Darkblizzard: Go
You could save the array index of the actor in your array as a custom value in the unit.
Set custom value 0 of the unit to (a number). Now in your Picked Unit, get the custom value 0 from your unit. That's how array index can be stored directly to a unit.
All custom values are stored as real, it will need to be converted from Real to Integer. And you can store a bunch of other custom values to each unit too. Custom values is very useful.
@sandround: Go
You can also use the data table feature. Simply get the unit ID, convert it to a string and use it as key. Then, add the attached actor as value. Later you can simply look up the actor in the data table and send the destroy event.
No need for complex array management.
@Mille25: Go
I haven't touched the Data table feature. Just looked at it briefly and it gave me a big headache. :p
One question, how to get the unit ID? Does the game itself assigned each unit an unique ID, or do you have to manually assign it ( by setting it in the custom values)? There doesn't seem to be a retrieve unit ID function in the editor..
Maybe I'll start using data tables, but right now, I'm just using records + presets to create my own data structures.