is there a "key pressed event" in kismet?
I my game , if I press some key in the keyboard, a light will turn on , if I press some other key ,the light will turn off .
I know how to add a toggleable light using kismet .and it is done by add a trigger.when touch the trigger, turn on ,when leave the trigger ,turn off .
the problem is ,I need a key event to control the light to turn on or off .pressing some key will control the light ..
how to do that?...thank you all.~~~
If this is not a proximity based event (IE. if this is for a light the player will be holding) make a exe function that will toggle the light and bind that function to a key via the UTInput.ini file. If this is proximity based the same thing still applies but instead of just toggling a light you will need to check if the player is near.
the question is that I want to use kismet to do the job.....
if I have to do in .uc file ....can you give me a simple example?..
I can write an exec function . so I can open the console , and type the command ,it will turn on or turn off the light..
how to write the function ??
I add a light in unk editor ..but how to modify it in .uc file ????
Last edited by magicianfc; 12-28-2009 at 12:15 AM.
make a trigger like normal, then in kismet instead of "touched" set it up to "used".. then when you press "E" key the trigger is used..
I did a toggleable flashlight using an AttachToActor on PlayerSpawned, combined with a Toggle and Compare Boolean.
You can use it to attach your light AND your trigger to the player. That way he is always near the trigger, because its being attached to him.
This means your flashlight will be "bound" to the USE button, meaning you'd be turning your flashlight off on and to use anything in your game, this is why you need to eventually code it in to your UTinput.ini, but it's fun just to play around with a flashlight in game simply using kistmet.
Heres my kismet if you are still interested:
Ok so at the top we are telling the game to attach our light and our trigger to the player. Under that we say if the Trigger has been used, and the boolean is true, then toggle off and change the boolean to false. If the boolean is false, then toggle on and change the boolean to true. Our boolean alternates between true and false to represent the light being off and on.
It's fairly easy to program your own keypress if you take 10 minutes to look at the UTinput.ini, but you'd need to write a function for that keypress to execute, and I have no idea about attaching lights or setting them up with uscript sorry. Maybe someone here knows how!
EDIT: Ah, look at this - http://forums.epicgames.com/showthread.php?t=713387
Last edited by BrendanJB; 12-28-2009 at 06:01 AM.
thank you .and I get it..
bind a trigger with the player. when press e , use the trigger ,and the trigger will control the light to turn on or turn off .
it is really a smart way . it is really a good idea . thank you !~