Mero Vilul Posted June 5, 2002 Share Posted June 5, 2002 Yes, I ask a lot of things Anyhow, I'm experienced in programming, but not C++ that much... My question is: I have made some changes to the E11 blaster (more damage, slower firing), but I want the secondary fire to work like this: When you fire with secondary it will fire 3 blaster shoots in a fast tempo, then it will not be fireable in 1 second, then you can fire it again. I've looked around... But I suck... I would gladly appreciate someone giving me some hints on where to look, and maybe tell me if it's to hard to make... or maybe give me a complete code for it Take Care Link to comment Share on other sites More sharing options...
NyghtWalker Posted June 5, 2002 Share Posted June 5, 2002 take a look at the disruptor's alt-fire code, where it is chargable...may or may not help but worth a shot. Link to comment Share on other sites More sharing options...
furrycat Posted June 5, 2002 Share Posted June 5, 2002 I haven't had a chance to look at this problem at all yet. It seems quite simple though. The current time is stored in "level.time" as a number of milliseconds. If you want to check that five seconds has past since some event, for example, you can check that: level.time > x + 5000 All you'd need to do is choose a variable x to hold the time the player last fired. More precisely, choose the best location to store it: player entityState seems a good choice. Such a variable may even already exist. Then you need to make sure that it's set every time the player fires and perform the above check before enabling the player to fire. I think you already know how to do that :-) Oh by the way, don't fret the C++ thing. The code is all C. Link to comment Share on other sites More sharing options...
Mero Vilul Posted June 5, 2002 Author Share Posted June 5, 2002 Well C++ or C or whatever that begins with a C... I don't know the difference I know how to do that in other laungages, but could be problems in "C", but I try my best when I get home... Can't be that tough!! Link to comment Share on other sites More sharing options...
SirBob1701 Posted June 5, 2002 Share Posted June 5, 2002 C+, and C++ are just updated versions of C Link to comment Share on other sites More sharing options...
Tchouky Posted June 5, 2002 Share Posted June 5, 2002 Originally posted by SirBob1701 C+, and C++ are just updated versions of C what do you mean by 'updated' ???? because c and c++ are very different ! c++ is object oriented . the structures and class are not the same at all ... etc ... Link to comment Share on other sites More sharing options...
furrycat Posted June 5, 2002 Share Posted June 5, 2002 A tank is just an updated car. Link to comment Share on other sites More sharing options...
normal Posted June 5, 2002 Share Posted June 5, 2002 No, a tank is a war machine, a car is a transportation unit. Two very different things. Link to comment Share on other sites More sharing options...
Iceplode Posted June 5, 2002 Share Posted June 5, 2002 O_o .. you guys are silly. And let's PLEASE not get into a C versus C++ argument here. (Nor a C# versus C++) Link to comment Share on other sites More sharing options...
ErionD Posted June 5, 2002 Share Posted June 5, 2002 They are just saying that they are 2 pretty different things (which they are right in saying). And there is no C+. Only C, C++ and C#. Link to comment Share on other sites More sharing options...
Mero Vilul Posted June 5, 2002 Author Share Posted June 5, 2002 Hey, don't ruin my topic! *slaps everyone who argues out of topic* btw, I'm sitting here thinking on how to make the E-11 blaster secondary fire shoot 3 shoots at like 200ms apart (it will always fire 3 shoots, even if you just tap the button fast), then how to make it being unable to fire for 1 second (almost got that part made, thanks to the posters above), and then it can be fired again. Help please? Link to comment Share on other sites More sharing options...
furrycat Posted June 6, 2002 Share Posted June 6, 2002 normal has been mindtricked by Darth Subtlety. Link to comment Share on other sites More sharing options...
Subject452 Posted June 6, 2002 Share Posted June 6, 2002 Does this really need any coding at all? i think what u want i possible just by editing the weapons.dat file. Link to comment Share on other sites More sharing options...
Mero Vilul Posted June 6, 2002 Author Share Posted June 6, 2002 The thing I'm doing is a burst mode, I can set the rate of fire to 200ms, but this is how it should work: When I press secondary fire, it will fire 3 quick bolts, then the weapon has a "charge up time" of 1 second, meaning I can't fire until 1 second has passed since firing the 3 burst. There will always shoot 3 bolts with secondary, even if you just quickly tap the button. If you keep the button pressed, it will fire again as soon as the 1 second pasted by. That is not what I know of something that can be done by editing some values, but I'm a newbie laming C tryouter ... Link to comment Share on other sites More sharing options...
Wiebbe Posted June 7, 2002 Share Posted June 7, 2002 now iam a n00b when it comes to coding in JK II, i just started with C, but why dont you try this, in the alt fire code, at the end let is save the time at that moment (when it has fired the three "bullets") in variable : eblastertimelastfire or something shorter (like to use variable that have explaining names)(so that would be eblastertimelastfire = level.time) then in the beginning of the fire anim use what has been said above by furrycat, and do a if statement, If (eblastertimelastfire = leveltime + 1000) and it fires again, else it just stops or something, dont know exactly is C can work that way though. (one question pops up, will eblastertimelastfire be saved when the code is run through? or will it be reset again, wich it has to, otherwise the first time you shoot you might have to wait 1 sec) But, this should be some of the basics i guess.. Link to comment Share on other sites More sharing options...
furrycat Posted June 8, 2002 Share Posted June 8, 2002 You must initialise variables in C. When you declare a variable, the program grabs a section of memory to hold it. If you don't give the variable a value explicitly, it will have the value of whatever is at that area of memory. This could be anything. Thus you need to give it a value. Making it level.time - 1000 ensures you can fire as soon as you spawn. G_ClientSpawn() is a good place to set it. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.