Prime Posted March 15, 2005 Share Posted March 15, 2005 This just popped into my head, but has anyone tried altering the weapon that an NPC uses? I'm wondering if it would be possible/not a pain to change some of the Sith Assassins to Dark Jedi... Link to comment Share on other sites More sharing options...
tk102 Posted March 15, 2005 Share Posted March 15, 2005 I could see it done with a script injected into the .are OnEnter event. Most of the functions required are variations of the ones listed in the Frequently Used Script Functions thread. That way you wouldn't have to mess with .utc files or the .git file directly. Link to comment Share on other sites More sharing options...
beancounter Posted March 16, 2005 Share Posted March 16, 2005 If you are messing around with the Sith Assassins you might as well give them some Force Powers as well! Use the GrantSpell function in your script. Then set the AI to actually use the powers! include the following lines of code: #include "k_inc_generic" void main () { ...... Put your code here .... giveitem XXX equipitem GrantSpell XXXX int NPC_AI = GetNPCAIStyle(OBJECT_SELF); if(NPC_AI == NPC_AISTYLE_DEFAULT_ATTACK || NPC_AI == NPC_AISTYLE_RANGED_ATTACK || NPC_AI == NPC_AISTYLE_MELEE_ATTACK || NPC_AI == NPC_AISTYLE_GRENADE_THROWER) { GN_SetSpawnInCondition(SW_FLAG_BOSS_AI); } } You will not be able to use OBJECT_SELF, you will have to use the tag of the Sith Assassin. I have been playing with this for the next version of the Hardcore mod, and it is a lot of fun! Link to comment Share on other sites More sharing options...
Ellderon Posted March 16, 2005 Share Posted March 16, 2005 Originally posted by Prime This just popped into my head, but has anyone tried altering the weapon that an NPC uses? I'm wondering if it would be possible/not a pain to change some of the Sith Assassins to Dark Jedi... I think it might be done trough Templates->Creatures as there is one template fiule for each creature type. Thus, there is a template for a Mandalorian soldier, Mandalorian Elite and Mandalorian Commander - and any mandalorian in-game (except some special ones) calls in one of these three files. the same is for sith assasins and Dark Jedi.. Link to comment Share on other sites More sharing options...
Sivy Posted March 16, 2005 Share Posted March 16, 2005 that would be great if you could give a few of the assassins lightsabers. just make sure you can't pick up their lightsabers after you kill them, cause that might mess the game up. Link to comment Share on other sites More sharing options...
Ellderon Posted March 16, 2005 Share Posted March 16, 2005 I checked. There is a creatuer template file for EVERYONE you encounter. The special NPC have their own template while generic republic/sith/madalorian/civy/creture share a single one. You could indeed add a lightsabre to assasins. Link to comment Share on other sites More sharing options...
tk102 Posted March 16, 2005 Share Posted March 16, 2005 Don't forget to add lightsaber proficiency as well or they won't be able to use them. There is a danger to reusing .utc files in your override. Many templateresref fields are duplicated throughout the game but are module-level to keep them unique. When you place a .utc in the override, you override all of throughout the game. Use FindRefs to discover all the instances of any .utc you wish to override. Chances are you'll be overriding more than you want. Link to comment Share on other sites More sharing options...
Sivy Posted March 16, 2005 Share Posted March 16, 2005 Originally posted by Ellderon I checked. There is a creatuer template file for EVERYONE you encounter. The special NPC have their own template while generic republic/sith/madalorian/civy/creture share a single one. You could indeed add a lightsabre to assasins. does that mean that all the assassins would have lightsabers? that would make the Harbinger a tad tricky. Link to comment Share on other sites More sharing options...
Darth333 Posted March 16, 2005 Share Posted March 16, 2005 Originally posted by Sivy does that mean that all the assassins would have lightsabers? that would make the Harbinger a tad tricky. No, I fact, I strongly discourage editing .utc files for the reasons explained by tk102. You'll find more details in this thread (But Prime already knows this too well ) Beancounter's method is definitely the way to go. Beancounter, instead of using the tag of each object you could also use the GetApperance (or something like this - I donN't have nwscript.nss with me) function to define the object so that if Sith Assassins have different tags, you don't have to look for them. Link to comment Share on other sites More sharing options...
Prime Posted March 16, 2005 Author Share Posted March 16, 2005 Originally posted by Darth333 No, I fact, I strongly discourage editing .utc files for the reasons explained by tk102. You'll find more details in this thread (But Prime already knows this too well ) I definitely know that all too well. What a nightmare that was... Originally posted by Darth333 Beancounter's method is definitely the way to go. Beancounter, instead of using the tag of each object you could also use the GetApperance (or something like this - I donN't have nwscript.nss with me) function to define the object so that if Sith Assassins have different tags, you don't have to look for them. I'll start looking in that direction. I'm not even looking at changing every single assassin, but at least I'd like to change some of the later ones so that there is an excuse to use your saber skills. Alternatively, would it be possible to change some of the assassins in certain modules to be other creatures like Dark Jedi (which presumably would already work as is as a lightsaber foe)? Would that be better than altering the assassins to wield lightsabers? Link to comment Share on other sites More sharing options...
tk102 Posted March 16, 2005 Share Posted March 16, 2005 Alternatively, would it be possible to change some of the assassins in certain modules to be other creatures like Dark Jedi (which presumably would already work as is as a lightsaber foe)? Would that be better than altering the assassins to wield lightsabers? It is possible. However, you'll find it is more difficult to replace a creature than modify an existing one. To truly replace a creature, you'll have to modify the .git file and repack or you'll have to override the .utc (danger!). Script-wise, you would DestroyObject on the pre-existing creature and CreateObject to spawn a new creature. This is relatively simple and you can create a unique .utc file in your override that has all the equipment and abilities predetermined. Link to comment Share on other sites More sharing options...
Darth333 Posted March 16, 2005 Share Posted March 16, 2005 If you only change the apppearance with a script, you will have to add the new feats anyways. Otherwise, you would have to use the destroy object function when you enter a module and spawn new npcs with the feats and force powers you want... just make sure you don't destroy the wrong npc. If you really want to change the appearance no matter what, you could replace the OnEnter script of the area by something like this: void main () { object oTarget = GetFirstObjectInArea(GetArea(OBJECT_SELF), OBJECT_TYPE_CREATURE); while(GetIsObjectValid(oTarget)) { //replace int nAppearance by the corresponding row number from appearance.2da if(GetAppearanceType(oTarget) == int nAppearance) { //insert the corresponding row number from appearance.2da ChangeObjectAppearance( oTarget, [i]int nAppearance[/i] ); } oTarget = GetNextObjectInArea(GetArea(OBJECT_SELF), OBJECT_TYPE_CREATURE); } ExecuteScript("old_on_enter_script", GetModule()); } edit: tk102 beats me again (j/k ) But you gave a script and outdo me again j/k tk102 Link to comment Share on other sites More sharing options...
Prime Posted March 16, 2005 Author Share Posted March 16, 2005 OK, it looks like replacing them outright is not really worth it. I kind of like the idea of changing some of the appearances, even though my primary goal is to just give some of the assassins lightsabers. I assume that the model and textures for the dark jedi in KOTOR (with the hood and covered mouth) are still there. It might be pretty cool to change some assassins in this manner... Looks like I have to refresh my memory for the scripting stuff. Link to comment Share on other sites More sharing options...
Ellderon Posted March 17, 2005 Share Posted March 17, 2005 Originally posted by Prime I definitely know that all too well. What a nightmare that was... I'll start looking in that direction. I'm not even looking at changing every single assassin, but at least I'd like to change some of the later ones so that there is an excuse to use your saber skills. Alternatively, would it be possible to change some of the assassins in certain modules to be other creatures like Dark Jedi (which presumably would already work as is as a lightsaber foe)? Would that be better than altering the assassins to wield lightsabers? As far as I know there are several Sith Assasin template files - just like there are for normal, elitte and commander Mandalorian - ion other words for them of different strength/level. I think the stronger Sithg assasins are used later on, so if you change just tham, the first stih assasins would use normal weapons, the stronger ones would use lightsabres.. I THINK... Link to comment Share on other sites More sharing options...
stoffe Posted March 17, 2005 Share Posted March 17, 2005 Originally posted by Darth333 (snip) If you really want to change the appearance no matter what, you could replace the OnEnter script of the area by something like this: void main () { object oTarget = GetFirstObjectInArea(GetArea(OBJECT_SELF), OBJECT_TYPE_CREATURE); while(GetIsObjectValid(oTarget)) { if(GetAppearanceType(oTarget) == "insert_appearance_here") { //insert the corresponding row number from appearance.2da ChangeObjectAppearance( oTarget, [i]int nAppearance[/i] ); } oTarget = GetNextObjectInArea(GetArea(OBJECT_SELF), OBJECT_TYPE_CREATURE); } ExecuteScript("old_on_enter_script", GetModule()); } Perhaps it is nitpicking, but if its an OnAreaEnter script, it's probably better to use OBJECT_SELF rather than GetArea(OBJECT_SELF) in the iterator since its the area object that runs the script already. Also, the ExecuteScript statement might cause trouble if the original script uses OBJECT_SELF to refer to the area, since OBJECT_SELF refer to the module object if you use GetModule() to set the object to run the script. ExecuteScript("old_on_enter_script", OBJECT_SELF) would probably be safer to use there as well, to make the area to run the script. Link to comment Share on other sites More sharing options...
beancounter Posted March 18, 2005 Share Posted March 18, 2005 Originally posted by stoffe -mkb- Perhaps it is nitpicking, but if its an OnAreaEnter script, it's probably better to use OBJECT_SELF rather than GetArea(OBJECT_SELF) in the iterator since its the area object that runs the script already. Also, the ExecuteScript statement might cause trouble if the original script uses OBJECT_SELF to refer to the area, since OBJECT_SELF refer to the module object if you use GetModule() to set the object to run the script. ExecuteScript("old_on_enter_script", OBJECT_SELF) would probably be safer to use there as well, to make the area to run the script. Thanks for the tip! I take you have done some scripting with NWN? Link to comment Share on other sites More sharing options...
stoffe Posted March 18, 2005 Share Posted March 18, 2005 Originally posted by beancounter Thanks for the tip! I take you have done some scripting with NWN? Yes, I've done some mods for NWN and partially rewritten its combat AI to be a little less braindead. Since the scripting language is pretty much the same in KotOR/TSL it's not too difficult to make the leap to mod these games too. Link to comment Share on other sites More sharing options...
Prime Posted March 19, 2005 Author Share Posted March 19, 2005 Originally posted by tk102 I could see it done with a script injected into the .are OnEnter event. Can you refresh my memory on how to determine which script in a specific module is executed on the OnEnter event? I've done it before, but it has been a while. Link to comment Share on other sites More sharing options...
Xcom Posted March 19, 2005 Share Posted March 19, 2005 Originally posted by Prime Can you refresh my memory on how to determine which script in a specific module is executed on the OnEnter event? I've done it before, but it has been a while. I think you can just check ARE file for a specific module/area in GFFEdit. It has OnEnter field where a script name can be specified. Link to comment Share on other sites More sharing options...
Prime Posted March 19, 2005 Author Share Posted March 19, 2005 Ah, thanks. I didn't have GFFEdit in the same directory as the kotor_tool. Link to comment Share on other sites More sharing options...
Prime Posted April 13, 2005 Author Share Posted April 13, 2005 Sorry to revive and old thread, but I figured this was the best place for it (and besides, us moderators can do whatever we want ). Now that I'm finished my other mods I am once again looking at creating more lightsaber wielding enemies. As was discussed before I'm looking at changing some of the assassins later in the game to Dark Jedi. I'm not at home right now so I can't check for sure, but I seem to remember that there are several different assassin entries in appearance.2da. To change the appearance of some assassins, it is probably easiest to just alter some of the entries to change them to look like Dark Jedi. I'll look into that more later to see if this is really the case. The next part is to give the assassins lightsabers and powers and the ability to use them. I haven't had a chance to try this out yet, but here is the start of a script to do so: void main() { // get the first creature object oCreature = GetFirstObjectInArea(OBJECT_SELF, OBJECT_TYPE_CREATURE); // check that this creature is valid while(GetIsObjectValid(oCreature) { // see if the creature is a Sith Assassin. I assume this is the // appearance.2da row number? if(GetAppearanceType(oCreature) == "sithassassindude") { // give the desired properties // give the assassin some force powers GrantSpell(FORCE_POWER_FORCE_PUSH, oCreature); GrantSpell(FORCE_POWER_LIGHTNING, oCreature); GrantSpell(FORCE_POWER_CHOKE, oCreature); // give the assassin lightsaber proficiency and focus GrantFeat(FEAT_WEAPON_PROFICIENCY_LIGHTSABER, oCreature); GrantFeat(FEAT_WEAPON_FOCUS_LIGHTSABER, oCreature); // give the assassin a lightsaber ActionGiveItem(BASE_ITEM_LIGHTSABER, oCreature); // have the assassin equip the lightsaber // What is the best function for this? } oCreature = GetNextObjectInArea(OBJECT_SELF, OBJECT_TYPE_CREATURE); } // now do all the original setup ExecuteScript("old_onenter_script", OBJECT_SELF); } As you can see I have a few questions: - GetAppearanceType() returns the value of the creature's entry in appearance.2da, correct? - after granting the creature force powers, is there anything extra I have to do so that it will use them? At first glance I didn't see anything to do that. - How would I specify the colour the lightsaber should be? - How would I get the assassin to equip the lightsaber? ActionEquipItem seems to be intended for the PC to equip the specified item. Is there another that specifies a target? - Do I have to do anything else here so that the assassin will use the lightsaber? I assume that the AI is already set for melee fighting. Thanks for any insight and suggestions. Link to comment Share on other sites More sharing options...
Darth333 Posted April 13, 2005 Share Posted April 13, 2005 Change this line object oCreature = GetFirstObjectInArea(OBJECT_SELF, OBJECT_TYPE_CREATURE); for this one: object oCreature= GetFirstObjectInArea (GetArea(OBJECT_SELF), OBJECT_TYPE_CREATURE); This is what I use to equip a npc with a new weapon: void main () { object oWeapon = GetItemInSlot(INVENTORY_SLOT_RIGHTWEAPON ,oCreature); object oNewweapon = CreateItemOnObject("insert_weapon_template_here",oCreature); if (GetIsObjectValid (oWeapon)) { DestroyObject(oWeapon); } AssignCommand(oCreature, ActionEquipItem(oNewweapon, INVENTORY_SLOT_RIGHTWEAPON)); } I believe it is not necessary to destroy the old weapon but I never tried as I always used the script on party members and wanted to destroy the old weapon (some others mentionned that it works) - GetAppearanceType() returns the value of the creature's entry in appearance.2da, correct? Correct. - after granting the creature force powers, is there anything extra I have to do so that it will use them? At first glance I didn't see anything to do that. Make sure they have a jedi class. I am not sure you have to change the AI scripts: I don't have the game with me either and I never tried it. - How would I specify the colour the lightsaber should be? I think the script above answers the question : They have different templates. Sorry to revive and old thread, but I figured this was the best place for it (and besides, us moderators can do whatever we want )yeah I nearly closed your thread (j/k) Link to comment Share on other sites More sharing options...
Prime Posted April 13, 2005 Author Share Posted April 13, 2005 Originally posted by Darth333 This is what I use to equip a npc with a new weapon: void main () { object oWeapon = GetItemInSlot(INVENTORY_SLOT_RIGHTWEAPON ,oCreature); object oNewweapon = CreateItemOnObject("insert_weapon_template_here",oCreature); if (GetIsObjectValid (oWeapon)) { DestroyObject(oWeapon); } AssignCommand(oCreature, ActionEquipItem(oNewweapon, INVENTORY_SLOT_RIGHTWEAPON)); } I believe it is not necessary to destroy the old weapon but I never tried as I always used the script on party members and wanted to destroy the old weapon (some others mentionned that it works) Correct. Yeah, I wouldn't think you'd need to destroy it. But that helps me equip it. Originally posted by Darth333 Make sure they have a jedi class. I am not sure you have to change the AI scripts: I don't have the game with me either and I never tried it. Is there a way to alter or add a class through scripting? If not, I may have to do without the force powers. It would be disappointing, but that is not my main goal. Link to comment Share on other sites More sharing options...
Darth333 Posted April 13, 2005 Share Posted April 13, 2005 Originally posted by Prime Is there a way to alter or add a class through scripting? If not, I may have to do without the force powers. It would be disappointing, but that is not my main goal. Read the stickies http://lucasforums.com/showthread.php?s=&threadid=143412 How can I multiclass a character into a Jedi? code:/*possible classes: CLASS_TYPE_SOLDIER CLASS_TYPE_SCOUT CLASS_TYPE_SCOUNDREL CLASS_TYPE_JEDIGUARDIAN CLASS_TYPE_JEDICONSULAR CLASS_TYPE_JEDISENTINEL CLASS_TYPE_COMBATDROID CLASS_TYPE_EXPERTDROID CLASS_TYPE_MINION */ AddMultiClass( CLASS_TYPE_JEDIGUARDIAN, GetObjectByTag("Mission")); [/size] more classes for TSL: CLASS_TYPE_TECHSPECIALIST CLASS_TYPE_JEDIWEAPONMASTER CLASS_TYPE_JEDIMASTER CLASS_TYPE_JEDIWATCHMAN CLASS_TYPE_SITHMARAUDER CLASS_TYPE_SITHASSASSIN CLASS_TYPE_SITHLORD Link to comment Share on other sites More sharing options...
stoffe Posted April 13, 2005 Share Posted April 13, 2005 Originally posted by Prime - after granting the creature force powers, is there anything extra I have to do so that it will use them? At first glance I didn't see anything to do that. It would probably help to change their AI style to make them use force powers, and set them to use the Boss AI to make them use them more often: SetNPCAIStyle(oCreature, NPC_AISTYLE_JEDI_SUPPORT); SetLocalBoolean(oCreature, SW_FLAG_BOSS_AI, TRUE); (The SW_FLAG_BOSS_AI global is set in k_inc_generic so you'd either need to include that file, or just copy its value from there instead.) Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.