Jump to content

Adding Force Powers


Recommended Posts

I wanted to be able to add a new force ability for my mod, and was wondering how difficult this would be and what steps I would need to take in order for that to happen.  I preferably wanted to overwrite force sight, (that pointless ability that hardly anyone uses in MP)  and replace it with a more complicated ability.  The ability would need to spawn one npc at level one, two at level two, and three at level three.  The animations aren't of much concern to me at the moment.  I've already created the NPC (it's labled "lightsaber_good") that I want to be used and it should work fine with this ability.

 

shot0002.jpg

 

shot0005.jpg

 

 

Link to comment

The easiest way to do this is to just type

bind x "npc spawn lightsaber_good; npc spawn lightsaber_good; npc spawn lightsaber_good"

in your jampconfig.cfg. x obviously is the key you would normally use for force sight.

Of course, this wouldn't use the leveling system of other force powers, but this way you don't have to use complicated coding.

Link to comment

I have no clue offhand as to all the steps required for force powers. Weapons on the other hand...yeah, I could probably list all the places where you'd need to edit the code.

Anyway, here's something to get you started. In game/q_shared.h (or possibly game/bg_public.h), there's an enum that goes something like this:

typedef enum
{
FP_FIRST = 1,
FP_HEAL = 1,
FP_LEVITATION,
FP_PUSH,
FP_PULL,
FP_GRIP,
...
} force_powers_t;
I don't know the exact order of the FP_FIRST and so forth, but what I do know is that each member of this corresponds to a specific force power. (Tip: FP_LEVITATION = jump, FP_TELEPATHY = Mind Trick)

Essentially, what this code does is it assigns a number to each force power, kinda like a special identifier for it. In the code I listed above, FP_HEAL would be 1, FP_LEVITATION would be 2, and so forth. This is a good starting point for three reasons:

 

1. It can serve as an excellent reference point to where force power code might be referencing that identifier. If you right click on FP_LEVITATION and click "Find All References" (assuming you're using Visual Studio/MSVC), it'll tell you where FP_LEVITATION is used, and where you might need to reference your new power.

 

2. It's a logical place to start -- you want to define your power as existing before you can work with that, naturally.

 

3. Obligatory third reason because third time's the charm.

 

If you have any questions about "How do I do X power?" I can probably answer that as well.

Link to comment

Alright, that's a good place to start, however I have one more question.  Ever since I switched to that "Mod Base" Source code, I haven't been able to open it in Microsoft Visual Studio.  Can someone explain to me the steps that I must take in order to open the source code?

Link to comment

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...