PDA

View Full Version : [KOTOR] NEW FORCE POWER: turn ennemies into allies


Darth333
06-20-2004, 09:44 PM
Mod updated June 26, 2004




Remember the Jedi Knight series?
This is a level 9 light side force power,that allows
you to turn an ennemy into an ally during 23.5 seconds
(they will fight at your side).

screenshot (http://img47.photobucket.com/albums/v144/Darth333/tuiles.jpg)

Special thanks to:
Svösh for the custom Icon

TK102 for his Darkside choker which
i used as an example for making this force power.

Source code included.

=========================================
Read installation instructions carefully: I made two custom installations depending on whether or not you are using the following mods:

TK102'S DarKside Choker, GameUnlimited's force replication and Darth Khasei's force powers.

Download at:
http://www.pcgamemods.com/mod/5904.html (make sure you download version 2.1)

or at my website (click on my sig)

Feedback is always appreciated and helps making better mods in the future :)

svösh
06-20-2004, 10:38 PM
Looks great can’t wait to try it out. :D :bounce1:

Good old mind trick brings back memories of jkO and jka

Keep up the exellent work Darth333 always a pleasure working with you.

svösh

T7nowhere
06-20-2004, 11:42 PM
This power sounds cool and fits in well within star wars. :)

Lorden Darkblade
06-21-2004, 12:55 AM
Great work!
Now I have a question, how did you make the Power appear in the Battle Menu?
Darth Khasei thought that would not be possible....
But anyway, great work!
Keep up with it.

Darth333
06-21-2004, 12:58 AM
Originally posted by ReLoaD2K
Great work!
Now I have a question, how did you make the Power appear in the Battle Menu?

Yes, just like any other "offensive force power". Secret is in the spells.2da file ;)

Lorden Darkblade
06-21-2004, 01:07 AM
Tell that secret to Darth Khasei, not that his powers are not good of course, when I tryied his powers for the first time I was in Manaan in the Republic place and I KILLED ROLAND WANN. :p :D
And I also think that offensive powers should be placed there cuz in another time in Tatooine when I was fighting the 3 Dark Jedis in there I killed like 3 Jawas and 2 Duros when they were passing by :p
Anyway, nice power!

Darth333
06-21-2004, 01:11 AM
Just j/k, there is no secret: anyone can look at the spells.2da file that comes with the mod with KT :) I also included the source code in the download.

Colja
06-21-2004, 02:13 AM
Sounds awesome!.....I can't wait to give it a try.:D good job you guys.

Darth_ToMeR
06-21-2004, 06:34 AM
Cool! nice work.

Mav
06-21-2004, 06:48 AM
I love this mod man!! thanks Darth333

Colma Adawin
06-21-2004, 07:26 AM
Hey nice work i'll enjoy using this on my foes as i CONSTANTLY play the Lightside!! :D

again, EXCELLENT!!!!!

MattCole :D

Ps thanks for your help with that thing i was doing (Kel) and could you pm me becoz i got your files but dont know what to do with them?! :cry6:

RedHawke
06-21-2004, 07:46 AM
Very cool idea, and a very cool mod Darth333! :D

Now, all your mind belong to us... sorry, its a Blizzard Joke!

Doom_Dealer
06-21-2004, 09:47 AM
nice one darth333, ive been waiting for this one :)
you still working on the morphing power???

Darth333
06-21-2004, 09:54 AM
Sure, I can finish it. What would you like to see?

Doom_Dealer
06-21-2004, 10:10 AM
up too you really, did you find out how to temporaraly increase your characters stats using a script yet??

Darth333
06-21-2004, 10:23 AM
I never tryied to do that but yes, it can be done quite easily.
You could try using some of these (just examples):


ApplyEffectToObject(nDurationType, eEffect, oTarget, fDuration);

EffectAbilityDecrease(ABILITY_CONSTITUTION, 4)
EffectAbilityDecrease(ABILITY_STRENGTH, 4)
EffectAbilityDecrease(ABILITY_DEXTERITY, 4)
EffectSavingThrowIncrease(SAVING_THROW_REFLEX, 2)
EffectSavingThrowIncrease(SAVING_THROW_WILL, 2)
EffectAbilityIncrease(ABILITY_DEXTERITY, 2)
EffectAbilityIncrease(ABILITY_INTELLIGENCE, 2)
EffectAbilityIncrease(ABILITY_STRENGTH, 2)
EffectAbilityIncrease(ABILITY_WISDOM, 2)

tk102
06-21-2004, 10:36 AM
Good job, Darth333. Thanks for the credit and inclusion of the DS Choker. (This lightside power helps balance out that evil thing. :) )


Reload2k originally posted:
how did you make the Power appear in the Battle Menu?
Darth Khasei thought that would not be possible... And I also think that offensive powers should be placed there cuz For force powers that affect non-enemies, you must use the Friendly Force power slot. Hostile force powers can only target enemies...

Redhawke originally posted:
Now, all your mind belong to us... sorry, its a Blizzard Joke! That's from the Hitchhiker's Guide to the Galaxy. :)

tk102
06-21-2004, 10:39 AM
Doom Dealer originally posted:
up too you really, did you find out how to temporaraly increase your characters stats using a script yet??
Isn't that what the Force Valor series of powers does?

Darth Khasei
06-21-2004, 12:53 PM
Happy fathers day to all. Great new power.

Darth333 thanks for the info on how to place the powers into the offensive menu. I have changed all of the new force powers to fit in that regular menu. Now, how do you get the title to appear over the power in the menu. I have an update I am working on and it would be nice to fix this label thing as I obviously missed something concerning how to do that.

BTW, I like your script. Did you take programming?

tk102
06-21-2004, 01:43 PM
Darth Khasei,
Remember my post in your original thread (http://www.lucasforums.com/showthread.php?s=&threadid=129480) regarding the name and spelldesc fields in spells.2da -- well that's how you get the label to appear over the force power... ;)

Darth333
06-21-2004, 04:01 PM
Originally posted by Darth Khasei
Happy fathers day to all. Great new power.

Darth333 thanks for the info on how to place the powers into the offensive menu. I have changed all of the new force powers to fit in that regular menu. Now, how do you get the title to appear over the power in the menu. I have an update I am working on and it would be nice to fix this label thing as I obviously missed something concerning how to do that.
I guess tk102 just answered your question: I just referenced to an entry of the .tlk in the spells.2da file. Only requires a bit of searching to find a proper entry but TK102 is very good at that :D (The entry I used was suggested by him)

BTW, I like your script. Did you take programming?
Not at all, I'm just a geek lawyer :D

Thanks for all the nice feedback :)

Mono_Giganto
06-21-2004, 06:06 PM
Lol good one Darth333, and thanks for putting it somewhere other than pcgamemods so I can d/l it!

Darth Khasei
06-22-2004, 12:45 AM
Sorry guys I'm just a little older than yesterday and I forgot about that post. Following up now:D

Darth Khasei
06-22-2004, 02:35 AM
Got it Thx TK.

Hey Darth333 I have found a way to improve the targeting in the force powers. I see you used pretty much the same targeting structure in your power that I did. It does the same thing mine did(ie, it seems to target the second closest target etc..)

I have been working on fixing the targeting for all of my powers and they work just like the regular force powers now, in that they target the proper target so to speak.

In the start "int" section add this "int SWFP_SHAPE;" no quotes. Then in the effects section add this "SWFP_SHAPE = SHAPE_SPHERE;" no quotes.

This little extra bit will do the trick on the targeting issue for ya. Cheers. It is better but not perfect in high enemy concentrated areas.

Darth333
06-22-2004, 09:42 AM
Thanks Darth Khasei, I'll try that :)
BTW, there is a column in the spells.2da file called range:
S is for Spherical effect . I'll try combining the two to see what happens. (in the meantime, it's not a major problem with this Force power: it's always good to have an ally in the middle of the battle ;) )

Darth Khasei
06-22-2004, 11:14 AM
I'm going to do some more testing with the S and see if I can make it perfect. Right now, you have to be really close for it to target the exact person you target.

Mav
06-22-2004, 04:32 PM
Darth Khasei, are you trying to fix you rforce powers so that they only do damage to the enemy you are looking at? Because I love youyr forcepowers, but they would be even better if you could figure out how to fix that because sometimes when I use your force powers I accidentally kill a shop vendor or a innocent passerby...lol anyway good luck!

Darth333
06-22-2004, 04:41 PM
That is not a problem anymore Maverick :) what we are trying to fix is the targetting system during battle. When you have a group of ennemies (example Star Forge) the power does not target the nearest ennemy but the second closest ennemy.

Darth Khasei if you find the solution, pls let us know :)

tk102
06-22-2004, 05:08 PM
Strange --

Here's a way to do it without the break; statement. Maybe that was causing something to go awry.


object oTarget = GetFirstObjectInShape(SHAPE_SPHERE, 17.0, GetLocation(OBJECT_SELF), TRUE, OBJECT_TYPE_CREATURE);

int nBreak=0;
while (nBreak==0 && GetIsObjectValid(oTarget)) {
if (!GetIsFriend(oTarget)) {
if (GetRacialType(oTarget) != RACIAL_TYPE_DROID ) {
nBreak==1;
}
}
if (nBreak==0) {
oTarget = GetNextObjectInShape(SHAPE_SPHERE, 17.0, GetLocation(OBJECT_SELF), TRUE, OBJECT_TYPE_CREATURE);
}
}

Lorden Darkblade
06-22-2004, 05:52 PM
I dont understand scripting but what I understand is:
Each day that goes by you guys get even better at this!
Let us all keep up with the fantastic work!!:D :D :) :)

Darth Khasei
06-22-2004, 06:44 PM
Thx TK! I tried that and the result is the same. I also tried adjusting the 17 meter distance and found something very interesting. The powers work a little better the shorter the distance. I changed it down to 5 meters and the results were promising if not perfect.

The powers no longer targets that distant shop keeper, but if you are facing a group of enemies and more than one is within the target zone, the second one still gets targeted about 80% of the time. Not perfect but better.

I also wanted to ask you something about script commands and get your thoughts. The GetFirstObject statement targets your first guy picked in the FP target box. Then if that target is valid it seems to read GetNextObject in that shape. I think that is where the issue lies as it seems regardless of the validity of the first object, after the check it just targets the "next" shape and does not go back to that original target picked. I hope you follow what I am saying.

Is there a way to script it so that after that first object is checked and is valid that the script refers back to that original object without moving to the next unless the first object is "invalid". Just asking because my scripting prowess is VERY limited.

Oh BTW, I also tried just changing the GetNextObject to GetFirstObject, but the result was the same(ie. it gets the second object). Cheers.

tk102
06-22-2004, 07:21 PM
I know what you mean DK.

Maybe the answer is to break apart the spell effect for the 1st object.

The logic would be

GetFirstObjectInShape
Is this Object Valid? If so, is this Object a non-friend and is this Object a non-droid? If so, then call spell effect function.
GetNextObjectInShape
Is this Object Valid? If so, is this Object a non-friend and is this Object a non-droid? If so, then call spell effect function.
Loop back to step 3 until GetIsObjectValid returns FALSE.

So, for the first object, Steps 1 and 2 explicitly handle the spell effects outside of the while loop (steps 3-5). The other steps handle all other objects. If that type of script doesn't work.... :p

Darth Khasei
06-22-2004, 07:39 PM
See that was my problem back in college when I took programming darn it! I can verbally explain these concepts and even understand them fairly well, but when it comes to actually placing that concept to code/script, I get serious brain farts that get in the way on me making the code work, without endless trial and error argh! :evanpiel:

deathstrike123
06-24-2004, 01:29 AM
Im just another noob with a stupid question but do you have to start a new game to get this force power to work? I followed the instalation instructions and loaded a game where I was a jedi and the power didnt appear. How do I get it to appear?

Darth Khasei
06-24-2004, 01:40 AM
Ok to add the power for a game already started use KSE to add the power.

Update for you Darth333. If you change the distance from 17 to something much shorter and change the Get Location to GetSpellLocation, the targeting is really great.

Mav
06-24-2004, 01:40 AM
are you sure that your character has learned the force power??? as in when you level up you select the force power for him to learn?

deathstrike123
06-24-2004, 02:26 AM
actually, im using bastilla. I installed the stuff and went to bastilla on taris. She was able to level up so I did and saw no new force power on the power selection screen.

Mav
06-24-2004, 03:09 AM
hmmm thats strange, the only thing I can think of is that maybe you didn't add all the files to your override folder

Jackel
06-24-2004, 03:29 AM
Originally posted by Darth333
I never tryied to do that but yes, it can be done quite easily.
You could try using some of these (just examples):


ApplyEffectToObject(nDurationType, eEffect, oTarget, fDuration);

EffectAbilityDecrease(ABILITY_CONSTITUTION, 4)
EffectAbilityDecrease(ABILITY_STRENGTH, 4)
EffectAbilityDecrease(ABILITY_DEXTERITY, 4)
EffectSavingThrowIncrease(SAVING_THROW_REFLEX, 2)
EffectSavingThrowIncrease(SAVING_THROW_WILL, 2)
EffectAbilityIncrease(ABILITY_DEXTERITY, 2)
EffectAbilityIncrease(ABILITY_INTELLIGENCE, 2)
EffectAbilityIncrease(ABILITY_STRENGTH, 2)
EffectAbilityIncrease(ABILITY_WISDOM, 2)

D333 : would these changes be able to be made randomly ? ie you use the power and a random stat increase

Darth333
06-24-2004, 03:48 PM
Maverick and Deathstrike123: the new fp is a level 9 force power so it will not be selectable in the level up screen until your character reaches this level. There is no need to start a new game.

Jackel: due to family obligations Ididn't have time to really look at what the script would be but yes, it would be possible to have a random stats increase.

I'm currently working in a new ls fp that will be called "force mirror": the PC will be able to return to the ennemy the same fp that was casted by the ennemy (even if the PC does not have the power originally).

Darth Khasei: thanks for the info, i'll try that.

tk102
06-24-2004, 06:11 PM
Jackel:
you could do that using the Random function.

example
void main(){
effect eRandom;
int nRandom=Random(3); //random # 0-2
switch (nRandom)
{
case 0:
{
eRandom = EffectAbilityIncrease(ABILITY_DEXTERITY, 2);
}
case 1:
{
eRandom = EffectAbilityIncrease(ABILITY_STRENGTH, 2);
}
case 2:
{
eRandom = EffectAbilityIncrease(ABILITY_WISDOM, 2);
}
}
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eRandom, GetFirstPC(), 30.0);
}

Darth Khasei
06-24-2004, 07:10 PM
Darth333, finally got the targeting correct about 95% of the time for large groups and 100% for smaller groups.

Moving the powers to the offensive menu and cutting the spell distance helped out alot. I eliminated the second check for objects since the object targeted in the offensive menu is the one we want anyway. I also changed the ObjectValid statement to Enemy and it worked like a charm, once I got the scripting right that is:D

When I release the update I'll have the script ready for you to look at.

Darth333
06-24-2004, 07:28 PM
Great! :) Glad you solved this problem Darth Khasei. Unfortunately due to some family obligations i did not have time for modding this week but i should be able to get back to it tomorrow.

Darth333
06-26-2004, 05:55 PM
Finally I found what was wrong. In fact, we were trying to make things complicated where they shouldn't be. We were heading in the wrong direction.

The mod has been updated at PCgamemods: http://www.pcgamemods.com/5904/ (make sure you download version 2.0) or at my website (click my sig)

Here is what nwscript.nss says about the GetFirstObjectInShape function:

128: Get the first object in nShape
// - nShape: SHAPE_*
// - fSize:
// -> If nShape == SHAPE_SPHERE, this is the radius of the sphere
// -> If nShape == SHAPE_SPELLCYLINDER, this is the radius of the cylinder
// -> If nShape == SHAPE_CONE, this is the widest radius of the cone
// -> If nShape == SHAPE_CUBE, this is half the length of one of the sides of
// the cube
// - lTarget: This is the centre of the effect, usually GetSpellTargetPosition(),
// or the end of a cylinder or cone.
// - bLineOfSight: This controls whether to do a line-of-sight check on the
// object returned.
// (This can be used to ensure that spell effects do not go through walls.)
// - nObjectFilter: This allows you to filter out undesired object types, using
// bitwise "or".
// For example, to return only creatures and doors, the value for this
// parameter would be OBJECT_TYPE_CREATURE | OBJECT_TYPE_DOOR
// - vOrigin: This is only used for cylinders and cones, and specifies the
// origin of the effect(normally the spell-caster's position).
// Return value on error: OBJECT_INVALID
object GetFirstObjectInShape(int nShape, float fSize, location lTarget, int bLineOfSight=FALSE, int nObjectFilter=OBJECT_TYPE_CREATURE, vector vOrigin=[0.0,0.0,0.0]);

So the target is the first object located at the centre of the area effect, which is not what we want for a power like Mind Trick. If you look at k_inc_force, you'll see that this function is only used with force powers that affect multiple ennemies.

So I removed the following lines from the script:
object oTarget = GetFirstObjectInShape(SHAPE_SPHERE, 17.0, GetLocation(OBJECT_SELF), TRUE, OBJECT_TYPE_CREATURE);
while (GetIsObjectValid(oTarget)) {
if (!GetIsFriend(oTarget) && GetRacialType(oTarget) != RACIAL_TYPE_DROID) { break;}
oTarget = GetNextObjectInShape(SHAPE_SPHERE, 17.0, GetLocation(OBJECT_SELF), TRUE, OBJECT_TYPE_CREATURE);



}
if (GetIsObjectValid(oTarget))


and simply replaced them by:

object oTarget = GetSpellTargetObject();

Spells 2da takes care of the rest :D
and it works flawlessly

tk102
06-26-2004, 05:58 PM
Right. You only need the whole Area of Effect spell for when you have a semi-hostile spell as a 'Friendly' force power. That's because Friendly force powers have no other way of targeting.

Sorry, I could've pointed you in the right direction a long time ago... :p I was clueless...

tk102
06-26-2004, 06:01 PM
By the way, that's the reason mgnails keeps killing himself with 'Friendly' powers. Because the PC is the SpellTarget of a Friendly Force Power!

Darth333
06-26-2004, 06:06 PM
Sorry, I could've pointed you in the right direction a long time ago... I was clueless...
Don't be sorry, finding this out was part of the fun of making this mod :D

Originally posted by tk102
By the way, that's the reason mgnails keeps killing himself with 'Friendly' powers. Because the PC is the SpellTarget of a Friendly Force Power!
:D :D :D

off topic:
What more than 550 posts and I'm a RANCOR????? :mad: How insulting! :D

Darth Khasei
06-26-2004, 09:42 PM
I love you guys and gals!. This is what a modding community is all about! Funny I ended up refining my scripts by taking that out too. Only I did not replace it with a script that is as efficient and effective as this one! Salute to you Darth333.

Now, back to make a quick change on the scripts, get the photos up to the site for the new powers and spawn on demand characters..... Oh, I guess I have a little work to do:D

------Edit
PS! OH MY GOSH THIS IS AWESOME! 100% PERFECT REGARDLESS OF THE NUMBER OF ENEMIES YIPPIE!!!!!!!!!

Darth333
06-27-2004, 02:22 AM
The SPHERE_SHAPE thing and my post above would also explain why targetting would improve when reducing the distance: by reducing the distance, you reduce the radius of the shape and and get fewer ennemies caught in the area of effect :)

Darth333
06-27-2004, 01:43 PM
Force power mind trick has been updated another time to correct an occasional bug that would cause the game to crash when targetting some specific npcs.
The mod can be downloaded at PCgamemods http://www.pcgamemods.com/5904/ (get version 2.1) or by clicking on my sig. :)

screenshot (http://img47.photobucket.com/albums/v144/Darth333/tuiles.jpg)

Darth Khasei
06-27-2004, 04:41 PM
I just love that Survival mod! I love the KOTOR arena mod to..

Darth333
06-27-2004, 05:12 PM
Originally posted by Darth Khasei
I just love that Survival mod! I love the KOTOR arena mod to..
If you are talking about the screenshot, it wasn't exactly the survival battle mod (i have to admit that I never played the mod, only the arena). It's just a customizable module I made to take some screenshots (no more problems with dark backgounds) and test my mods. I just placed somevarious hostile npcs there and didn't even bother with changing the min1hp: I ended up with an unbeatable Deadeye Duncan :D

The idea was to use different npcs with different scripts attached to their .utc files to test the mod.

Darth Khasei
06-27-2004, 09:37 PM
Ah I see, I was wondering about that when I saw those other NPC's.

Sith Holocron
09-23-2009, 12:14 AM
Have you ever considered releasing a version for TSL?

Mono_Giganto
09-23-2009, 12:40 AM
Have you ever considered releasing a version for TSL?

It's already in the game; Force Confusion is essentially the same thing.