• Help making an autorun (radiation mod)
    10 replies, posted
Ok, so as in the title, I'm making a radiation mod for garrysmod. As in, it simulates the effects of radiation, i.e long term damage, as well as the different types. I know this is a very vague question, but where do I start? I'm not new to lua. I've scripted quite a few interesting sweps. Unfortunately I have absolutely no experience of programmning autoruns. So... Where to start?
Well we need a tad more info before we can give any substantial help. First you'll have to (obviously) create your script, you can put it in garrysmod/garrysmod/lua/autorun during dev, then turn it into addon format for release. Then you need to decide the effects of the addon. Say you want to lose 1HP whenever you're in radius of a certain entity, you would look up a few things like: Timers Ply:SetHealth() ent:Distance() Get the position of the radioactive entity with GetPos(), find the distance between the entity and the player, and if the distance is less than whatever range you want it to be, start a timer that subtracts 1 HP from the player, and then build from there. But once again, in order to give more specific help we really need more information.
Ok. As I said, vague question :P yes. Basically what I need is an autorun script that sets up certain parameters for radioactive objects, e.g half-life, isotope, emitter type (I.e alpha, beta etc) for certain objects. Probably sents. I also need certain parameters for players: I.e how much radiation they have taken in. It also needs to perform some arithmetic on these stats, e.g body radiation levels slowly go down, the amount of radiation given off goes down, etc. Is that more specific?
Sounds perfectly doable. Scripts you put in autorun will run on both client and server. Scripts in autorun/client will only run on the client and scripts in autorun/server will only run on the server. If you want to put a clientside file in your addon make sure you send it to them just as you make sure sweps send cl-init to people who join.
[QUOTE=MegaJohnny;19777953]Sounds perfectly doable. Scripts you put in autorun will run on both client and server. Scripts in autorun/client will only run on the client and scripts in autorun/server will only run on the server. If you want to put a clientside file in your addon make sure you send it to them just as you make sure sweps send cl-init to people who join.[/QUOTE] Thanks for the advice. Unfortunately, it doesn't quite answer my question. I was hoping you would give me an idea on how to set up the aforementioned parameters. See the above post for the full thing. Thanks.
If you want to add a field to a player, just do ply.CurrentRadiation = 5 or something, where ply is some player.
Are you trying to make a radioactive entity (ie: chunk of plutonium) that can be placed somewhere? Then where the player gets within a certain radius of it, the effects take place? Because thats not an autorun script, its a scripted entity. I can't help you with that but if thats what you want then you should say so.
To make an autorun script you drop it in the autorun folder. That's about it. Anything in that script will be run when the game starts.
[QUOTE=ryan1271;19800838]Are you trying to make a radioactive entity (ie: chunk of plutonium) that can be placed somewhere? Then where the player gets within a certain radius of it, the effects take place? Because thats not an autorun script, its a scripted entity. I can't help you with that but if thats what you want then you should say so.[/QUOTE] No, you're not quite right. This will include dents, but the emphasis is on PARAMETERS of the player. That is, how much radiation he's absorbed. And so on and so forth. Basically... How do I sat up global variables for a player that I can use? And how, if it were multiplayer, save them on the server?
This isn't going to be made as an autorun, you're going to need to make an entity.
No... Please, can you read my posts? I'm sorry for sounding a bit pissed off but I thought I made it clear: how do you set up variables for a player that can be saved on the server in an autorun?
Sorry, you need to Log In to post a reply to this thread.