Home » SIRTECH CLASSICS » Jagged Alliance: Unfinished Business » Tools and Guides Repository (Archive) » NPC scripting info
( ) 1 Vote
NPC scripting info[message #188151]
|
Tue, 10 June 2008 16:41
|
|
the scorpion |
![](/images/ranks/sergeant_major.png) |
Messages:1834
Registered:September 2004 Location: CH |
|
|
unfortunately, it seems that most of the precious findings previous modmakers have made about npc scripting are more or less lost.
there's a big gap resulting from all good scripters dropping out at some time without passing on the info, which means that everybody who wants to script has to reinvent the wheel.
yet this is dramatic becasue the scripts are the heart of ja2's story and npc interaction, key to the cut scenes, the characters to hire and sometimes the script even has further infuence on the behaviour of characters than we'd think.
I can't write a tutorial or walkthrough for scripting because it is very difficult to put it inot words abstractly, also, depending on what npc scripting programme we use, things look different anyway
so what i'm going to post is merely dropping some info to the forum in order for smart enough people to figure it. It is quite more demanding than other aspects of modmaking, so one should brace himself with a high frustration tolerance and a lot of patience and some serous abstract logical thinking capabilities.
Plus, i don't know much about it myself, so the more i write, the higher the chance i tell you guys something wrong.
there are a few programms, npc edit, npc.exe. some betas, the npc scripter (russian)
but of course they edit the same type of file so what they do in the end is the same, just the GUI differs.
in any case, the npc script is an assembly of single records.
records may differ according to if they're used at all, only once a dialogue, only on certain days... etc.
Records are ONE BIG "IF X ---> THEN Y" logical condition, split into an input/ conditions part and an ouput/ actions part
the different GUI's might show it differently.
let's look at general aspects that apply both to input and output first:
every progamme will have an entry whether or not the record in question is USED at all, or whether it is not used, used at specific days
every record has a byte that defines whether used just once, used once a record or used always.
while this is important, it is pretty self explanatory, depending on the programme, you'll have to find the right byte if it isn't labeled.
Some records might have to be at a special place inside the script in order to work: One example is when an RPC is being recruited for money after a yes/ no popup, the record where he joins seems to only work as record 1
also, not every record can just be shifted around inside the script. Some records are activated by hardcoded routines, one example is carlos. His record 1 is activated upon the player being beamed to the basement (see later the list of NPC actions)
Also, pop-ups, and especially the reaction to pop-ups are rather restrictive in this sense, they shoudl be left in place if you want to use them. it is rather difficult to activate popups beyond copy-pasting the entire script.
let's have a look at what the two parts of the scripts do
the input side:
several input conditions must be met to activate the output:
1. player/npc interaction
*edit* credits for all listings go to trailblazer, neyros and realist
[PCInput]
//--------------------------
1;Friendly approach
2;Direct approach
3;Threaten approach
4;Merc tries to recruit NPC
5;Repeat approach
6;NPC receives an item
7;NPC initiating conversation
8;NPC initial quote
9;NPC who are you
10;This record was triggered by another record or NPC
11;Approach giving first aid
12;Approach with special initial quote
13;Approach Enemy NPC quote
14;Approach declaration of hostility
15;Escorted PC in wrong sector
16;Escorted PC is recruited
17;Approach with initial quote
18;Shop is closing
19;Current sector is not safe
20;Finished slapping
21;Finished Punch_0
22;Finished Punch_1
23;Finished Punch_2
24;Finished opening object
25;Finished getting an item
26;Finished giving an item
27;Finished traversal
28;Approach to Buy/Sell
29;Friendly/Direct/Threaten/Recruit
30;Friendly/Direct/Recruit
[End]
these entries define at what kind of interaction the record is used. Some of these interactions are player-initiated, others are defined in other records of the npc's own script, such as 10 or 24-27
2. Leadership check
some interactions can be coupled with a check for leadership
note that the number given in the script is modified by the merc in question and the npc in question (see prof.dat) and might not always work ingame.
a leadership check only makes sense if a player-initiated input is used, obviously.
3. Active quests
[Quests]
//--------------
0;Deliver Letter
1;Food Route
2;Terrorists
3;Kingpin Chalice
4;Kingpin Money
5;Runaway Joey
6;Rescue Maria
7;Chitzena Chalice
8;Held in Alma
9;Interogation
10;Hillbilly Problem
11;Find Scientist
12;Deliver Video Camera
13;Blood Cats
14;Find Hermit
15;Creatures
16;Find Chopper Pilot
17;Escort SkyRider
18;Free Dynamo
19;Escort Tourists
20;Doreen
21;Leather Shop Dream
22;Escort Shank
23;[UB] Destory Missiles
24;[UB] Fix Laptop
25;[UB] Kill Bloodcats at Bettys
26;[UB] Find Musket For Raul
27;No 27 Yet
28;No 28 Yet
29;No 29 Yet
[End]
In the input side of the record in question, you may check for active quests. This has a similar effect as the global activation checks, if that quest isn't active, the record won't be used.
This on/ off switch can be used very nicely to have Questgiver NPC's behave different once their quests are finished. a typcial example in vanilla ja2 is auntie
Report message to a moderator
|
Sergeant Major
|
|
|
Goto Forum:
Current Time: Tue Feb 11 11:49:19 GMT+2 2025
Total time taken to generate the page: 0.01212 seconds
|