Help coding new weapon

  • Please make sure you are familiar with the forum rules. You can find them here: https://forums.tripwireinteractive.com/index.php?threads/forum-rules.2334636/
  • Weve updated the Tripwire Privacy Notice under our Policies to be clearer about our use of customer information to come in line with the EU General Data Protection Regulation (GDPR) rules that come into force today (25th May 2018). The following are highlights of our changes:


    We've incorporated the relevant concepts from the GDPR including joining the EU and Swiss Privacy Shield framework. We've added explanations for why and how Tripwire processes customer data and the types of data that we process, as well as information about your data protection rights.



    For more information about our privacy practices, please review the new Privacy Policy found here: https://tripwireinteractive.com/#/privacy-notice

Six_Ten

FNG / Fresh Meat
Mar 12, 2006
1,382
400
0
aztecmod.darkesthourgame.com
I'm making a musket by converting the Kar98.

What I want to happen is

player squeezes trigger:

0 seconds
weapon animation begins, flint strikes steel, there's a flash in the pan and smoke rises from pan

1 second later
bullet is fired, muzzle flash, muzzle smoke

How do I code the delay from the time the trigger is squeezed and the pan is ignited, to the bullet being fired and the muzzle flash and smoke?

So far what I have is:

0 seconds
weapon animation begins, flint strikes steel, there's a flash in the pan and smoke rises from pan, bullet is fired, muzzle flash, muzzle smoke all simultaneously.
 
Last edited:

PsYcH0_Ch!cKeN

Grizzled Veteran
Nov 27, 2005
1,677
200
63
37
Brisbane, Australia
www.ragequit.com
Use a timer, it's the safest and easiest way to do this, though there are other ways if you wanted to get complicated.

You need to split your function calls. Have the 0 second ones running where they are, but add an extra line:

SetTimer(1,false);

Then modify the Timer() function to call the remaining function calls for the 1 second mark.

Code:
simulated function Timer()
{
         // Call Bullet Code
    // Flash Code
    // Call Smoke Code
}

Be careful though - if Timer is already being used for something, you'll either need to use a new bool to differentiate between old and new functionality (and you'll need to be careful not to wreck the existing timer).

Also, if you intend for this to work online, you'll need to ensure that the server is actually running those 1 second items and you may need to make sure that the third person effects are delayed as well.
 
Last edited: