dim3 Forum

Full Version: Raygun trouble
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi people,

Right...I'm looking to modify the Raygun model that came with Dim in such a way that it fires when you RELEASE the mouse button as opposed to when you press it.
Basically so that when you hold the mouse button it charges the weapon and only fires when the button is released.

How easy is this to do and could somebody please give me an idea of how to go about doing it please?

Ta
tom_mccaren Wrote:Hi people,

Right...I'm looking to modify the Raygun model that came with Dim in such a way that it fires when you RELEASE the mouse button as opposed to when you press it.
Basically so that when you hold the mouse button it charges the weapon and only fires when the button is released.

How easy is this to do and could somebody please give me an idea of how to go about doing it please?

Ta

Take a look at the Mine script, that does a "hold and release" type fire. Normally, the scripts check for the DIM3_EVENT_WEAPON_FIRE event, which is an event that fires after:

DIM3_EVENT_WEAPON_FIRE_DOWN
DIM3_EVENT_WEAPON_FIRE_UP

The mine script, on the other hand, ignores that event and instead check the DOWN/UP event:

Code:
    switch (subEvent) {
    
        case DIM3_EVENT_WEAPON_FIRE_DOWN:
            mineArm(weap,tick);
            return;
            
        case DIM3_EVENT_WEAPON_FIRE_UP:
            mineThrow(weap);
            return;
            
    }

For you, what you'd want to do is remember the tick that you got the DOWN event, and then use that when you get the UP event to change the fire (depending on the number of ticks that have gone by.)

[>] Brian
That was really helpful thanks!
Got it all working great.
Cheers!
Reference URL's