PDA

View Full Version : put away weapon kismet



n321
11-25-2009, 10:26 PM
Ok so if youve played mass effect you have probably seen something like this.

enemy spots player,
battle music starts,
player plays an animation that pulls holstered weapon out and camera changes a bit to be more battle oriented,
player kills all enemys in area that can see him,
another animation plays to re holster weapon and set camera back to normal.

Any ideas how this can be acomplished with kismet? I can get the event parts down but its the animation from holsterd to ready and back that I can not figure out. Im guessing some Uscript is needed to create the custom kismet nodes but Id like to use as little programming as possible as Im not much of a programmer.

I also figure Id have to have a kismet sequence set up on level start that keeps the weapons holstered until battle event is triggered.

any ideas on this would be great
thanx!

JeremyStieglitz
11-26-2009, 04:40 AM
You could fake this functionality by using the "Give Inventory" kismet action, which has an option to "Clear Existing" inventory. Use "Clear Existing" without giving any new inventory to take the player's weapons away (actually destroying them), and then give him (new) inventory using that Action when you want him to have weapons again. However, that approach actually destroys the old inventory so you'd lose ammo counts, and also probably won't play transitional animations correctly.

To do it properly -- to actually put the weapon away and take it back out, which would play the appropriate animations -- requires some new UScript to add a couple additional Kismet actions.

Basically, you need to make a new Kismet action which calls Pawn.SetCurrentWeapon(), with both the Pawn and Weapon object as Kismet-variable input. Passing in an empty/none Weapon object (i.e. just no Kismet variable link at all) would cause the current weapon to be put away, without another weapon being equipped.

In order to restore the player's previous weapon, you'd need to store a reference in Kismet to to the current weapon before putting it away. That could be done by making a "GetCurrentWeapon" action which returns a Kismet-object of the current weapon. Then when you wanted to restore that weapon, you'd simply call SetCurrentWeapon passing in the original Weapon object you saved.

Technically you may also wish to prevent the player form manually switching to his weapon when you don't want him to do so, which could most easily be achieved by removing the PrevWeapon/NextWeapon input bindings from the DefaultInput.ini (the best approach would be to override those exec functions completely from your Player Controller).

So yeah, it's some script work, but it's worth learning if you're interested in implementing more complex gameplay: you'll find that your Kismet capability can be greatly extended and customized with a bit of UScript.

-Jer