News UnrealEd Files Mods FragBU Liandri Archives
BeyondUnreal Forums

Go Back   BeyondUnreal Forums > Unreal Development > Coding

Reply
 
Thread Tools Display Modes
Old 16th Nov 2001, 01:12 PM   #1
Sg_Jack
Registered User
 
Join Date: Nov. 12th, 2001
Posts: 12
probelms with stopfire... (weapons)

Hi !

sorry, it's me again I found this forum which i didn't knew, so i benefit a little to have you here Excuse me again !

Well, i have realistic weapons, and as you may know, sidearms don't fire like a machinegun ! If you take a HK mark23 (my favorite weapon) and if you hit the trigger, the weapon will fire just one bullet and will stop (in semi-auto mode).

I have made a function call "stopfire" in order to stop the autofire. It works perfectly but there is a problem : if you clik very fast, the weapon will fire at every click... So, you can fire as fast as a machingun if you are fast !

I tried to add a sleep in my stop function, but it don't works... Is anybody know what could be the problem ? I don't understand why this xxxx sleep function don't work...
Sg_Jack is offline   Reply With Quote
Old 16th Nov 2001, 01:30 PM   #2
Captain Kewl
I know kewl.
 
Captain Kewl's Avatar
 
Join Date: Feb. 13th, 2001
Location: IN YOUR HOUSE
Posts: 794
I'm assuming your firing rate is once per firing animation here...

Actors have an IsAnimating(); function that returns true if they are in the middle of an animation sequence. There's also AnimSequence which returns a string of the name of the animation currently playing. Maybe use something like this?

if ( !IsAnimating() || AnimSequence != 'Fire' )
{
DoFireStuff();
}
Captain Kewl is offline   Reply With Quote
Old 16th Nov 2001, 02:37 PM   #3
Euphoric Beaver
impeccably groomed
 
Euphoric Beaver's Avatar
 
Join Date: Apr. 19th, 2001
Location: Great Britain
Posts: 3,158
I may of misread it and you proberly know this but you can't do latent functions like sleep inside functions. They only work in states.
Euphoric Beaver is offline   Reply With Quote
Old 16th Nov 2001, 02:50 PM   #4
mr.s-d
CHiMERiC Moderator
 
Join Date: Aug. 30th, 2001
Location: UK
Posts: 65
Something like this should work:

state NormalFire
{
ignores Fire, AltFire, AnimEnd;

Begin:
FinishAnim();
// If the player is still trying to fire...
while (Pawn(Owner).bFire != 0);
{
Sleep(0.05);
if (bChangeWeapon)
GotoState('DownWeapon');
}
Finish();
}

Should work (haven't tested it) as it's a condensed form of some code I made to do the same job, only it used two states and I can't remember why.
mr.s-d is offline   Reply With Quote
Old 17th Nov 2001, 03:31 AM   #5
Sg_Jack
Registered User
 
Join Date: Nov. 12th, 2001
Posts: 12
Thanks, it works very well

Oh yes, i know that sleep only works with states... My stopfire() function refers to a state where i used sleep.. Bu it didn't work.

well, thanks again
Sg_Jack is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 09:32 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.

Copyright ©1998 - 2012, BeyondUnreal, Inc.
Privacy Policy | Terms of Use
Bandwidth provided by AtomicGamer