View Full Version : Kismet- Picking Up and Dropping Items
01-24-2012, 04:26 PM
Hey guys and dolls,
I'm developing a level for my final semester's capstone project, and I need to know how to pick things up- more specifically, how to DROP them once they've been picked up. I've got an item- a battery- that you can pick up, but I can't make the player able to drop it. This is my Kismet so far-
I have a Dynamic Trigger in the level, but it doesn't seem to work with Toggle. Basically, what I'm trying to do is make it so when you pick up the item, it turns the trigger on, which allows you to drop your item (with Physics), and then turns off/destroys the trigger. I'd like to also make it so you can pick up items over and over. So far you can pick up it item (InterpActor with Attach to Actor), but it won't work with the Dynamic Trigger. Help!
Hopefully this can also help other level designers who run into this problem.
tl;dr: I'd like to basically replace the Physics Gun with a Use command to pick up and drop items. It's a pretty common feature in games and I have no idea why it's so hard to implement here.
PS- I totally also posted this on the UDK forums as well.
PPS- It seems that Toggling the Dynamic Trigger on and off doesn't work.
01-25-2012, 03:17 AM
It's a pretty common feature in games and I have no idea why it's so hard to implement here.
Because you're trying to use a level-event scripting tool to implement game mechanics (which should be implemented in script).
It seems that Toggling the Dynamic Trigger on and off doesn't work.
Think about it logically; of course that won't work. When you touch the trigger, you use the 'Attach to Actor' node to attach object A to object B. If you toggle the trigger, you're still just attaching object A to object B.
There is no detachment node, so you may be out of luck. Try using an attach node, but having either no variable attached to target, or on that is specified as null (i.e "attach this actor to nothing").
01-28-2012, 10:12 PM
I was trying to implement this same functionality awhile ago, and it is definitely possible just using Kismet.
You had the right idea to use Attach to Actor. However, you need to make use of the pickup boolean ("Is the player holding an item?") that is set to False . From there, attach a dynamic trigger to an interpactor (Which uses your battery model) using the "Base" property under Attachment in the trigger properties.
Here's how the Kismet sequence should work:
Use Trigger > Compare Bool (False Output) > Set Physics None > Attach to Actor > Set Bool True
Use Trigger > Compare Bool (True Output) > Set Physics Rigidbody > Attach to Actor (Check Detach) > Set Bool False
The Attach to Actor node has a Detach setting as well as a relative offset and rotation, which you'll want to tweak a bit. Also make sure that the collision is not set to BlockAll for the interpactor, otherwise you won't be able to move when you pick it up. I hope that makes sense to you.
02-01-2012, 11:45 PM
Awesome, thanks Slainean! I knew it was possible, I just had no idea how you would actually do it. I actually have a boolean for the battery, since you 'give' it to a nearby robot to power it on. I'll give your solution a try ASAP and get back. Thanks!
02-04-2012, 11:10 PM
Looks like it all works-- Took me a few minutes to realize that I have to attach the InterpActor battery that was in-game to the trigger and not from the Content Browser :P
Right now, I can pick up the object, but I can't put it down. Before, the Dynamic Trigger would just stay where I placed it in the level, but now it doesn't seem to be active or attached to the battery... Will play around with it more.
Edit: I had to use Hard Attach on the trigger. Derp. It also would drop through the floor, so I changed the Collision to BlockAll instead of no collision. I offset the battery enough that it wouldn't stop my movement as well. Now the problem is that I can't pick it up again!
Update: I tried using another Dynamic Trigger to attach the "Pick up/Use" function to the battery, but now it just makes it so I pick it up and immediately drop it, and cannot pick it up again. Hmm...
02-05-2012, 02:01 AM
I think you only really need one trigger for the item, but it could be a couple different things.
1. Uncheck "Aim to Interact" for the trigger in Kismet. The threshold for this setting is way too low to be useful IMO.
2. Remember to set the "Max Trigger Count" to 0 for infinite uses.
3. If it's still not working, then the bool probably isn't being reset. For the kismet sequence I posted, all the bool actions should point to the same variable.
I probably should have mentioned the trigger stuff since those are annoying default settings. As for the physics, I can only tell you it didn't fall through the floor for me in a BSP room. This is basically a hack for non-coders, so the results will be less than perfect.
02-06-2012, 05:08 PM
I had a few things that you suggested already done, but I went back and it works! Sort of. I can pick it up...and drop it...and pick it up again SOMETIMES.
Here's my full Kismet sequence. I simplified it from before, where I had an unnecessary regular trigger on the battery's location seeing if the Bool was False. So close!
02-07-2012, 12:09 AM
Cool, you're almost there. I think I know what the problem is: The Kismet sequences are firing off multiple actions at the same time instead of a sequential order.
For example, for the top sequence the "Compare Bool" False output is setting the interpactor's physics at the same time that it is attaching to the player. You need to rearrange it so that it's linear - that prevents an action from being executed before it ought to be (which is a race condition).
The lower "Compare Bool" True output is setting the physics at the same time that it is setting the Bool value, hence some weirdness may happen depending on which one is first. Resetting the variable has to be the last thing that happens.
It also looks like you're missing the second "Attach to Actor" node to detach the interpactor from the player, but maybe you had it elsewhere.
02-09-2012, 03:44 PM
GOT IT!!! It took a little logic and sweat, but I managed to get it working reasonably. I'm going to post the Kismet so everyone else can pick up stuff with Use! Though this is definitely a hack, it works nicely for picking up objects. I'm using it primarily in my level so you can move things away from objectives, or move certain objectives to where they are needed.
Hope this helps out anybody who has had this problem as well! Thanks again to Slainean, you rock!
02-09-2012, 07:42 PM
Awesome, glad to help! Good luck with your project.
vBulletin® v3.8.4, Copyright ©2000-2013, Jelsoft Enterprises Ltd.