• Deathrun gun spawner
    10 replies, posted
I want it so that at the end of deathrun maps there is a weapon spawner that will give anyone who walks into its area a weapon with some reserve ammo. Not really sure how I would go about doing this.
Here's a good [URL="http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/indexf251.html"]tutorial[/URL] on creating a basic entity. You'll also need to use the [URL="http://wiki.garrysmod.com/page/Player/Give"]Player:Give()[/URL] method, in conjunction with the [URL="http://wiki.garrysmod.com/page/Player/GiveAmmo"]Player:GiveAmmo()[/URL] method. In the tutorial mentioned at the beginning, you'll need to place the two functions I gave you in the ENT:Use() hook, as the player who used the entity is passed. You'll also need to know the [URL="http://wiki.garrysmod.com/page/ents/Create"]ents.Create()[/URL] function in order to spawn your custom entity.
Alright and how about saving the location to each map?
Just get a CS:S weapon pack, most deathrun have CS:S weapons lying around at the end of the map.
You can make a table with a spawn position for each map. So for instance [code]local spawns = {}; spawns['thismap'] = Vector(x, y, z)[/code] You then would need to modify the myentity:SetPos(Vector(x, y, z)) to something like myentity:SetPos(spawns[game.GetMap()]) however you would need to use the file library if you wanted a comprehensive saving system with chat commands etc although you're still learning I recommend the method mentioned above.
[QUOTE=crazyscouter;45394374]You can make a table with a spawn position for each map. So for instance [code]local spawns = {}; spawns['thismap'] = Vector(x, y, z)[/code] You then would need to modify the myentity:SetPos(Vector(x, y, z)) to something like myentity:SetPos(spawns[game.GetMap()]) however you would need to use the file library if you wanted a comprehensive saving system with chat commands etc although you're still learning I recommend the method mentioned above.[/QUOTE] If he's still learning, I recommend it, it actually is not hard at all.
[QUOTE=crazyscouter;45394333]Here's a good [URL="http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/indexf251.html"]tutorial[/URL] on creating a basic entity. You'll also need to use the [URL="http://wiki.garrysmod.com/page/Player/Give"]Player:Give()[/URL] method, in conjunction with the [URL="http://wiki.garrysmod.com/page/Player/GiveAmmo"]Player:GiveAmmo()[/URL] method. In the tutorial mentioned at the beginning, you'll need to place the two functions I gave you in the ENT:Use() hook, as the player who used the entity is passed. You'll also need to know the [URL="http://wiki.garrysmod.com/page/ents/Create"]ents.Create()[/URL] function in order to spawn your custom entity.[/QUOTE] The tutorial is outdated and by default doesn't work. Is there anything better?
[QUOTE=Declivity;45394554]The tutorial is outdated and by default doesn't work. Is there anything better?[/QUOTE] What? That's pretty much all you need, and it isn't out dated. The init and shared of that tutorial is pretty much the base of any entity, if you need more tutorials, just look through some DarkRP entities or something.
Well I only say that because I implemented it as is and self:DrawEntityOutline( 1.0 ) spams errors.
Then remove it, it's not really necessary.
It's coming a along pretty well, I have it how I want it every way except visually. Right now its just an smg that rotates. I would like if it had a light shining on it from the ground up or something like that.
Sorry, you need to Log In to post a reply to this thread.