Can a replacement spark actor be made?

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
User avatar
Enjay
 
 
Posts: 26573
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland

Can a replacement spark actor be made?

Post by Enjay »

[edit]
Here is my WiP
http://files.drdteam.org/index.php/file ... uspark.zip
[/edit]


I wasn't sure whether to put this into the resources thread or here because I am looking for someone with a better brain than me to do the hard work. :P

I would love to be able to get a spiffy looking spark actor of the kind that many people have already created but this one should be able to reproduce the functionality of the built in spark actor. ie, it would just sit there waiting to be activated then, when it was, it would produce a shower of sparks then stop and wait for the next activation. What's more, it would be nice (but not essential) if the number of sparks produced could be read from the actor's arguments (like the built in actor).

ie, what I want is an actor that I can load to replace the standard spark actor and have it work in all levels and mods without having to alter those mods.

So, I know what I want but I can't really think of how to do it. Anyone got any ideas/submissions?
Last edited by Enjay on Tue Jan 05, 2010 8:43 pm, edited 2 times in total.
Gez
 
 
Posts: 17934
Joined: Fri Jul 06, 2007 3:22 pm

Re: Can a replacement spark actor be made?

Post by Gez »

Nothing seems impossible. A [wiki]SwitchableDecoration[/wiki] can be used as a basis to make it "activatable". The arguments can be read in [wiki]DECORATE expressions[/wiki] and [wiki=A_SetArg]modified[/wiki] to make a countdown in another arg. So you'd have something like this (pseudocode):

Spawn:
Inactive:
<do nothing>
Wait
Active:
A_SetArg(4, args[0])
// Fall through to Loop
Loop:
A_JumpIf(args[4] == 0, "EndOfLoop")
A_SpawnItemEx("Some spark FX", blah blah blah)
A_SetArg(4, args[4] - 1)
Goto Loop
EndOfLoop:
Thing_Deactivate(0)
Goto Spawn
User avatar
Logan MTM
Posts: 678
Joined: Mon Jan 16, 2006 8:53 pm
Location: Rio de Janeiro - Brazil

Re: Can a replacement spark actor be made?

Post by Logan MTM »

Check the LOS's Spark!
User avatar
Enjay
 
 
Posts: 26573
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland

Re: Can a replacement spark actor be made?

Post by Enjay »

OK, thanks for the help. Between what has been posted here and an example from solarsnowfall that he did ages ago, I've got something that is coming pretty close to what I was looking for.

There is one issue that I hadn't even considered when asking my original question though. The built-in actor defaults to 32 sparks if the spark count argument is not set. Some mods have the spark actor placed with the argument set to zero and, of course, the original actor works because it produces 32 sparks. However, the new spark replacement fails because it reads 0 as just that, 0, and does not default to 32.

So, is there any way to make the actor default to 32 but if the argument on the map-placed actor is set, use that instead?

For information, here's what I have so far:
Spoiler:
If you are wondering why I use the state label "Sparky" instead of "Loop", Zdoom complained when I used "Loop".
Gez
 
 
Posts: 17934
Joined: Fri Jul 06, 2007 3:22 pm

Re: Can a replacement spark actor be made?

Post by Gez »

Enjay wrote:There is one issue that I hadn't even considered when asking my original question though. The built-in actor defaults to 32 sparks if the spark count argument is not set. Some mods have the spark actor placed with the argument set to zero and, of course, the original actor works because it produces 32 sparks. However, the new spark replacement fails because it reads 0 as just that, 0, and does not default to 32.
Seems trivial enough to address:
Spoiler:
User avatar
Enjay
 
 
Posts: 26573
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland

Re: Can a replacement spark actor be made?

Post by Enjay »

Thank you very much. Aside from a minor syntax error (ParamIsNull: - TNT1 sprite not properly declared), that did exactly what I wanted. :thumb:
User avatar
randi
Site Admin
Posts: 7749
Joined: Wed Jul 09, 2003 10:30 pm

Re: Can a replacement spark actor be made?

Post by randi »

Random only returns integers. You might want to use frandom here instead for a better distribution.
User avatar
Enjay
 
 
Posts: 26573
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland

Re: Can a replacement spark actor be made?

Post by Enjay »

Thank you. That looks much better. :)
User avatar
Tormentor667
Posts: 13549
Joined: Wed Jul 16, 2003 3:52 am

Re: Can a replacement spark actor be made?

Post by Tormentor667 »

What does frandom do?
Gez
 
 
Posts: 17934
Joined: Fri Jul 06, 2007 3:22 pm

Re: Can a replacement spark actor be made?

Post by Gez »

Same as random, but for floating point values. Random(1, 3) gives you 1, 2 or 3; frandom(1, 3) might give you 1.147.
User avatar
Enjay
 
 
Posts: 26573
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland

Re: Can a replacement spark actor be made?

Post by Enjay »

And with this particular actor, if I gave it a high spark count and activated it in quick succession you could definitely see regular patterns in the positions of the sparks. Using frandom removed that.
User avatar
Enjay
 
 
Posts: 26573
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland

Re: Can a replacement spark actor be made?

Post by Enjay »

I may as well share what I have so far:

http://files.drdteam.org/index.php/file ... uspark.zip

AFAIK, the original built-in actor is slightly directional, so I made my replacement respect that and produce the spark shower slightly forward. I didn't make it too directional though to avoid it causing problems when replacing sparks on maps where the author hasn't particularly set the directions of the sparks. After messing around with it, I generally find it easier to place in maps and (IMNSHO) it looks better than the original.

Getting carried away, I also made one that sparks upwards and one with a more obvious front-aimed spray. Obviously, there are many other combinations possible (eg a totally non-directional set).

If you load the zip, the sparks on the ceiling are direct replacements for the built-in ones. The one nearest the P1 start has the default number of sparks. The one further away has the arg set to 64. The one coming out of the TEKGREN wall has its arg set to 64. On the consoles, the left one has the arg set to 24 and the one on the right is set to 64.

Try loading another map with spark actors after the zip to see if it works in other maps. The spark actors in your map should be replaced with the new ones which have worked acceptably well in every map that I have tried.

It is still a WiP, however, so the DECORATE is a little untidy. I'm not sure that I'm happy with all the flags and I'm not sure that the durations are quick enough to cope with rapidly repeating scripts, for example.
Last edited by Enjay on Tue Jan 05, 2010 8:43 pm, edited 2 times in total.
User avatar
David Ferstat
Posts: 1113
Joined: Wed Jul 16, 2003 8:53 am
Location: Perth, Western Australia

Re: Can a replacement spark actor be made?

Post by David Ferstat »

Enjay, could you please re-upload this? I've downloaded it twice, and got file I can't open. For reference, the file I've got is 12,104 bytes.
User avatar
Project Shadowcat
Posts: 9369
Joined: Thu Jul 14, 2005 8:33 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support
Location: Blacksburg, SC USA

Re: Can a replacement spark actor be made?

Post by Project Shadowcat »

David Ferstat wrote:Enjay, could you please re-upload this? I've downloaded it twice, and got file I can't open. For reference, the file I've got is 12,104 bytes.
It needs to be closer to 100kb.
User avatar
Enjay
 
 
Posts: 26573
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland

Re: Can a replacement spark actor be made?

Post by Enjay »

Not sure what is going on there. I just downloaded it myself and I got it no problem.

The file is 103,737 bytes.

I just verified the checksum:

Code: Select all

3c733aa8ff6aedf7f755cbfa06a47de5
comparing my original and the newly downloaded version - they matched.

Return to “Editing (Archive)”