Announcement
Collapse
No announcement yet.
How do I code ammunition reloads into a vehicle?
Collapse
X
-
legacy-Slip777 repliedThanks wong! I couldn't get the batch export to work so I used UTPT, works like a charm.
-
legacy-EvilDrWong replieducc batchexport usually does it. if for some reason thats not adequate, UTPT should do the trick.
Leave a comment:
-
legacy-Slip777 repliedHeh, mind me asking but how do you decompile source code and get all the default properties ect? Dont take this as a noob question I just never learned how to do that lol.
Leave a comment:
-
Dicky B repliedOriginally posted by SquirrelZero
Frag.Ops has reloadable vehicle weapons. Decompile our source and look at War_FOVehicleWeapon.uc.
Dicky B (I was going to use the enhanced playershadow code in a mod I'm doing, but it is way unnecessary for what it is.. Code is still in there, not active, just in case)
Leave a comment:
-
legacy-SquirrelZero repliedFrag.Ops has reloadable vehicle weapons. Decompile our source and look at War_FOVehicleWeapon.uc.
Leave a comment:
-
legacy-Slip777 repliedI remember someone posting some code on how to do this. Not sure if reloadable vehicles works the same for weapons. So try this:
Code:class SomeReloadableStuff extends WhatYourTurret extends var int ammoammount; state ProjectileFireMode { function Fire(Controller C) { if (ammoammount >= 4) //So you cant fire after shooting 4 projectiles and must reload. GoToState( 'Reloading' ); SpawnProjectile(ProjectileClass, False); ammoammount += 1; } } state Reloading { Begin: Sleep( 3.0 ); ammoammount = 0; GoToState( 'ProjectileFireMode' ); } defaultproperties { ammoammount = 0 //So you start wit full ammo. }
Leave a comment:
-
legacy-CMan repliedWell, it sounds like you almost answered your own question. Just make the variables you need, then under the the fire functions, just add some if else statements and you should have it...
Leave a comment:
-
legacy-WickedPenguin started a topic How do I code ammunition reloads into a vehicle?How do I code ammunition reloads into a vehicle?
I'm working on a couple vehicles for some TC mods, and I'd like to be able to have the weapons on these vehicles stop firing after a set number of rounds, then simulate a reload.
Basically, it would:
1) Count how many seconds the weapon has been fired (a variable called "firetime"). Basically, each time the player presses Fire, a timer runs until Fire is released.
2) Once "firetime" is greater than a set amount ("ammolimit") the weapon stops firing and a "weaponactive" var is set to false.
3) A new timer runs for a certain amount of seconds ("reloadtime"). I trigger a sound and maybe an animation.
4) Once the timer reaches "reloadtime", "firetime" is reset to 0, "weaponactive" is set to true, and the weapon resumes firing.
I haven't coded anything relatively complex in a long time, so I really need some help with this.Tags: None
Leave a comment: