Jump to content

Home

Completely New Modder


Recommended Posts

Hey guys how goes it? I'm completely new to modding KOTOR and KOTOR TSL and was hopping I could get some pointers from some KOTOR Mod vets

 

Hi, welcome to the forums :wavey:

 

If you need pointers you should tell what kind of modding you are interested in doing. It's a pretty broad subject that's hard to speak generally of. :)

Link to comment
Share on other sites

Understood. Well I'm interested in scripting mostly, but I have no idea where to start, like I used to do some programming back in the day, but I just can't figure out what the variables are for, and what actions they make take place etc. I'm just kinda confused and don't know where to start

Link to comment
Share on other sites

Hey guys how goes it? I'm completely new to modding KOTOR and KOTOR TSL and was hopping I could get some pointers from some KOTOR Mod vets

 

Aha! A new member to prey on and terrorise help along the modders path! :xp:

 

Welcome to hell the forums! :xp:

 

Yeah, like stoffe said, modding is a pretty broad topic to cover generally.

 

You may want to find a particular area you enjoy working at (and can actually do well in) and work on that. Then move on to learn more skills in an area you're maybe not so good in.

 

The General Tutorials section at the top of HL is full of stuff to help new modders get to grips with things.

 

Good luck!

Link to comment
Share on other sites

Most common mistakes:

 

1. When making MOD files, remember to call them .mod and then place them in the MODULES folder, not the Override.

 

2. If you are replacing an item in the game, remember to keep the name the same and put it in the Override folder.

 

3. When replacing/modifying existing modules (with the .mod file), remember to keep the name of the module the same! (I had wasted so much time before realizing my mistake).

 

If you need any help, just ask, us at Holowan Laboratories will help with anything. You also have the tutorial boards (Scripting, .2da Editing, etc).

Link to comment
Share on other sites

Understood. Well I'm interested in scripting mostly, but I have no idea where to start, like I used to do some programming back in the day, but I just can't figure out what the variables are for, and what actions they make take place etc. I'm just kinda confused and don't know where to start

 

Go to the Scripting sub-board in Holowan Laboratories. You will find a lot of useful information there. If you still need help, browse the Source Scripts in KOTOR Tool. (BIFS>Scripts>... I think)

Link to comment
Share on other sites

Understood. Well I'm interested in scripting mostly, but I have no idea where to start, like I used to do some programming back in the day, but I just can't figure out what the variables are for, and what actions they make take place etc. I'm just kinda confused and don't know where to start

 

The scripting language used in the Kotor games is NWScript, a variant of what was used in Neverwinter Nights. As such many of the basics are the same, though there are some differences in how certain functions work, which functions are available etc. NWNLexicon is a very useful lookup reference for NWScript, though since it's for Neverwinter Nights you should keep the differences in mind while using it.

 

Your most useful reference when writing NWScripts is the nwscript.nss file which you can extract from the scripts.bif game data file with KotorTool. This file contains the global constants and prototypes for all the functions in the scripting language, with their return values, what parameters they take etc. Most of the functions also have a short comment on what they do.

 

The basic syntax of the scripting language is somewhat similar to C in how variables and functions are declared, loops and conditions are written etc.

 

Hmm, what more to say, it's a rather broad subject as well so it's hard to touch on everything without knowing what you want to do. Off the top of my head:

 

[align=center] * * *[/align]

 

One concept that can be a bit confusing at first is Actions, and how they differ in execution compared to normal scripting functions/commands. Normal scripting functions are executed sequentially, where the first has to finish before moving onto the second. Actions on the other hand are assigned to an object and placed in the Action queue for this object, to be executed whenever that object gets around to it, while the script itself moves on with the next instruction. The name of Action functions have the Action prefix, like ActionMoveToObject(), making them easy to recognize.

 

Not all objects have action queues, but as far as I remember at least creatures (duh) and placeables do. An Action assigned to an object's action queue is added at the end of the queue, and will stay there until either it gets executed, or the queue is cleared by theClearAllActions() function run on that object.

 

A example of this, illustrating a common misunderstanding I've seen here sometimes (code comments start with // and are in green):

void main() {
   object   oNPC1 = GetObjectByTag("SomeNPC");   [color=PaleGreen]// Get reference to an object in the game world[/color]
   location lLoc  = GetLocation(oNPC1);          [color=PaleGreen]// Get location of the NPC in the game world[/color]
   effect   eVis  = EffectVisualEffect(3009);    [color=PaleGreen]// Create a Visual effect from row label 3009 in visualeffects.2da[/color]

   [color=PaleGreen]// Action, move the creature running the script (OBJECT_SELF) to the object with the tag "SomeNPC"[/color]
   ActionMoveToObject(oNPC1);    
   [color=PaleGreen]// Action, make the creature running the script pause for 2 seconds before executing the next
   // action in their queue. [/color]    
   ActionWait(2.0);
   [color=PaleGreen]// Action, make the creature running the script do the taunt animation[/color]    
   ActionPlayAnimation(ANIMATION_FIREFORGET_TAUNT);  
   [color=PaleGreen]// Command, apply the visual effect declared above at the location of "SomeNPC".[/color]
   ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eVis, lLoc);
}

 

A simple script that would make the object running the script (which would have to be a creature since placeables can't move) move to the NPC in the game world who has the tag SomeNPC and pause briefly before doing the taunt animation, and display a grenade explosion at SomeNPC's location.

 

This script would make the creature running the script move to SomeNPC, pause for 2 seconds when they arrive and then play the taunt animation. It would however display the grenade explosion visual effect at SomeNPC's location immediately when the script is run, since the last line is a command, not an action. ActionWait() does not pause execution of the script, it places an action in the action queue that does nothing for the specified duration before the object moves on to the next action in the queue.

 

In cases where this is undesirable normal scripting commands which do not return a value (void) can be assigned to the action queue of an object using the ActionDoCommand() action wrapper. Even your own custom scripting functions can be run from the action queue of an object this way.

 

[align=center] * * *[/align]

 

The above example also touches briefly on another core concept of NWScript: effects. Effects are (usually) in-game conditions you can apply to an object (or in some cases a location) to make something happen. Effects are used to damage or heal characters, show visual effects, temporarily give bonuses or penalties to characters stats, abilities, inflict status effects on characters etc. Force powers, grenades and med-kits are some of the most obvious in-game example of effects at work.

 

Effects first have to be created using one of the effect constructor functions. These always have the Effect prefix, like EffectHeal() or EffectParalyze(). A created effect doesn't do anything on its own however, it needs to be applied to something to take effect. This is done using the ApplyEffectToObject() or ApplyEffectAtLocation() functions.

 

Once an effect is applied to an object it will stay on that object for the duration (in seconds) specified to either of those functions, or remain permanently (DURATION_TYPE_PERMANENT). Some effects, like damage or fire and forget visual effects, have no duration and need to be applied with a DURATION_TYPE_INSTANT duration parameter instead.

 

You can check for the presence of an effect on an object via scripts as well, and you can iterate through all the effects applied to an object using the GetFirstEffect() and GetNextEffect() functions. An effect applied to an object (usually retrieved by iterating through present effects) can be removed using the RemoveEffect() function, or all effects (both beneficial and detrimental) can be purged from an object using ClearAllEffects() function.

 

[align=center] * * *[/align]

 

Hmm, this is getting pretty long. :) There's a lot more to scripting than that, but those are some important things to keep in mind at least. If you're wondering if anything more specific, please ask. :)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...