Page 1 of 1

Melee/Projectile weapon?

Posted: Wed Sep 17, 2008 4:30 pm
by GMer
Is it possible (I don't think it is, but I'll ask anyway) to make a weapon so that the left mouse button does a projectile launch and the right button a melee attack? (Like in halo)
:?

Re: Melee/Projectile weapon?

Posted: Wed Sep 17, 2008 4:36 pm
by Juutis
With the built-in weapons? No.
With scripted weapons? Yes.

Re: Melee/Projectile weapon?

Posted: Wed Sep 17, 2008 4:50 pm
by GMer
Can you tell me how? :oops:

Re: Melee/Projectile weapon?

Posted: Wed Sep 17, 2008 5:01 pm
by Juutis
Well, first of all you would need to script your weapon system. In other words, ditch the RF's weapon system (weapon.ini) and build one of your own using pawns and scripts. Basically you need to have a pawn that acts as the weapon: moves with the player, stays aligned with the camera and detects user input (such as mouse clicks). It's a bit tricky, but not overly hard if you have some basic understanding of Simkin and scripting in RF.

After that making the secondary attack is very easy. Just check if the secondary attack button is pressed and then do the secondary attack (play the animation and do damage in melee range or shoot a projectile with very short range).


That is for 1st person weapons only. If you want it to work in 3rd person too you'd have to script the whole player.

Re: Melee/Projectile weapon?

Posted: Wed Sep 17, 2008 8:33 pm
by GMer
I see... what would be the function to check if a mouse button is pressed? I think I could take it from there...

Re: Melee/Projectile weapon?

Posted: Wed Sep 17, 2008 8:39 pm
by Juutis
The manual:
self.lbutton_pressed
Returns the state of the left mouse button

self.rbutton_pressed
Returns the state of the right mouse button

self.mbutton_pressed
Returns the state of the middle mouse button

Re: Melee/Projectile weapon?

Posted: Wed Sep 17, 2008 8:45 pm
by GMer
THANK YOU!!!