Forgive me as I'm rather new to this, but is there a way to spoof the source of events generated from the ActorSend function?
For example, the Goliath actor responds to the "UnitBirth". In the data editor it also specifies a "source", which in this case is "Goliath". The goliath then plays a sound when the message is recieved. Sending it the message "UnitBirth" doesn't do anything (I also tried UnitBirth.Goliath :/ ), and I'm assuming its this source field. There are also lots of other actors and events which filter events based on the source field it seems, browsing through the data editor.
Is there a way that I could send an event in Galaxyscript to trigger this action? I realize that I could probably modify things in the data editor to achieve the same end result, however I'm not interested in a solution using the data editor.
Any insight is appreciated!
(For what its worth, the reason I'm only interested in galaxyscript is that its for the Cortex mod, a sandbox-ish mod some people use for roleplaying. so I'm stuck with data thats already defined in SC dependencies.)
Think of Actor Events as Triggers. They're comprised of an Event that initiates the action (ex: UnitBirth specifies the action to occur when the unit is born), Terms (similar to conditions, also optional), and an Action that specifies what happens (ex: PlaySound).
What exactly are you trying to accomplish?
Regardless, it sounds like you want to use ActorSend() to send a Signal(), which can then be defined in the targets actor events. Ex:
//Goliath Unit ActorSignal.FadeOut>SetOpacity0.01.0//ScriptActorSend(libNtve_gf_MainActorofUnit(EventUnit()),libNtve_gf_Signal("FadeOut"));
What exactly am I trying to acomplish? Well at this point I don't really know. I'm just seeing what is/is not possible, given the limitations of both the starcraft engine, and the Cortex mod that I'm working in. Since I can only use data thats already defined due to using Cortex, I need to find more creative ways of doing things.
In the Cortex mod I can issue any event at will to an actor. However, using the goliath again as an easy example, I can give it the "UnitBirth" event, but I can't seem to get it to respond to it. (i.e. I can't trigger the action)
Looking in the data editor, and the Goliath actor, I see "UnitBirth.Goliath" will create a SoundEmitter "Goliath_Ambiance".
I do not know what to send to the Goliath actor to make that happen, or If thats even possible without editing the actor data.
Do you know more about the 'Source Name' field of the actor event trigger? How is it used and what's whe purpose of having it here?
When you using actors with triggers you dont need data events. You issuing messages directly from triggers. If you want to create unit actor just use action "create actor", you can create emmiters after that manualy with triggers, or just open events in data of that actor and put ActorCreation -> Create Soundmiter. If you plan to use actors with triggera you should send every message on trigger events, not data. Ofcourse sometimes you will need some preset-type actors which will be like build blocks for your script, because such events as ActorOrphan and MoverArrival cannot be triggered from script but only from actor system itself.
Oh, neat! Is there a way I can find out which events are only triggered from the actor system? Or, the converse, which events I Can send?
Is there a way to activate/disable turrets with events? (I noticed a TurretEnable and TurretDisable event)
Thanks for all the great info here, guys, it's helped me a bunch!
Is there a way I can find out which events are only triggered from the actor system? Or, the converse, which events I Can send? Is there a way to activate/disable turrets with events? (I noticed a TurretEnable and TurretDisable event)
It's pretty intuitive actualy. Any event that get triggered by gameplay (like UnitBirth, Effect.Anything.Start, Behaviour.*.On, etc) must be generated with script by sending actor messages. For example if you want trigger variant of ability that deals damage in AOE and create some explosion there, you must execute damage effect for each unit within area, and then use Create Actor Function. Look in my test map. I'm usualy using triggers for fast sketching of ability's visual effects, cuz it is taking less time than with data and i can modify it easily. After i'm getting satisfied i remaking it with data.
In my map you will see that i'm creating actors like "ModelOneShot" which destroys itself after playing animation sequence. This is defined in events+ field of that actor, you cant access event like AnimationDone with triggers, it's produced by the actor system. If you will use "Model" actor instead of "ModelOneShot" it won't destroy itself cuz it's events+ field is rather blank. So you will need to manualy destroy it after some period of time (when animation done) this will require additional "wait" function which will hit the performance. Anyway i hope you got the point. Map Attached, Use RMB to spawn some visual effects. And yes you can turn turrets on/off and even create your own turret system from scratch.
Forgive me as I'm rather new to this, but is there a way to spoof the source of events generated from the ActorSend function?
For example, the Goliath actor responds to the "UnitBirth". In the data editor it also specifies a "source", which in this case is "Goliath". The goliath then plays a sound when the message is recieved. Sending it the message "UnitBirth" doesn't do anything (I also tried UnitBirth.Goliath :/ ), and I'm assuming its this source field. There are also lots of other actors and events which filter events based on the source field it seems, browsing through the data editor.
Is there a way that I could send an event in Galaxyscript to trigger this action? I realize that I could probably modify things in the data editor to achieve the same end result, however I'm not interested in a solution using the data editor.
Any insight is appreciated!
(For what its worth, the reason I'm only interested in galaxyscript is that its for the Cortex mod, a sandbox-ish mod some people use for roleplaying. so I'm stuck with data thats already defined in SC dependencies.)
@TheMoro: Go
Think of Actor Events as Triggers. They're comprised of an Event that initiates the action (ex: UnitBirth specifies the action to occur when the unit is born), Terms (similar to conditions, also optional), and an Action that specifies what happens (ex: PlaySound).
What exactly are you trying to accomplish?
Regardless, it sounds like you want to use ActorSend() to send a Signal(), which can then be defined in the targets actor events. Ex:
@PirateArcade | I make games | Ask me things on Discord
@greythepirate: Go
What exactly am I trying to acomplish? Well at this point I don't really know. I'm just seeing what is/is not possible, given the limitations of both the starcraft engine, and the Cortex mod that I'm working in. Since I can only use data thats already defined due to using Cortex, I need to find more creative ways of doing things.
In the Cortex mod I can issue any event at will to an actor. However, using the goliath again as an easy example, I can give it the "UnitBirth" event, but I can't seem to get it to respond to it. (i.e. I can't trigger the action) Looking in the data editor, and the Goliath actor, I see "UnitBirth.Goliath" will create a SoundEmitter "Goliath_Ambiance". I do not know what to send to the Goliath actor to make that happen, or If thats even possible without editing the actor data.
Do you know more about the 'Source Name' field of the actor event trigger? How is it used and what's whe purpose of having it here?
When you using actors with triggers you dont need data events. You issuing messages directly from triggers. If you want to create unit actor just use action "create actor", you can create emmiters after that manualy with triggers, or just open events in data of that actor and put ActorCreation -> Create Soundmiter. If you plan to use actors with triggera you should send every message on trigger events, not data. Ofcourse sometimes you will need some preset-type actors which will be like build blocks for your script, because such events as ActorOrphan and MoverArrival cannot be triggered from script but only from actor system itself.
@abvdzh: Go
Oh, neat! Is there a way I can find out which events are only triggered from the actor system? Or, the converse, which events I Can send? Is there a way to activate/disable turrets with events? (I noticed a TurretEnable and TurretDisable event)
Thanks for all the great info here, guys, it's helped me a bunch!
It's pretty intuitive actualy. Any event that get triggered by gameplay (like UnitBirth, Effect.Anything.Start, Behaviour.*.On, etc) must be generated with script by sending actor messages. For example if you want trigger variant of ability that deals damage in AOE and create some explosion there, you must execute damage effect for each unit within area, and then use Create Actor Function. Look in my test map. I'm usualy using triggers for fast sketching of ability's visual effects, cuz it is taking less time than with data and i can modify it easily. After i'm getting satisfied i remaking it with data.
In my map you will see that i'm creating actors like "ModelOneShot" which destroys itself after playing animation sequence. This is defined in events+ field of that actor, you cant access event like AnimationDone with triggers, it's produced by the actor system. If you will use "Model" actor instead of "ModelOneShot" it won't destroy itself cuz it's events+ field is rather blank. So you will need to manualy destroy it after some period of time (when animation done) this will require additional "wait" function which will hit the performance. Anyway i hope you got the point. Map Attached, Use RMB to spawn some visual effects. And yes you can turn turrets on/off and even create your own turret system from scratch.