Note: LucasForums Archive Project
The content here was reconstructed by scraping the Wayback Machine in an effort to restore some of what was lost when LF went down. The LucasForums Archive Project claims no ownership over the content or assets that were archived on archive.org.

This project is meant for research purposes only.

Help with scripts!

Page: 1 of 1
 SithRevan
09-10-2006, 11:43 PM
#1
Hi, I was just wondering if somebody could help me with some scripting. I am having trouble with the random loot script, and I am having trouble with making two NCP's look like they are having a conversation. So if you guys could help me with those things I would really appreciate it, Thanks!
 goldberry
09-11-2006, 1:48 AM
#2
Hi, I was just wondering if somebody could help me with some scripting. I am having trouble with the random loot script, and I am having trouble with making two NCP's look like they are having a conversation. So if you guys could help me with those things I would really appreciate it, Thanks!

Random Loot is: k_inc_treasure.ncs, and k_inc_treas_k2.ncs

NPCs chatting is:

void main() {
ActionStartConversation(GetFirstPC(),"dlg_filenamehere");
}

and then use only the [OWNER] fields in the dialog editor, changing the participant tags to match your two NPCs in turn. Please say if this is not what you wanted. I'm not Stoffe, after all :D:D:D
 SithRevan
09-11-2006, 3:33 AM
#3
Thanks for the help but actually I was wondering where the random loot script is supposed to go, is it supposed to go in the containers script section or is it supposed to go somewhere else. Also I want the NCP's to just look like they are talking, I don't actually want them to have dielog when they are talking to each other. Sorry for being so picky and not giving enough info initially!:D
 stoffe
09-11-2006, 5:48 AM
#4
Random Loot is: k_inc_treasure.ncs, and k_inc_treas_k2.ncs


Those are the include files that contains most of the random loot script code. However, being include files merely changing those will not do anything since you can't compile include files and the game never uses them directly.

In order to affect any change on the random loot you will need to recompile (using your modified include files) all the scripts that use those include files, and there are quite a few. The global scripts with ResRefs starting with k_plc_, found in scripts.bif spawn the random loot in most containers (though there are a few module-specific ones as well for special containers in a number of places). In addition, the global script k_contain_unlock should also be recompiled (it spawns extra loot in a bashable container if it is unlocked rather than bashed).

To change random loot given as quest rewards and such you'll need to recompile those scripts. Module specific scripts aside there are a few global scripts used for a number of quests: a_give_quest_ls and a_give_q_reward.

To change the random loot dropped by killed enemies you will need to recompile their OnSpawn event scripts, since this is where the loot spawning is usually done. The k_def_spawn01 AI script is used by many characters as spawn script, though unfortunately many NPCs and creatures have unique, module-specific spawn scripts that you will need to carefully merge if you plan to recompile and put those in override to avoid naming conflicts since those scripts are not always uniquely named. Other global OnSpawn AI scripts are k_def_ambmobtrea, k_def_grenspn and a whole bunch of scripts with ResRefs starting with k_def_spn_.

I was wondering where the random loot script is supposed to go, is it supposed to go in the containers script section


The random loot spawn scripts for placeable containers are usually put in the OnHeartbeat event of the container. This causes all the loot to be spawned into the level when the player first enters to prevent "Open container + Reload save" exploits to get different loot every time you open a container. Those heartbeat scripts generally only run once; they spawn the loot and then remove themselves.


Also I want the NCP's (non-character players?) to just look like they are talking, I don't actually want them to have dielog when they are talking to each other. Sorry for being so picky and not giving enough info initially!:D

If you mean speaking with "floating bubbles" over their heads instead of cutscene/dialog mode there are two ways of doing this that I am aware of.
You can lay out the entire "conversation" in a script using delayed BarkString() function calls. The disadvantage of doing this is that the script can get quite large if it's a long conversation, and you have to manually handle everything in the script that dialog files usually do for you (delays between barks etc). The largest disadvantage is that BarkString() won't take string constants, thus your text must be added to the dialog.tlk file.


Alternatively you can use normal DLG files for this. A dialog branch with only one entry will be "barked" with a speech bubble instead of going into dialog mode. Thus you can add all the conversation lines as entries under the root node (instead of building a dialog tree as usual) and then have a conditional script on each entry to check what "stage" the conversation is in to determine which entry should be used. Each entry would also have an Action script that increments the Stage (a LocalNumber would work to keep track of the stage) and re-starts the conversation to make the next entry show.
Page: 1 of 1