Hi, I downloaded Talchia's Hardcore mod and its really great, but I'd like to make a mod along similar lines myself... does anyone know where I can find the source code for the Hardcore mod?
Or else just as helpful would be some help as to where to start on this idea? I'd like to modify the stats of all enemies in the game by multiplying them by a fraction of the player's Character level. e.g.
Hitpoints (for all enemies) * (1/8 of Player level)
That way all the enemies will keep their difficulty relative to each other unlike the hardcore mod where stats were simply added.
If anyone can outline for me roughly how to get started on this that would be great. I have all the necessary modding tools, my trouble is just what functions to use to specify all enemies and modify their stats based on the player's level. Thanks.
Originally posted by MightyM
Hi, I downloaded Talchia's Hardcore mod and its really great, but I'd like to make a mod along similar lines myself... does anyone know where I can find the source code for the Hardcore mod?
Or else just as helpful would be some help as to where to start on this idea? I'd like to modify the stats of all enemies in the game by multiplying them by a fraction of the player's Character level. e.g.
Hitpoints (for all enemies) * (1/8 of Player level)
That way all the enemies will keep their difficulty relative to each other unlike the hardcore mod where stats were simply added.
If anyone can outline for me roughly how to get started on this that would be great. I have all the necessary modding tools, my trouble is just what functions to use to specify all enemies and modify their stats based on the player's level. Thanks.
I don't know much about this sort of thing but i thought of a possible direction. Every area in the game has a Enter script. Perhaps what you want can be done by adding some functions to the default script.
Anyway. Good luck on that. It sounds very good but also very hard and challenging.:)
Talchia edited k_ai_master.nss. You'll find the source code in this thread:
http://www.lucasforums.com/showthread.php?s=&threadid=120989) (last post).
Thanks for the replies. The enter script thing might help a bit, i'll look into that. Also the source code for all the scripts in the game exists in the scripts.bif I looked at the K_AI_Master source and concluded that Talchia did not use existing functionality within the file but rather added his/her own.
Originally posted by MightyM
Thanks for the replies. The enter script thing might help a bit, i'll look into that. If I were you, I would forget this. First you'll have to edit the enter script for all the areas and it's heavy for nothing since there are other available solutions. Simple is always better. Also, many other mods are using those scripts and it will only create an incompatibility problem.
I looked at the K_AI_Master source and concluded that Talchia did not use existing functionality within the file but rather added his/her own. That is true. You could also have a look at k_def_buff.nss in the BIFs :)
"That is true. You could also have a look at k_def_buff.nss in the BIFs"
SWEET! I think this will be perfect! I have one ominous question tho, why didn't Talchia use this file then? Why use K_AI_Master if k_def_buff already had the capability? Oh well... time to test it out.
It looked promising.... and I modified it, but sadly it modified my stats not the enemies' which doesn't make much sense... but whatever. I'm going to look for the difficulty scripts now. Thanks for the suggestion tho.
why didn't Talchia use this file then? Why use K_AI_Master if k_def_buff already had the capability?
He may not have been aware of it at the time. That was pretty early on when modding KOTOR was in it's infancy.
A lot of the NPC's and creatures do not run the k_deff_buff. Like the Sandpeople and some of creatures you fight in Kashyyyk. However, every creature does use k_ai_master. You have to check the spawn in script for a creature and see if it makes a call to k_deff_buff. You are probably better off changing the k_ai_master.
How do I edit K_AI_Master? I can't seem to find an object that specifies all enemies... I can find objects that specify the targeted enemy, or the nearest enemy ... but not all enemies. Does anyone know what the object that specifies all enemies in area, or just all enemies period is called?
Where are the base stats for all the npcs defined? What file? This would be a great help to know :D.
Also, does anyone know of an object that contains all the enemies in the game? I mean how did Talchia do his hardcore mod? To what objects did he effect changes? Just to your target... or what? How could I change the stats on a particular enemy? Or better yet all enemies? Thanks.
^^^^
You have lots of questions padawan... this is good! :D
Originally posted by MightyM
Where are the base stats for all the npcs defined? What file? This would be a great help to know :D.
The NPC stats are defined by their individual .utc file, then enhanced by the k_ai_master.ncs script.
Originally posted by MightyM
Also, does anyone know of an object that contains all the enemies in the game?
Nope, there is no one central place to store NPC information, they are all individual .utc files stored in the individual modules themselves.
Originally posted by MightyM
I mean how did Talchia do his hardcore mod? To what objects did he effect changes? Just to your target... or what?
Talchia altered the k_ai_master.ncs script this script simply adjusts the NPC's that are hostile to you in the game pending your level, and the games difficulty setting, if I'm not mistaken. ;)
Originally posted by MightyM
How could I change the stats on a particular enemy? Or better yet all enemies? Thanks.
You can change the stats of a particular enemy by simply editing the NPC's .utc file with KT to taste, and dropping it into override... Warning some of the NPC .utc files if placed in override can screw up the game at numerous points.
There isn't really a way to alter all NPC's of a particular type as I said above there is no real central file that defines the NPC's statistics, they are all individual files contained in the modules themselves.
The only centralized NPC file is the appearance.2da this controls the NPC appearances but it does not control the statistics.
I hope this helps! :D
That's awsome!
Talchia altered the k_ai_master.ncs script this script simply adjusts the NPC's that are hostile to you in the game pending your level, and the games difficulty setting, if I'm not mistaken.
I would love to edit the NPC's that are hostile to me. But how can I do this? The trouble is -I can't seem to figure out how Talchia implemented his mod in the K_AI_Master file... I just have no idea what he did.... if I had his source code or somthing I'm sure I could improve upon the mod
e.g. i'd do somthing like this to enemies stats:
EffectAbilityIncrease(ABILITY_DEXTERITY, nCharLevel+3)
Would it be possible for you to give me some pointers as to how to modify enemies stats? How would be the best way to do this? I'd like to modify the K_AI_Master file since it is the most logical, and i'd like all enemies to be modified according to the stat changes I specify. Thanks!
Originally posted by MightyM
That's awsome!
Just so you know the file works simply, not that it is simple to do. ;)
Originally posted by MightyM
I would love to edit the NPC's that are hostile to me. But how can I do this?
(Edited for space)
Thanks!
Sadly, I don't think you can see what Talchia did because Talchia did not include a source .nss script in his mod.
Well you will have to look at the source script called k_ai_master.nss, you can find it with KT (I don't have a comp with KT on it right now but I believe it is in there somewhere), this is the base script the game uses, you will have to modify that .nss script to taste with notepad, then compile it with the compiler.
This thread (
http://www.lucasforums.com/showthread.php?s=&threadid=129789) might be of help to you as far as helping you with the how to, and the links to the tool downloads you will need.
I hope this helps! :D
EDIT: MightyM, you should have asked these questions in the thread you already started (
http://www.lucasforums.com/showthread.php?s=&threadid=141022) as you are asking the same types of questions here, this would have helped to centralize your questions and the answers.
If a moderator reads this it might be beneficial to merge the two threads. :D
You should modify Talchia's code to how you want it. Darth333 gave you the download link in a earlier thread. His script is fired by the indiviual creatures when they perceive you for the first time. You should not do a mass update with this script, unless you used the "On Entry" script. You will need to do a couple of steps.
1. Make sure the player and his party do no run this script
2. Get the players level - Talchia used the variable nCharLevel
3. Get the object_self hitpoints
4. Modify the hitpoints
All of the above steps are in the Hardcore mods source code. Just look at case 1002 - On Perception
MightyM, in case you did not find out about this yet, you could have a look at nwnscript.nss for the functions you can use.
Originally posted by RedHawke
EDIT: MightyM, you should have asked these questions in the thread you already started (
http://www.lucasforums.com/showthread.php?s=&threadid=141022) as you are asking the same types of questions here, this would have helped to centralize your questions and the answers.
If a moderator reads this it might be beneficial to merge the two threads. :D Done! :)
All of the above steps are in the Hardcore mods source code. "Just look at case 1002 - On Perception"
Sorry where's case 1002 - On Perception?
Also does anyone know what would be some good tutorials to start with in order to learn the stuff i'll need to know to make my own hardcore mod?
"nwnscript.nss for the functions you can use."
Yup I noticed that just recently and i've downloaded the indexed version of this in order to better find and use the functions it contains.
Thanks, you've all helped a lot. :D.
Sorry where's case 1002 - On Perception?
It's the part that has the ///////>>>>>>HARDCORE MOD V 1.0<<<<<<<<<</////////
in it... kind of hard to miss... :)
In regards to scripting, the best that can be offered in terms of advice is to look at Darth333's sticky thread and to read the current posts from others... it's one of those things that you pick up or you don't. C++ tutorials may also help give you gist of it.
I see also that Talchia forgot to include this bit in his/her code:
if(GN_GetSpawnInCondition( SW_FLAG_EVENT_ON_PERCEPTION) && GetLastPerceptionSeen())
{
SignalEvent(OBJECT_SELF, EventUserDefined(1002));
} that should be inserted right before this part }
break;
case 1003: just in case anybody was trying to create a user-defined event based for OnPerception in conjunction with this mod.
P.S. MightyM, please try to use those handy-dandy [ quote ] vbCode tags. They help the readability greatly.
Oh my goodness!!! I can't believe it. I thought the link to the K_AI_Master script that Darth333 posted was for the source of the original K_AI_Master script. It was actually for Talchia's very own hardcore mod!!!!
In fact it turns out that Talchia almost entirely copied the code from the K_Def_Buff.nss. This mod is going to be super easy now :D. I'll post it up here when i'm done but essentially it will mod NPC stats based on your character's level, so instead of upping npc stats when you get to a certain level it will check your current character level and then derive the stat boosts from that. Thus - an ever increasing difficulty.
Thanks all!!
it will mod NPC stats based on your character's level, so instead of upping npc stats when you get to a certain level it will check your current character level and then derive the stat boosts from that. Thus - an ever increasing difficulty.
Ok... I don't see the difference but sounds good! :D
Well i'm going to edit enemy stats based on your character level and the enemy's original stats. so e.g.
I might increase the enemy's dexterity by ncharlevel/10+1*the original dexterity of the enemy.
and there will be no condition of reaching a certain player level for it to take effect, it will simply always take effect.
I have one more question tho how can I find the original dexterity or any other stat of the targets of the Hardcore mod Script?
from nwscript.nss// 139: Get the ability score of type nAbility for a creature (otherwise 0)
// - oCreature: the creature whose ability score we wish to find out
// - nAbilityType: ABILITY_*
// Return value on error: 0
int GetAbilityScore(object oCreature, int nAbilityType);
So you might have something like this in your script...
int nSTR=GetAbilityScore(OBJECT_SELF, ABILITY_STRENGTH);
int nDEX=GetAbilityScore(OBJECT_SELF, ABILITY_DEXTERITY);
// etc...
Do you know how I can find the original force points of the object?
Your code example should work well for abilities, but Force points aren't an ability... so how would I do it?
Thanks for the help this project is moving along quite smoothly now :D.
EDIT: - just found this
// 56:
// returns the Max force points for the creature
int GetMaxForcePoints(object oObject=OBJECT_SELF);
Guess that answers my question :).
Another question: What's the difference between vitality points, and hitpoints? Are they one and the same?
You da' man MightyM. If you have any other script questions, feel free to post them. :) and yes they're the same. and gold=credits in scripting too.
Sweet, thanks man.
Another Question lol.
I'd love to be able to use a value from like a .ini file to modify the difficulty so that people who use the mod can make it easier or harder just by changing the value. 1.0 = normal, 1.2 = 20% harder 0.8 = 20% easier.
Is there any way to get a value out of a .ini file or other text format file?
Are you sure Talchia's Hardcore mod worked for every enemy? Because upon changing the stat boosts to noticably huge amounts I notice that some enemies on the Endar Spire (The first 10 or so) don't get the boosts, but the next 2 after them do.... could this be a pattern? I.e. What if it skips leveling up lots of other npcs? What do you think might be causing this erratic behaviour? Any ideas?
EDIT:
Well I added a graphical effect to show which objects get modded and it seems that there were a couple exceptions on the Endar Spire but that every other enemy and nuetral NPC gets the boosts. So that's cool.
Well you can't use an .ini file w/ scripts but you could have a dialog somewhere that sets a Global Variable that you can use. The dialog could be an armband so you take it with you and change it later. Or attach a branch to the Ebon Hawk or whatever your imagination can dream up.
Ah, that should work well, thanks.
Could someone explain to me a little of how KOTOR works? I mean the combat. What are saving throws? What's DC? Essentially what generally happens in a round of attacks - behind the scenes? I'd like to know this so I can feel comfortable about modifying the number of enemy saving throws and such. Thanks.
Also, does anyone know if there's a way to get past the limit on increasing a target's abilities? The game imposes a limit of 20 max extra of an attribute :(. I tried increasing the same ability more than once but the game just ignored it. (Wrote an if statment with a graphic effect to check the Ability of my target). Thanks all.
A good place to start would be to check the in-game feedback page. This should give you an idea as to what's heppening behind the scene.
Also I'm sure RedHawke might be able to give you a good explanation of what the mechanics are.
Originally posted by MightyM
Could someone explain to me a little of how KOTOR works? I mean the combat. What are saving throws? What's DC? Essentially what generally happens in a round of attacks - behind the scenes? I'd like to know this so I can feel comfortable about modifying the number of enemy saving throws and such. Thanks.
Also, does anyone know if there's a way to get past the limit on increasing a target's abilities? The game imposes a limit of 20 max extra of an attribute :(. I tried increasing the same ability more than once but the game just ignored it. (Wrote an if statment with a graphic effect to check the Ability of my target). Thanks all.
some quick and dirty
saving throw: happens when somebody casts a spell/uses a force power directed at you and it is a default attempt to resist the effects. this also aplies on resisting toxins and the sort.
dc=difficulty check: a DC is set anytime you are trying to overcome a challenge eg. opening a lock or hacking a computer. it used in saving throws and skill checks as well as when actually using a force power.
combat round: initiative; who attacks first or who responds first is more like it.
your action; shooting, melee attack, movement, force power, or some other action.
combat round resolution; self explanatory.
now to take a stat past the game inforced 20 you need equipment that enhances that. the highest effect that each piece of equipment can apply is 10 so if every piece of equipment gave a 10 and you have 2 weapons in hand and capped at 20 you could get a 110 max stat.
if you want to make enemies harder to defeat bumping up there saves will definetly do this as it will make it harder for your force powers to overcome there saving throw.
now to take a stat past the game inforced 20 you need equipment that enhances that. the highest effect that each piece of equipment can apply is 10 so if every piece of equipment gave a 10 and you have 2 weapons in hand and capped at 20 you could get a 110 max stat.
In theory you could hide these objects on the .utc by putting them into hidden equipment slots. For more information see this (
http://www.lucasforums.com/showthread.php?s=&postid=1502118#post1502118) thread.
Thanks darktender for the info :D.
About the adding equipment. This raises two issues.
The first one is, can I add equipment to NPCs using the on perception (Case 1002) of the K_AI_Master file? Will it take effect immediately?
And how many peices of equipment can I add? Can I add as many as I like or is this limited by a certain number of equipment slots that the AI has?
If I can add a lot of equipment then this would be ideal.
Originally posted by tk102
In theory you could hide these objects on the .utc by putting them into hidden equipment slots. For more information see this (
http://www.lucasforums.com/showthread.php?s=&postid=1502118#post1502118) thread.
I guess that means now that you mention it we could get up to 150 for an ability score(forgot those 4 slots.)
Ok suppose I wanted to add four pieces of equipment dynamically to each enemy using the K_AI_Master file. Would this be possible? How?
Use this function: (from nwscript.nss)
// 32: Equip oItem into nInventorySlot.
// - nInventorySlot: INVENTORY_SLOT_*
// * No return value, but if an error occurs the log file will contain
// "ActionEquipItem failed."
void ActionEquipItem(object oItem, int nInventorySlot, int bInstant=FALSE);
Example:
object oItemBooster1=CreateItemOnObject("uti_templateresref1");
object oItemBooster2=CreateItemOnObject("uti_templateresref2");
object oItemBooster3=CreateItemOnObject("uti_templateresref3");
object oItemBooster4=CreateItemOnObject("uti_templateresref4");
ActionEquipItem(oItemBooster1, INVENTORY_SLOT_CWEAPON_L, TRUE);
ActionEquipItem(oItemBooster2, INVENTORY_SLOT_CWEAPON_R, TRUE);
ActionEquipItem(oItemBooster3, INVENTORY_SLOT_CWEAPON_B, TRUE);
ActionEquipItem(oItemBooster4, INVENTORY_SLOT_CARMOUR, TRUE);
Remember, you'll have make sure these .uti files have BaseItem set to an entry in baseitems.2da whose EquipableSlots has a value that supports these slots.
Excellent. But what if a npc is using the slot I try to equip somthing in? Is there any slot that will equip more than one item? Can I ever count on a particular slot always existing for all NPCs and always being able to be equipped with my item?
(Ponders...)
Those slots I listed are pretty safe, but you never know...
but you have this function:
// 155: Get the object which is in oCreature's specified inventory slot
// - nInventorySlot: INVENTORY_SLOT_*
// - oCreature
// * Returns OBJECT_INVALID if oCreature is not a valid creature or there is no
// item in nInventorySlot.
object GetItemInSlot(int nInventorySlot, object oCreature=OBJECT_SELF);
so you could encapsulate the code in an IF statement like
if (!(GetIsObjectValid(GetItemInSlot( INVENTORY_SLOT_CWEAPON_L)))) {
ActionEquipItem(oItemBooster1, INVENTORY_SLOT_CWEAPON_L, TRUE);
}
It looks like very few NPCs use these slots. The ones that do like Canderous and HK47 only use the last of the 4 INVENTORY_SLOT_CARMOUR. It'll need further looking into, but if this is the case and I can depend on 3, and maybe even 4 slots free for all enemies.... man I could boost stats quite comfortably by as much as 30 or 40.
Thanks for the help. I'll probly have to ask a couple questions later in the week when I get around to adding the custom items and implementing the script that equips them into my new K_AI_Master file.
If I remember correctly, rackghouls also use them (poison effect). And perhaps a few other beasts too but I didn't checked.
Actually yea, I just noticed that. All beasts use them. They're usually equipped with claws. :(. The good news is that I haven't found an NPC that uses all 4 slots. Essentially i'll have to build some tricky logic into my script, but I can just get it to use whatever slots are free.
Fact is, beasts don't usually use the other slots (left right arm and hand, belt, head etc.) so I can just use these slots on the beasts to make up for the lack.
Better make your items completely invisible then, otherwise all the tachs and gizkas will be carrying stuff around on them. (Maybe... I don't know much about modeling.)
Yea, totally invisible. All I want them for is boosting stats, so why bother about a graphic? :) this is gonna be sweet.
Originally posted by tk102
Better make your items completely invisible then, otherwise all the tachs and gizkas will be carrying stuff around on them. (Maybe... I don't know much about modeling.)
Don't worry, you can give a lightsaber to a Gizka and although the Gizka will be able to bite harder, the lightsaber won't appear. remember my "morphing accident" with Jolee while I was having fun with force powers :D ?
http://img.photobucket.com/albums/v144/Darth333/PlayAsGizka.jpg)
Can you create an item that is equipable on more than one kind of slot? Say I wanted to make an item able to be equiped on every slot there is, would this be possible or would I need to make a new item for each kind of slot?
Sweet. How about modifying Charisma with items? How would I do this in the item properties area?
Strictly Speaking modifying Wisdom will have the same effect on an AI Jedi as modifying Charisma right? So I don't really need to modify Charisma as well?