Melee/Projectile weapon?

Topics regarding Scripting with Reality Factory
Post Reply
User avatar
GMer
Posts: 329
Joined: Thu Oct 25, 2007 4:49 pm
Location: On the rock in the 3rd solar orbit.

Melee/Projectile weapon?

Post by GMer » Wed Sep 17, 2008 4:30 pm

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)
:?
Over 3 years (has it been that long?) and just now I noticed the day and month of my birthday were switched. Whoops!

Some 2d games I made, haven't made anything in a year though O.o
http://www.yoyogames.com/users/GMer56

User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Re: Melee/Projectile weapon?

Post by Juutis » Wed Sep 17, 2008 4:36 pm

With the built-in weapons? No.
With scripted weapons? Yes.
Pain is only psychological.

User avatar
GMer
Posts: 329
Joined: Thu Oct 25, 2007 4:49 pm
Location: On the rock in the 3rd solar orbit.

Re: Melee/Projectile weapon?

Post by GMer » Wed Sep 17, 2008 4:50 pm

Can you tell me how? :oops:
Over 3 years (has it been that long?) and just now I noticed the day and month of my birthday were switched. Whoops!

Some 2d games I made, haven't made anything in a year though O.o
http://www.yoyogames.com/users/GMer56

User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Re: Melee/Projectile weapon?

Post by Juutis » Wed Sep 17, 2008 5:01 pm

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.
Pain is only psychological.

User avatar
GMer
Posts: 329
Joined: Thu Oct 25, 2007 4:49 pm
Location: On the rock in the 3rd solar orbit.

Re: Melee/Projectile weapon?

Post by GMer » Wed Sep 17, 2008 8:33 pm

I see... what would be the function to check if a mouse button is pressed? I think I could take it from there...
Over 3 years (has it been that long?) and just now I noticed the day and month of my birthday were switched. Whoops!

Some 2d games I made, haven't made anything in a year though O.o
http://www.yoyogames.com/users/GMer56

User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Re: Melee/Projectile weapon?

Post by Juutis » Wed Sep 17, 2008 8:39 pm

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
Pain is only psychological.

User avatar
GMer
Posts: 329
Joined: Thu Oct 25, 2007 4:49 pm
Location: On the rock in the 3rd solar orbit.

Re: Melee/Projectile weapon?

Post by GMer » Wed Sep 17, 2008 8:45 pm

THANK YOU!!!
Over 3 years (has it been that long?) and just now I noticed the day and month of my birthday were switched. Whoops!

Some 2d games I made, haven't made anything in a year though O.o
http://www.yoyogames.com/users/GMer56

Post Reply