Jump to content

Jedi Academy turned 20 this year! We celebrated in a ton of different ways: mod contest, server event, podcast, etc. Thank you to all who have been a part of this game for the last two decades. Check out the anniversary content!

Read more

Welcome to JKHub

This community is dedicated to the games Star Wars: Jedi Outcast (2002) and Jedi Academy (2003). We host over 3,000 mods created by passionate fans around the world, and thousands of threads of people showcasing their works in progress and asking for assistance. From mods to art to troubleshooting help, we probably have it. If we don't, request or contribute!

Get started

This game turned 20 years old this year, and it is still one of the greatest Star Wars games of all time. If you're new or returning from a long hiatus, here are the basics of getting started with Star Wars Jedi Knight Jedi Academy in 2023.

Read more

Give stuff to players in MP: Hack to make target_give work in multiplayer maps


TomArrow

As some have noticed over the years, target_give in Jedi Knight mutliplayer is broken.

The reason is a piece of code in Multiplayer that does not let you touch an item (which a target_give essentially does for you) if it has a so-called EF_NODRAW flag, which as the name suggests, makes the item not visible, usually after an item is picked up and waiting to respawn. This flag is also set specifically for items that are targets though, because you don't want them to appear for the player. So the very act of giving an item a targetname so that the target_give can find it, makes it impossible for the item to be picked up.

But it turns out there is a way to make it work anyway.

A target_give "touches" another item. A normal trigger "uses" another entity.

As fate and sheer luck would have it, items can also be "used". And "using" them actually makes them respawn. Which in turn removes the EF_NODRAW flag.

In addition to your trigger that activates the target_give pointing to the item in question, you need a trigger that simply points directly at the item itself. Once this trigger executes, it will force the item to respawn, which in turn will make the target_give work.

Here's an example of how to set this up so that you only need one trigger:

target_give_fix.png.d3026fdbe8cd756ced894778376167f8.png

Just have the item with the targetname, and then a target_give as per usual, and additionally add a target_relay that has the same targetname as the target_give, which in turn also points at the item. Giving it the same name as the target_give means that any trigger executing the target_give will automatically also execute the target_relay, which will in turn "use" (respawn) the item.

Keep in mind though that the order here matters. Let's say you are using a trigger_multiple with the use_button spawnflag and you want the player to get an item when he presses a button. If the target_give is executed first (before the target_relay), then the first button press will fail because the EF_NODRAW flag is still set. The second press will work because right after the initial target_give was executed, the target_relay was executed as well and respawned the item, making it possible to be "touched" by the second button press. However if the target_relay is executed first, then the first button press will be successful. I'm not sure if you can greatly influence the order of execution but if you add the target_relay into the map before the target_give, that might work. Otherwise if that does not work and it is critical for it to work the first time around, maybe add a trigger_always pointing at the item itself which will make it come alive at the start of the level already.

Also keep in mind that due to this workaround and depending on the order of execution, you might end up with the item actually becoming visible. So consider putting it in some hidden place that isn't accessible.

Smoo, HunterHog and mjt like this

User Feedback

Recommended Comments

There are no comments to display.



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...