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-
http://imageshack.us/photo/my-images/268/94798193.png/
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.
Replies
Because you're trying to use a level-event scripting tool to implement game mechanics (which should be implemented in script).
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").
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:
Item Pickup
Use Trigger > Compare Bool (False Output) > Set Physics None > Attach to Actor > Set Bool True
Item Drop
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.
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...
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.
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!
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.
Hope this helps out anybody who has had this problem as well! Thanks again to Slainean, you rock!