Is it possible to control an actor sprites through script?

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Post Reply
Boomer666
Posts: 11
Joined: Tue Jun 26, 2018 9:41 pm

Is it possible to control an actor sprites through script?

Post by Boomer666 »

I really want to know if controlling or forcing an actor sprite to enter specific state (especially the player actor) for a cut-scene purpose is possible through script. According to my experience, it kinda possible but in very messy way, involving dummy actor and need perfect timing to execute the script :? . So perhaps anyone in here can shed some light or explain how to do this if possible?
User avatar
Ichor
Posts: 1784
Joined: Wed Jul 23, 2003 9:22 pm

Re: Is it possible to control an actor sprites through scrip

Post by Ichor »

SetActorState might work.
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Contact:

Re: Is it possible to control an actor sprites through scrip

Post by Matt »

SetStateLabel

Not sure if you want it to do that to the player though... it might be safer to spawn a new actor that inherits the player's sprite and translation and manipulate that.
Boomer666
Posts: 11
Joined: Tue Jun 26, 2018 9:41 pm

Re: Is it possible to control an actor sprites through scrip

Post by Boomer666 »

Ichor wrote:SetActorState might work.
Okay so just i ran minor test about SetActorState on a custom monster (BFG Guy) to enter his "missile" state. Yes the monster did enter the "missile" state, however, he doesn't fire BFG projectile at all instead just played the "missile" state animation only. Did i do anything wrong? or maybe i have to put a map spot on front of him to spawn BFG Ball?
Matt wrote:SetStateLabel

Not sure if you want it to do that to the player though... it might be safer to spawn a new actor that inherits the player's sprite and translation and manipulate that.
Ah well just what i'm afraid of but nevertheless you're right, it will be much simpler and safer to use dummy actor. TBH, I'm not familiar with what you just showed me in that link like how, where and when to use it. Is there any map sample which using that stuff so i can learn it?
Blue Shadow
Posts: 5043
Joined: Sun Nov 14, 2010 12:59 am

Re: Is it possible to control an actor sprites through scrip

Post by Blue Shadow »

Boomer666 wrote:Yes the monster did enter the "missile" state, however, he doesn't fire BFG projectile at all instead just played the "missile" state animation only. Did i do anything wrong?
It most probably didn't have a target to shoot at; A_CustomMissile doesn't spawn a projectile if the calling actor doesn't have a target.
User avatar
Arctangent
Posts: 1235
Joined: Thu Nov 06, 2014 1:53 pm
Contact:

Re: Is it possible to control an actor sprites through scrip

Post by Arctangent »

Boomer666 wrote:Ah well just what i'm afraid of but nevertheless you're right, it will be much simpler and safer to use dummy actor. TBH, I'm not familiar with what you just showed me in that link like how, where and when to use it. Is there any map sample which using that stuff so i can learn it?
It's [wiki]ZScript[/wiki], which isn't tied to a map but the entire mod. Probably not the best thing to be coding cutscenes with.
Boomer666
Posts: 11
Joined: Tue Jun 26, 2018 9:41 pm

Re: Is it possible to control an actor sprites through scrip

Post by Boomer666 »

Blue Shadow wrote: It most probably didn't have a target to shoot at; A_CustomMissile doesn't spawn a projectile if the calling actor doesn't have a target.
Now you mentioned it, i did check the friendly flag on both calling and target actor in the editor hoping to get clean cut-scene for result but unfortunately, that is the very reason why the calling actor (BFG Guy) doesn't spawn his projectile (unless there is a way i'm unaware of to force him to spawn his projectile).

Now if i unchecked friendly flag on target that just kinda defeat the purpose of this cut-scene and the result will be more like wandering gladiators. So what do you suggest to make the calling actor to spawn his projectile?
Arctangent wrote:It's [wiki]ZScript[/wiki], which isn't tied to a map but the entire mod. Probably not the best thing to be coding cutscenes with.
Offf... i don't think that is the best option either since i don't have any knowledge/experience at all.
Post Reply

Return to “Scripting”