Can a replacement spark actor be made?
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.
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.
-
-
- Posts: 26573
- Joined: Tue Jul 15, 2003 4:58 pm
- Location: Scotland
Can a replacement spark actor be made?
[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.
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?
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.
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.
-
-
- Posts: 17934
- Joined: Fri Jul 06, 2007 3:22 pm
Re: Can a replacement spark actor be made?
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
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
-
- Posts: 678
- Joined: Mon Jan 16, 2006 8:53 pm
- Location: Rio de Janeiro - Brazil
Re: Can a replacement spark actor be made?
Check the LOS's Spark!
-
-
- Posts: 26573
- Joined: Tue Jul 15, 2003 4:58 pm
- Location: Scotland
Re: Can a replacement spark actor be made?
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:
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".
-
-
- Posts: 17934
- Joined: Fri Jul 06, 2007 3:22 pm
Re: Can a replacement spark actor be made?
Seems trivial enough to address: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.
Spoiler:
-
-
- Posts: 26573
- Joined: Tue Jul 15, 2003 4:58 pm
- Location: Scotland
Re: Can a replacement spark actor be made?
Thank you very much. Aside from a minor syntax error (ParamIsNull: - TNT1 sprite not properly declared), that did exactly what I wanted.
-
- Site Admin
- Posts: 7749
- Joined: Wed Jul 09, 2003 10:30 pm
Re: Can a replacement spark actor be made?
Random only returns integers. You might want to use frandom here instead for a better distribution.
-
-
- Posts: 26573
- Joined: Tue Jul 15, 2003 4:58 pm
- Location: Scotland
Re: Can a replacement spark actor be made?
Thank you. That looks much better.
-
- Posts: 13549
- Joined: Wed Jul 16, 2003 3:52 am
Re: Can a replacement spark actor be made?
What does frandom do?
-
-
- Posts: 17934
- Joined: Fri Jul 06, 2007 3:22 pm
Re: Can a replacement spark actor be made?
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.
-
-
- Posts: 26573
- Joined: Tue Jul 15, 2003 4:58 pm
- Location: Scotland
Re: Can a replacement spark actor be made?
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.
-
-
- Posts: 26573
- Joined: Tue Jul 15, 2003 4:58 pm
- Location: Scotland
Re: Can a replacement spark actor be made?
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.
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.
-
- Posts: 1113
- Joined: Wed Jul 16, 2003 8:53 am
- Location: Perth, Western Australia
Re: Can a replacement spark actor be made?
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.
-
- 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?
It needs to be closer to 100kb.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.
-
-
- Posts: 26573
- Joined: Tue Jul 15, 2003 4:58 pm
- Location: Scotland
Re: Can a replacement spark actor be made?
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:
comparing my original and the newly downloaded version - they matched.
The file is 103,737 bytes.
I just verified the checksum:
Code: Select all
3c733aa8ff6aedf7f755cbfa06a47de5