Day of Defeat Plugins Community
This site is an archive — everything is readable and downloadable, nothing can be posted. Admin

Garand Reloading

by gunsofnavarone · 2009-01-21 · 22 replies · 10812 views · 32 downloads

Read the thread (23 posts)

From the first post

Does anybody know if this already exists? A "fix" to permit the reloading of the garand when the player needs to reload rather than expelling (firing-off) their rounds to get a new, full clip?
rn
rnIf not, is this in the realm of possibility of fixing through a plugin (can/will anybody take this on)?

Added later in the thread

dod_midclip_reload.sma Plugin Source 3 KB 8 dl Download Compile
garand_clipeject.wav Sound 14 KB 7 dl Download
dod_midclip_reload.sma Plugin Source 4 KB 8 dl Download Compile
dod_midclip_reload.sma Plugin Source 4 KB 9 dl Download Compile

The thread

All 23 posts from 5 people on Garand Reloading, kept as they were written.

G gunsofnavarone
started this thread
Posts: 159
Threads: 28
Joined: Sep 2008
01-21-2009, 10:26 AM #1

Does anybody know if this already exists? A "fix" to permit the reloading of the garand when the player needs to reload rather than expelling (firing-off) their rounds to get a new, full clip?rnrnIf not, is this in the realm of possibility of fixing through a plugin (can/will anybody take this on)?

M Myers [93rd ID]
posted here
Posts: 11
Threads: 2
Joined: Apr 2007
01-21-2009, 05:09 PM #2

This is not possible, atleast to my knowledge. The game creators stuck to real life characteristics of the M1 Garand. The rifle CANNOT be topped off because of the way it was built. Instead, when it fires the last round the magazine ejects from the gun and hits the ground*hints the PING sound when you shoot the last shot*. So in order to reload you just put in the magazine that you have on you. Normally it would be about 5-6 maybe more. Thats the reason for the backpacks in WWI and WWII. So I am not sure personally if there is away around strict coding or anything. So there is a no-go on this.

diamond-optic
posted here
Posts: 2,068
Threads: 103
Joined: May 2005
01-21-2009, 07:04 PM #3

well technically you could probably force the reload animation to play and change the clip ammo

G gunsofnavarone
started this thread
Posts: 159
Threads: 28
Joined: Sep 2008
01-21-2009, 07:58 PM #4

I thought that this was an error of a sort, especially after seeing this clip:rnrnhttp://www.youtube.com/watch?v=wrXLtkY4wOw

Dr.G
posted here
Posts: 776
Threads: 75
Joined: Nov 2007
01-21-2009, 09:11 PM #5

D-O cant u "just" do the opposite of how u blocked IN_ATTACK2 in the nodeploy plugin... 1st thought may be stupid lol

Tank
posted here
Posts: 581
Threads: 59
Joined: Jan 2007
01-21-2009, 11:20 PM #6

This is from a post too lazy to retrieve, it's written by Wilson, this is how you set a clip, the examples are from a plugin I wrote.nn

public  set_clip(id,const weapon[],clip) n{n	new currentent = -1, gunid = 0n	// get originn	new Float:origin[3];n	entity_get_vector(id,EV_VEC_origin,origin);n	n	while((currentent = find_ent_in_sphere(currentent,origin,Float:1.0)) != 0)n	{n		new classname[32];n		entity_get_string(currentent,EV_SZ_classname,classname,31);n	n		if(equal(classname,weapon))n			gunid = currententn	}n	n	set_pdata_int(gunid,108,clip,4); // set their ammo (4 is linux update setting)n	return PLUGIN_CONTINUEn}
nn
strip_user_weapons(id)n			give_item(id,"weapon_garand")n			dod_set_user_ammo (id,5,0) // sets backpack to 0n			set_clip(id,"weapon_garand",0) // This is the one you need, 0 is for 0 ammo in current clip, so change that to whatever amount the garand can hold.
nnHow to force a reload animation I have no clue

diamond-optic
posted here
Posts: 2,068
Threads: 103
Joined: May 2005
01-22-2009, 05:09 AM #7

yeah i threw something together a little while ago.. very basic, lets you reload mid clip..nni was gonna post it up in here but now i decided to try and make it a little better first.. trying to force the clip eject animation.. which i do sorta have working, needs some tweaking tho..nnand i want to get a sound for it with just the clip *ding* (sadly the one that comes with dod has the firing of the last round with the ding)nnim also wondering if i should have it so after you press reload, the old clip ejects out.. then :nnA)it automatically reloadsnor nB)it just leaves you with an empty gun and you have to press reload again to put another clip in..nnnim kinda liking the idea of B myselfnnnanyway ill probably post at least something tomorrow

G gunsofnavarone
started this thread
Posts: 159
Threads: 28
Joined: Sep 2008
01-22-2009, 09:05 AM #8

If you know which sound file it is, you can simply edit the audio file with a program like Audacity (freeware) to crop-out the last gun shot.

diamond-optic
posted here
Posts: 2,068
Threads: 103
Joined: May 2005
01-22-2009, 05:33 PM #9

that wont work cause the firing sound and the ding are basically at the same time.. so they are overlapping each other in the wav.. nnbut it wont be hard to find just the ding.. i'll probably just grab it from cod or something, it obviously wont sound the same as the default dod one, but it'll be good enoughnnright now tho im working on getting rid of the bullet shell that ejects when the clip ejects cause it shows the shell even when a shot isnt fired

diamond-optic
posted here
Posts: 2,068
Threads: 103
Joined: May 2005
01-22-2009, 06:38 PM #10

ok i wasted time.. tho it was simple to do.. but theres no point in blocking the shell eject, because if theres still ammo in the clip then a round is chambered, which would get spit out anywaynnlol, the shell eject blocking thingy worked good too :(nnalso having trouble just finding the ding without a round being fired with it.. working a couple and im not happy with the results im coming up with

G gunsofnavarone
started this thread
Posts: 159
Threads: 28
Joined: Sep 2008
01-22-2009, 07:54 PM #11

OK, I know I don't know a lot about guns, but isn't the "ding" unnecessary? I'm not trying to be rude, but did you watch the video in the link I gave above? When the guy reloads the rifle there, there isn't any "ding", just a standard clip falling sound. No ding like it normally would if the clip was expelled in the manner that we're used to.

diamond-optic
posted here
Posts: 2,068
Threads: 103
Joined: May 2005
01-22-2009, 08:14 PM #12

yeah i did notice that.. but i watched some other videos and stuff around the internet and most of them did have the ping..nni guess it would be easier for me to just leave it out tho lol

Tank
posted here
Posts: 581
Threads: 59
Joined: Jan 2007
01-22-2009, 08:49 PM #13

Reloading a garand in the middle of the clip isn't anything realistic, so why waste your precious time on making it realistic. I understand that whatever you post needs to be smooth as a baby bottum, but perhaps a slight lack of realism wouldn't hurt anyone.

diamond-optic
posted here
Posts: 2,068
Threads: 103
Joined: May 2005
01-22-2009, 09:01 PM #14

alright you can give this a try.. let me know how it works for you...nnnnattached is the sma file and the sound filennsound goes in: ../dod/sound/weapons/nncvars:nn

  • n
  • dod_midclip_reload "1" //Enables or Disables the pluginn
  • dod_midclip_reload_saveammo "1" //Ammo remaining in the clip is added back to your backpack (total) ammon

G gunsofnavarone
started this thread
Posts: 159
Threads: 28
Joined: Sep 2008
01-23-2009, 10:12 AM #15

I've tried the plugin, and it only partially works. Here's what happens:rnrnI fired a few rounds off with the weapon, and pressed reload. It did in fact go through the animation of reloading, but the clip indicator initially showed an empty clip when it was changing the clip, but after change only showed the original partial clip.rnrnAfter firing off the remaining rounds in that clip, it neither put in a full clip automatically, nor did it permit a reload using the reload key.rnrnNow, I don't recall what the "default" reload key is for DoD, so I don't know if this is the problem or not. I have changed many default key settings to where they made the most sense to me, so my reload key is set for "r", if this makes any difference or not to your coding.

diamond-optic
posted here
Posts: 2,068
Threads: 103
Joined: May 2005
01-23-2009, 01:34 PM #16

hmm i only really tested it on a local and it worked fine...nnjust tried it out on my dedicated server and it is acting kinda wierd (plays some animations when it shouldnt, and i somehow managed to go thru 30+ clips in 2 reloads) so when i get home from work today ill mess with it some more

diamond-optic
posted here
Posts: 2,068
Threads: 103
Joined: May 2005
01-23-2009, 07:08 PM #17

alright i think i fixed the animation problems...nnas for the ammo problems, it seems to work fine if you set the saveammo cvar to 0, with it set to one & using a debug print_chat msg its showing me that i have 0 ammo when it does the dod_get_user_ammo(id,DODW_GARAND)nnno idea why, it works fine on a win32 local but returns 0 on a linux ded.. so ill keep messing with this and post it again once i come up with somethingnnim guessing it might have something to do with the problem stated in this thread: https://www.dodplugins.net/forums/showthread.php?t=1226&highlight=dod_get_user_ammonnn*edit*nnok instead of using the dodfun module to get the users ammo, since it seems buggy on linux.. i figured out which pdata offset stores backpack ammo for the garand so Im gonna give it a shot using that to read the ammo instead.. and since i dont like forcing a mapchange on my ded server, Ill just have to wait till it changes maps on its own

diamond-optic
posted here
Posts: 2,068
Threads: 103
Joined: May 2005
01-24-2009, 01:00 AM #18

ok this version seems to work.. linux and win32 ended up using different pdata offsets for the ammo...nnnone last thing i might try and fix is after you eject the clip.. when you goto reload, the eject animation plays for a split second.. it does not play if you switch to a diff gun and then switch back to the garand before putting a new clip in. So ive got a couple ideas of what i can do about that.. so we'll seennin either case, this version does work lol.. tested on linux this time :-D

diamond-optic
posted here
Posts: 2,068
Threads: 103
Joined: May 2005
01-24-2009, 10:38 PM #19

ok i think the animation thing is fixed on this version.. and as of right now, i cant really think of any other problems with it

G gunsofnavarone
started this thread
Posts: 159
Threads: 28
Joined: Sep 2008
01-27-2009, 09:51 PM #20

My apologies for the delay. I finally was able to get back to this this evening. It works great! You do an awesome job my friend!!rnrnMay I say, that the DoD community is gonna love this!rnrnAgain, you did an awesome job. Thank you again!

G gunsofnavarone
started this thread
Posts: 159
Threads: 28
Joined: Sep 2008
02-01-2009, 10:03 AM #21

I don't know if anyone else has had this problem or not, but I noticed this yesterday.rnrnI was playing on axis side with just bots on the server other than myself, and periodically I would hear the sound of the garand reloading. Since I was on axis side, and allies spawn was on the opposite side of the map, I know it couldn't have been from the axis bots.rnrnI am not entirely sure if it's the plugin, or something else on the server that was causing this. I had some other "weird" stuff going on yesterday (bots were randomly spawning in the sky, dropping, and dying). I shut my server down for awhile to see if this would clear out the cache and restarted, and was still having some of the same issues.rnrnMaybe the 2 problems are unrelated, I don't know. So, I figured I'd mention it so the code could be looked at a tad more closely in case it is the plugin.

diamond-optic
posted here
Posts: 2,068
Threads: 103
Joined: May 2005
02-01-2009, 01:19 PM #22

well the sound is emitted from the weapon entity itself so more then likely there would have to at least be a garand within hearing distance.. but the halflife sound engine isnt exactly top of the line lol and i notice various sound glitches every now and then so its very possible that its just some wierdness going on here and there..nnbut i do recall hearing it a few times while playing with only bots, so idk.. maybe the bots try to reload sometimes but normally they cant reload the garand without it being empty cause the game doesnt let them (just like it doesnt let real players either) but with this plugin they are able to... idknnwhen i get a chance ill throw in some debug messages and see if i can track down where its coming from

diamond-optic
posted here
Posts: 2,068
Threads: 103
Joined: May 2005
07-25-2011, 05:19 AM #23

wow lol.. i dont think i ever actually released that plugin

DoD Plugins Archive · Repository · Old Forum Threads · Maps · Admin · built 14 Sep 2026 00:34 UTC