• Advanced Prop Spawner - Spawn Entities and Contraptions!
    130 replies, posted
[b]========= Advanced Prop Spawner v1.0 ========= [/b] [release][img]http://ii.fobby.net/misc/adv_spawner_banner.jpg[/img] [tab]Version:[/tab] [b]1.0[/b] [tab]Download:[/tab][url=http://www.garrysmod.org/downloads/?a=view&id=72452][img]http://www.garrysmod.org/img/?t=dll&id=72452[/img][/url][/release] It's always bugged me that there was no way to create easy-to-use spawners for simple contraptions -- the prop spawner can only spawn one thing at a time, and the advanced duplicator paster doesn't give you much control or visual feedback. What's worse, the advanced dupe paster cannot itself be duplicated! So, I spent the last week or two working on a solution: The Advanced Prop Spawner. The Advanced Prop Spawner can spawn any duplicable entity - not just prop_physics. Additionally, if multiple advanced spawners are connected by constraints, spawning any one of them will automatically spawn all the others, duplicating the constraints between them, resulting in a spawner for an entire contraption! This works best for simple contraptions, like spawning missiles with attached thrusters (or even an attached Wire guidance system), but it'll work for much more complex contraptions as well. [release][b]=== Features ===[/b] [list] [*] Can spawn any duplicable entity [*] Connected spawners duplicate constraints, allowing contraptions to be spawned [*] Can use spawner's material for spawned entities [*] Can transmit spawner's velocity to spawned entities [*] Advanced spawners can be duplicated with the Advanced Duplicator [*] Has wire inputs for Wiremod [/list][/release] [release][b]=== How To Use ===[/b] [list] [*] Left-click on an entity to turn it into an advanced spawner. [*] Right-click on an entity to turn it and all connected entities into spawners. Right-clicking allows you to easily turn an entire contraption into a "contraption spawner."[/list][/release] [release][b]=== Cautions! ===[/b] Because any one spawner will automatically spawn every other spawner in a network, only one spawner in any network should be spawned at one time. (Otherwise you'll get multiple copies of the contraption spawning right on top of each other, which might get messy.) This means that only one of the spawners should have a "Spawn Key" set. The easy way to make sure that only one spawner in a contraption spawner has a Spawn Key assigned is to just right-click one of them using the advanced spawner STOOL. This will automatically update the entire network, ensuring that only the right-clicked one has a Spawn Key.[/release] [release][b]=== Known Limitations ===[/b] - Currently, wired physics constraints (Wire Winch, Wire Hydraulic, etc.) can't be spawned. This should be fixed in a future release.[/release] This is still sort of at the "beta" stage -- I've tested it on quite a few things, but I've mainly been focusing on the code writing part, and the code testing part has been less than comprehensive. :smile: Please post any bugs or problems you encounter, preferably with detailed steps to reproduce. Also, if you have any suggestions or feature requests, let me know!
good work :dance:
This could be nice, but remember to add a limit to the number you can spawn within a certain timeframe. This could be an easy way to crash a server if you don't :/
[QUOTE=Retirsch;15948742]This could be nice, but remember to add a limit to the number you can spawn within a certain timeframe. This could be an easy way to crash a server if you don't :/[/QUOTE] Currently it's just using the same sort of limits as in the original Wired Prop Spawner -- so I believe by default it limits you to ten advanced spawners, and it clamps the delay to a minimum of 0.33 seconds. You're right, though, I should probably add an extra limit on the amount of time between spawns, since it's possible for those ten spawners to have a lot of constraints between them.
Just make a "time between spawn" slider, problem solved (that way people can choose if they wanna wait or not between spawning 2 of 'em)
What have you done... It's a spammer's dream.
don't mean to spoil your thread, but why don't you use Advanced Duplicator's paster? it can be used with anything advdupable and you can also spawn it with a dupe from disk without first spawning it.
[QUOTE=TomyLobo;15951781]don't mean to spoil your thread, but why don't you use Advanced Duplicator's paster? it can be used with anything advdupable and you can also spawn it with a dupe from disk without first spawning it.[/QUOTE] I'm glad you asked. :smile: The advanced dupe paster is completely inadequate for a whole host of reasons which I will explain here (and one of which I mentioned in my first post): [list] [*] The advanced dupe paster gives you no visual feedback, very little control over exactly where your contraption spawns, and absolutely no control over the orientation it spawns in. With the Advanced Prop Spawner, you can rotate your contraption to whatever orientation you wish. [*] The paster has something like a three-second delay between spawns. While this is fine for servers where you wouldn't want people to be able to spawn rapidly anyway, for any other purpose it's just frustrating. [*] The paster is limited to working with pre-grabbed advanced dupes, and they can't be changed without spawning them, altering them, re-duping, and then creating another paster. Way too much work if all you wanted to do was adjust the length of a rope, or tweak the position of a prop. You can freely alter, remove, add, or re-adjust the contents of an advanced prop spawner network without having to recreate it. [*] For some reason, even having a single advanced dupe paster on the map causes a tremendous drop in framerate. On gm_flatgrass2008, my framerate went from about 230fps down to 80fps after placing one paster. [*] This is a big one: the advanced duplicator paster [b]cannot be duplicated[/b]. As soon as you run it through the advanced duplicator it basically becomes an inert prop -- it ceases to function at all. On the other hand, entire networks of Advanced Prop Spawners can be duplicated and easily recreated, and everything works perfectly on the other end. [/list] [QUOTE=l337k1ll4;15951189]What have you done... It's a spammer's dream.[/QUOTE] Heh, don't worry; I'll add a server variable or sometihng to control the minimum allowed time between spawns. You could just set it to three seconds on your server and it would have no more destructive potential than the Advanced Duplicator Paster. (Not counting the inexplicable lag caused by the paster itself, of course. :wink:)
1. iirc it pastes wherever the ghost was when you placed the paster. you can control orientation by simply copying the object from a different angle. 3. how about editing a script in a chip? 4. oh, really? that might be a bug worth reporting. EDIT: try looking at it and doing: lua_run_cl local e=LocalPlayer():GetEyeTrace().Entity e:GetTable().Draw=e.BaseClass.Draw 5. you could basically wrap up a paster a few times otherwise. your approach probably makes that impossible right from the start, which is good
[QUOTE=TomyLobo;15953054]1. iirc it pastes wherever the ghost was when you placed the paster. you can control orientation by simply copying the object from a different angle.[/quote] Which, of course, makes it nearly impossible to have a contraption that contains a paster as one of its parts, since whenever your contraption moved, the props that the paster generated would have a different orientation relative to the contraption. The only way to do this with a paster would be to [i]very carefully[/i] redo the paster every single time your contraption moved, which is clearly no solution at all. For lots of fairly straightforward purposes, it's important for a spawner to be able to move with the rest of a contraption. [QUOTE]3. how about editing a script in a chip?[/quote] Good point. This can't be done even with my advanced prop spawners, [i]yet[/i]. :wink: Perhaps I should add a feature that allows a spawner to also duplicate any attached non-prop_physics entities, so you could just build wire circuits conveniently on the outside of a prop spawner, and have new copies of them made automatically for the spawned props. [quote]EDIT: try looking at it and doing: lua_run_cl local e=LocalPlayer():GetEyeTrace().Entity e:GetTable().Draw=e.BaseClass.Draw[/quote] That did the trick. I can't tell just with a quick glance at the paster's Draw function what it's doing that's so inefficient, but I do wonder why it doesn't just use Wire_DrawTracerBeam like the other wire entities do. [QUOTE]5. you could basically wrap up a paster a few times otherwise. your approach probably makes that impossible right from the start, which is good[/QUOTE] Nothing fundamentally wrong with a spawner generating another spawner, is there? (Don't hit me! :biggrin:) I actually briefly considered allowing spawners to be made from other spawners, but I pretty quickly realized that there wouldn't be much of a point, that it would almost certainly just end up confusing people, and that in any case the "clicking an existing spawner updates it instead of creating a new spawner" logic was a natural point to cut off the recursion.
GG is nice
Great job. Very useful.
"also duplicate any attached non-prop_physics entities" problem would be that these also do their job while being in a adv prop spawner net. "why it doesn't just use Wire_DrawTracerBeam" I can only guess that Advanced Duplicator is supposed to work on its own as well
-snip- Didn't read
[QUOTE=TomyLobo;15962071]"also duplicate any attached non-prop_physics entities" problem would be that these also do their job while being in a adv prop spawner net.[/quote] True, but the convenience of being able to update them on the fly might outweigh that. It would just be a control panel option anyway, so that behavior would only be enabled if you wanted it to be. [quote]"why it doesn't just use Wire_DrawTracerBeam" I can only guess that Advanced Duplicator is supposed to work on its own as well[/QUOTE] Ah, right. That would be an excellent reason; I should have remembered that. :doh:
That's great, now all we need is a way to give prop protection to a group of props so someone can only fuck with a base (a way to sell buildings on RP) :P Good job!
Aw man I knew I should've uploaded my Duplicator Spawner XD Good job though. Maybe I should upload my Class-String Prop Spawner :O
Awesome this is exactly what I wanted, now I have a way to resupply wire missile launchers etc without having to spawn them myself :smile: Does it have a wire input to spawn? [B]EDIT:[/B] Woot it does! All we need now is those wire constraints.
The velocity addition is perfect for what i want. I'm wiring a bomb release to a plane and this should help me calculate where it should land. Anyway, nice work.
[QUOTE=BoingBoing;15975539]Aw man I knew I should've uploaded my Duplicator Spawner XD[/QUOTE] That sounds interesting, actually. How does it work? Like an improved advanced dupe paster, or something else? It does sound like it has a somewhat different purpose than the advanced prop spawner, though; this one is, IMHO, mainly useful as a part of a larger contraption, not just to spawn complete contraptions itself. I'm thinking missile launchers that can reload themselves, factories that can spawn small assemblies, or even single parts like thrusters or wheels that cannot be spawned with the existing prop spawner. In fact it was when I was trying to make a truck-mounted rocket launcher (sort of like a Katyusha launcher), and getting somewhat frustrated at how much of a pain it was to reload, that I decided to go ahead and make this tool. :smile:
It's basically an editted version of the Duplicator tool, it was made when I was a horrible newbie at LUA and was combining crap. You click on the prop, it reads all the props that its constrainted to and then remove it and put an entity in place of it. In the middle will be a master control entity that, whenever the keypad that corresponds to it is pressed then pastes the dup there.
Hope it gets on WireSVN so I could spawn Realistc Tockets from my Jetplane :)
[QUOTE=Deidaraltu;15996739]Hope it gets on WireSVN so I could spawn Realistc Tockets from my Jetplane :)[/QUOTE] Well, the Wire team generally doesn't include third-party addons in the official repository; they like to keep the number of maintainers small. Of course, there is the [i]unofficial[/i] wire extras SVN, so if Anticept likes this tool it might wind up in there. But it's not like it needs to be in UWSVN in order for you to use it. :P
hey, my dream stool, i requested this from the request section and finally from my eyes to the image. glowing letters! thanks, now i can spawn missiles for my jet!!
Heh, I just noticed that you can also turn ragdolls into spawners with this tool: [IMG]http://img189.imageshack.us/img189/4662/ragdollspawner.jpg[/IMG] It will also create a spawner if you click a living NPC, but this is not a good idea: if you try to spawn an NPC with this tool, it will give you the dreaded "sorry, you can't spawn this NPC" error message, along with the helpful little button that you're not allowed to click, requiring you instead to kill the Garry's Mod process. I'll have to add a check to make sure it doesn't try to create a spawner from a living NPC in the next version. XD
This is what i was looking for :D ,nice work,now i can spawn multiple gokarts in one go.
Why doesn't this work for entities from the entitie's tab. Everytime I try and use it on one and it says "Can't create spawner for" and its name. Because you said it works for entities, but I guess not? edit* I also get this error when I right click on a entities from the entitie's tab. weapons\gmod_tool\stools/adv_spawner.lua:149: attempt to index local 'NewSpawner' (a boolean value)
Omg, this is exactly what i was looking for too :D
[QUOTE=-TB-;16069232]Why doesn't this work for entities from the entitie's tab. Everytime I try and use it on one and it says "Can't create spawner for" and its name. Because you said it works for entities, but I guess not?[/QUOTE] It only supports entities that properly register a duplication function. If the given entity doesn't have a registered duplication function, I can't duplicate it. :/ Those entities probably don't support the advanced duplicator properly either. (Actually, now that I check, some of those entities [i]can[/i] be duped with the advanced duplicator. However, a lot of them stop working properly after being duped; for example, Garry's Bombs can be duped, but any duped bombs will only produce the smoke and noise along with a bunch of script errors instead of actually doing any damage.) In the next version I'll do what I can to try to allow spawning of more entities, but in the end, it comes down to the person who wrote the SENT to make sure that it plays nice with the existing system by providing a duplication function.
Downloading this now, I have always needed something like this.
Sorry, you need to Log In to post a reply to this thread.