#188151 - 10 June, 2008 04:41 PM
NPC scripting info
|
 General
Posts: 5492
Loc: CH
______
BANNED
|
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
|
- OFFLINE
Top
|
|
|
|
#188157 - 10 June, 2008 04:59 PM
Re: NPC scripting info
[Re: the scorpion]
|
 General
Posts: 5492
Loc: CH
______
BANNED
|
3. Item in the inventory of the NPC (Npc gets item, npc has item)
the input side may also check for an item in the possession of the NPC. This is especially important to prevent a crash that happens when an NPC tries to give an item he in fact doesn't have
it is also used in conjunction with the player input "npc receives an item" in pretty much any item-related quest
The game can use numbers beyond 350 for this purpose, so you can use 1.13's items.xml entries too
in one of the GUI's, this part is coupled to the next section, check for Grid
4. Npc stands on a grid
This check not only allows for an on/ off switch like previous checks, it also allows to script movement. Characters can move to specific places in the sector where they can do other actions. One example is fatima who walks over grids defined in her script. This part of the input script can check whether an NPC has reached the grid in question and then continue the path or the action.
5. triggers true, triggers false
[Triggers] // These triggers are used universally for both True, False and Set situations. // ------------- 0;Omerta Liberated 1;Drassen Liberated 2;Sanmona Liberated 3;Cambria Liberated 4;Alma Liberated 5;Grumm Liberated 6;Tixa Liberated 7;Chitzena Liberated 8;Estoni Liberated 9;Balime Liberated 10;Orta Liberated 11;Meduna Liberated 12;Pacos approched 13;Fatima Read note 14;Fatima Walked away from player 15;Dimitri (#60) is dead 16;Fatima responded to Dimitri's supprise 17;Carlo's exclaimed 'no one moves' 18;Fatima described note 19;Fatima arrives at final dest 20;Dimitri said Fatima has proof 21;Miguel overheard conversation 22;Miguel asked for letter 23;Miguel read note 24;Ira comment on Miguel reading note 25;Rebels are enemies 26;Fatima spoken to before given note 27;Start Drassen quest 28;Miguel offered Ira 29;Pacos hurt/Killed 30;Pacos is in A10 31;Current Sector is safe 32;Bobby Ray's Shipment in transit 33;Bobby Ray's Shipment in Drassen 34;33 is TRUE and it arrived within 2 hours 35;33 is TRUE 34 is false more then 2 hours 36;Player has realized part of shipment is missing 37;36 is TRUE and Pablo was injured by player 38;Pablo admitted theft 39;Pablo returned goods, set 37 false 40;Miguel will join team 41;Gave some cash to Pablo 42;Skyrider is currently under escort 43;Skyrider is close to his chopper in Drassen 44;Skyrider explained deal 45;Player has clicked on Heli in Mapscreen at least once 46;NPC is owed money 47;Npc is wounded 48;Npc was wounded by Player 49;Father was told of food shortage 50;Ira is not in sector 51;Ira is doing the talking 52;Food quest over 53;Pablo stole something from last shipment 54;Last shipment crashed 55;Last shipment went to wrong airport 56;24 hours elapsed since notified that shipment went to wrong airport 57;Lost package arrived with damaged goods. 56 to False 58;Lost package is lost permanently. Turn 56 False 59;Next package can (random) be lost 60;Next package can (random) be delayed 61;Package is medium sized 62;Package is largesized 63;Doreen has conscience 64;Player Spoke to Gordon 65;Ira is still npc and in A10-2(hasn't joined) 66;Dynamo asked for first aid 67;Dynamo can be recruited 68;Npc is bleeding 69;Shank wants to join 70;NPC is bleeding 71;Player Team has head & Carmen in San Mona 72;Player Team has head & Carmen in Cambria 73;Player Team has head & Carmen in Drassen 74;Father is drunk 75;Player has wounded mercs within 8 tiles of NPC 76;1 & only 1 merc wounded within 8 tiles of NPC 77;More then 1 wounded merc within 8 tiles of NPC 78;Brenda is in the store 79;Brenda is Dead 80;Brenda is at home 81;NPC is an enemy 82;Speaker Strength >= 84 and < 3 males present 83;Speaker Strength >= 84 and at least 3 males present 84;Hans lets ou see Tony 85;Hans is standing on 13523 86;Tony isnt available Today 87;Female is speaking to NPC 88;Player has enjoyed the Brothel 89;Carla is available 90;Cindy is available 91;Bambi is available 92;No girls is available 93;Player waited for girls 94;Player paid right amount of money 95;Mercs walked by goon 96;More thean 1 merc present within 3 tiles of NPC 97;At least 1 merc present withing 3 tiles of NPC 98;Kingping expectingh visit from player 99;Darren expecting money from player 100;Player within 5 tiles and NPC is visible 101;Carmen is in San Mona 102;Player Spoke to Carmen 103;KingPin knows about stolen money 104;Player gave money back to KingPin 105;Frank was given the money ( not to buy booze ) 106;Player was told about KingPin watching fights 107;Past club closing time and Darren warned Player. (reset every day) 108;Joey is EPC 109;Joey is in C5 110;Joey is within 5 tiles of Martha(109) in sector G8 111;Joey is Dead! 112;At least one player merc within 5 tiles of Martha 113;Spike is occuping tile 9817 114;Angel offered vest 115;Angel sold vest 116;Maria is EPC 117;Maria is EPC and inside leather Shop 118;Player wants to buy vest 119;Maria rescue was noticed by KingPin goons and Kingpin now enemy 120;Angel left deed on counter 121;Maria quest over 122;Player bandaged NPC today 123;Doreen revealed allegiance to Queen 124;Pablo should not steal from player 125;Player shipment arrived but loyalty to low, so it left 126;Helicopter is in working condition 127;Player is giving amount of money >= $1000 128;Player is giving amount less than $1000 129;Waldo agreed to fix helicopter( heli is damaged ) 130;Helicopter was destroyed 131;Waldo told us about heli pilot 132;Father told us about Deidranna killing sick people 133;Father told us about Chivaldori family 134;Father told us about creatures 135;Loyalty is OK 136;Loyalty is Low 137;Loyalty is High 138;Player doing poorly 139;Player gave valid head to Carmen 140;Current sector is G9(Cambria) 141;Current sector is C5(SanMona) 142;Current sector is C13(Drassen 143;Carmen has at least $10,000 on him 144;Player has Slay on team for over 48 hours 145;Carmen is suspicous about slay 146;Slay is in current sector 147;Carmen gave us final warning 148;Vince has explained that he has to charge 149;Vince is expecting cash (reset everyday) 150;Player stole some medical supplies once 151;Player stole some medical supplies again 152;Vince can be recruited 153;Vince is currently doctoring 154;Vince was recruited 155;Slay offered deal 156;All terrorists killed 158;Maria left in wrong sector 159;Skyrider left in wrong sector 160;Joey left in wrong sector 161;John left in wrong sector 162;Mary left in wrong sector 163;Walter was bribed 164;Shank(67) is part of squad but not speaker 165;Maddog spoken to 166;Jake told us about shank 167;Shank(67) is not in sector 168;Bloodcat quest on for more than 2 days 169;Effective threat made to Armand 170;Queen is DEAD! 171;Speaker is with Aim or Aim person on squad within 10 tiles 172;Current mine is empty 173;Current mine is running out 174;Loyalty low in affiliated town (low mine production) 175;Creatures invaded current mine 176;Player LOST current mine 177;Current mine is at FULL production 178;Dynamo(66) is Speaker or within 10 tiles of speaker 179;Fred told us about creatures 180;Matt told us about creatures 181;Oswald told us about creatures 182;Calvin told us about creatures 183;Carl told us about creatures 184;Chalice stolen from museaum 185;John(118) is EPC 186;Mary(119) and John (11 are EPC's 187;Mary(119) is alive 188;Mary(119)is EPC 189;Mary(119) is bleeding 190;John(118) is alive 191;John(118) is bleeding 192;John or Mary close to airport in Drassen(B13) 193;Mary is Dead 194;Miners placed 195;Krott planning to shoot player 196;Madlab explained his situation 197;Madlab expecting a firearm 198;Madlab expecting a video camera. 199;Item condition is < 70 200;Madlab complained about bad firearm. 201;Madlab complained about bad video camera. 202;Robot is ready to go! 203;First robot destroyed. 204;Madlab given a good camera. 205;Robot is ready to go a second time! 206;Second robot destroyed. 207;Mines explained to player. 208;Dynamo (#66) is in sector J9. 209;Dynamo (#66) is alive. 210;One PC hasn't fought, but is able, and less than 3 fights have occured 211;Player receiving mine income from Drassen, Cambria, Alma & Chitzena 212;Player has been to K4_b1 213;Brewster got to talk while Warden was alive 214;Warden (#103) is dead. 215;Ernest gave us the guns 216;This is the first bartender 217;This is the second bartender 218;This is the third bartender 219;This is the fourth bartender 220;Manny is a bartender. 221;Nothing is repaired yet (some stuff being worked on, nothing to give player right now) 222;Player made purchase from Howard (#125) 223;Dave sold vehicle 224;Dave's vehicle ready 225;Dave expecting cash for car 226;Dave has gas. (randomized daily) 227;Vehicle is present 228;First battle won by player 229;Robot recruited and moved 230;No club fighting allowed 231;Player already fought 3 fights today 232;Hans mentioned Joey 233;Player is doing better than 50% (Alex's function) 234;Player is doing very well (better than 80%) 235;Father is drunk and sci-fi option is on 236;Micky (#96) is drunk 237;Player has attempted to force their way into brothel 238;Rat effectively threatened 3 times 239;Player paid for two people to enter brothel 242;Player owns 2 towns including omerta 243;Player owns 3 towns including omerta 244;Player owns 4 towns including omerta 245; Something about miguel/ rebels 248;Fact male speaking female present 249;Fact hicks married player merc 250;Fact museum open 251;Fact brothel open 252;Fact club open 253;Fact first battle fought 254;Fact first battle being fought 255;Fact kingpin introduced self 256;Fact kingpin not in office 257;Fact dont owe kingpin money 258;Fact pc marrying daryl is Flo 259;FACT_I16_BLOODCATS_KILLED 261;Fact npc cowering 264;Fact top and bottom levels cleared 265;Fact top level cleared 266;Fact bottom level cleared 267;Fact need to speak nicely 268;Fact attached item before 269;Fact skyrider ever escorted 270;Fact npc not under fire 271;Fact willis heard about joey rescue 272;Fact willis gives discount 273;Fact hillbillies killed 274;Fact keith out of business 275;Fact mike available to army 276;Fact kingpin can send assassins 277;Fact estoni refuelling possible 278;Fact museum alarm went off something about Kyle 279 (kyle received deed) 280;Fact maddog is speaker something used in darren's script 281 maybe darren explained fighting rules 282;Fact angel mentioned deed 283;Fact iggy available to army 284;Fact pc has conrads recruit opinion something about angel giving jacket after laving the deed on the counter. 286 used in angel's script too 287 used in angel's script as well 289;Fact npc hostile or pissed off 291;Fact tony in building 292;Fact shank speaking 293;Fact doreen alive 294;Fact waldo alive 295;Fact perko alive 296;Fact tony alive 298;Fact vince alive 299;Fact jenny alive 300;FACT_JENNY_ALIVE something about Pacos or brewester or even krott 301 (maybe krott left) 302;Fact arnold alive 303=Арнольд жив 304;Fact rocket rifle exists 305=24 HOURS SINCE JOEY RESCUED 306=24 HOURS SINCE DOCTOR TALKED TO 307= (OK USE ICECREAM) 308=FACT_KINGPIN_DEAD 318=KIDS ARE FREE 319=PLAYER IN SAME ROOM 320=? 321=?Бренда жива 322=? 323=? 324=PLAYER IN CONTROLLED DRASSEN MINE 325=PLAYER IN CONTROLLED DRASSEN MINE 326=PLAYER IN CONTROLLED CAMBRIA MINE 327=PLAYER SPOKE TO CHITZENA MINER 328=PLAYER IN CONTROLLED CHITZENA MINE 329=PLAYER SPOKE TO ALMA MINER 330=PLAYER IN CONTROLLED ALMA MINE 331=PLAYER SPOKE TO GRUMM MINER 332=PLAYER IN CONTROLLED GRUMM MINE 333=? 334=LARRY CHANGED 335=PLAYER KNOWS ABOUT BLOODCAT LAIR 336=HOSPITAL FREEBIE DECISION MADE 337=ENOUGH LOYALTY TO TRAIN MILITIA 338=WALKER AT BAR 339=? 340=JOEY ALIVE 341=UNPROPOSITIONED FEMALE SPEAKING TO NPC 342=84 AND 85 TRUE 343=? 344=? 345=? 346=? something about skyrider? 347=? 348=Игги (#068) может быть нанят 349=? 350=KINGPIN WILL LEARN OF MONEY GONE 351=Бешеный (#072) может быть нанят 352=? 353=? 354=SKYRIDER IN B15 355=SKYRIDER IN C16 356=SKYRIDER IN E14 357=SKYRIDER IN D12 358=SKYRIDER HINT GIVEN 359=KINGPIN IS ENEMY 360=BRENDA PATIENCE TIMER EXPIRED 361=?Dynamo returned to matt 362=DYNAMO NOT SPEAKER 363=? 364=? 365=PABLO BRIBED 366=? 367=CONRAD SHOULD GO 368=PLAYER KILLED BOXERS // // ------------------- // Unfinished Business // ------------------- // 400;[UB] Player Imported Save, Mary Dead 401;[UB] John Kulba offered to be recruited 402;[UB] Tex in game alive in store 403;[UB] Player bought something from Betty 404;[UB] Player bought 1 of Tex's videos 405;[UB] Raul's inventory changed since last visit 406;[UB] Player threatend Raul 407;[UB] Player bought something from Raul 408;[UB] Player threatened Raul 412;[UB] Player bought Barret from Raul 413;[UB] Merc say quote when talk menu closes 414;[UB] Player imported save and miguel is dead 415;[UB] Player imported save and fatima or pacos is dead 416;[UB] Player imported save and carlos is dead 417;[UB] Player imported save and ira is dead 418;[UB] Player imported save and dimitri is dead 419;[UB] Player imported save 420;[UB] Player killed all bettys bloodcats 421;[UB] Biggens on Team 422;[UB] Fan stopped 423;[UB] Biggens on team AND fan stopped
these are classic conditions that can be used in the input side as both true or false, with any (logicly possible) combinations
it appears that some of them are actual checks of the game (e.g. fact rocket rifle exists, fact joey 5 grids from martha in g8, skyrider close to heli etc.) that don't need to be set in a different script/ record but are checked by hardcoded means.
All other triggers are set to true by the output side of the script, which we will discuss later.
these conditions on the input side can be cumulated at will to allow for different records.
e.g. a character stands on grid 16442, trigger x true, trigger y false, has item z in his inventory and is being threatened by a merc with leadership over 50
Though item and grid cannot be cumulated with a GUI that has either in the same entry.
all of the above conditions, plus the general record activation entries must be met in order to activate the output part of the script.
as you can see, there is a huge number of possible combinations. Most records only use few entries in order to avoid confusion. Another important fact is that the entire script is apparently read from left (lower number to higher number) to right, so if you have two records with identical input side, the one with the lower number will be read first.
if it is a record that is "always used", it will always be read first and the later record is ignored! If it is a record that is used only once or once per interaction, the other record will be used the second time, and, if it has different output, make for a different result
in many scripts it is so that threatening an NPC will first lead to a curse, then to the NPC turning hostile using this function.
|
- OFFLINE
Top
|
|
|
|
#188159 - 10 June, 2008 05:14 PM
Re: NPC scripting info
[Re: the scorpion]
|
 General
Posts: 5492
Loc: CH
______
BANNED
|
Output side
The output side contains an NPC's action and speech, but also a big number fo sometimes very important actions. Many of those are not restriced to the npc in question but affect the Merc doing the talking, the overall game itself or other Global aspects.
1. Npc Speech
If the conditions on the input side are met, the NPC speaks his lines as defined in the output side. This is crucial for telling any story that might make sense.
Another important function of speech is that it is sometimes necessary for a script to continue. There sometimes are actions that won't work without speech, for example you can't jump to an NPC and away from that NPC again without some sort of action or speech.
however, these are special cases, but whenever a record isn't activated despite all conditions of the input side being met, it's worth a try to add some speech ;-)
2. NPC actions
//------------------- 1;NPC rejects an item given by merc 2;NPC faces closest player 3;NPC opens closest door // -0003 allows to open door while moving from one gridno to the other. see ernest's script. npc 105. 4;NPC joins the squad without salary (if you hire an RPC that is standing on a flat roof or on an (inaccesible) high roof, they'll teleport to the ground grid below them, even if it is obstructed 5;NPC raises gun threateningly 6;NPC lowers gun 7;NPC readies gun 8;NPC starts running (use -0008 at end of record) 9;NPC stops running 10;Town loyalty increases 11;Town loyalty decreases 12;Stop player from giving 1st aid 13;NPC faces North 14;NPC faces NorthEast 15;NPC faces East 16;NPC faces SouthEast 17;NPC faces South 18;NPC faces SouthWest 19;NPC faces West 20;NPC faces NorthWest 21;Trigger friend with hostile quote 22;NPC becomes enemy 23;NPC joins the Squad with salary 24;NPC stops conversation 25;Enter combat 26;Terrorist reveals himself (This is inaccurate. What actually happens is that the nickname that was previously defined in the right "nickname" field of proedit is replaced by the left full name field. It can be done with ANY npc and more than 8 characters can theoretically be used, but might not properly display 27;NPC opens closest cabinet 28;NPC slaps! 29;Trigger Queen by cities controlled 30;Send Soldiers to Drassen 31;Send soldiers to Battle Location 32;Trigger Queen by SAM Sites 33;Punch PC slot 0 34;Punch PC slot 1 35;Punch PC slot 2 36;Fristrated slap 37;NPC punches first living PC 38;Shoot Elliot 39;Player says nice later 40;NPC gets items from closest cabinet 41;Initiate shopkeeper's interface 42;NPC gets out of wheelchair 43;NPC gets out of wheelchair and becomes hostile 44;Player says nasty later //------------------- 50;Grant experience 1 51;Grant experience 2 52;Grant experience 3 53;Grant experience 4 54;Grant experience 5 //------------------- 100;NPC goes to hideout (works from anywhere, by any NPC, activates NPC 058 record 01 upon arriving (carlos normally) 101;Fatima give Letter 102;NPC leaves the hideout 103;NPC traverses map east 104;NPC traverses map south 105;NPC traverses map west 106;NPC traverses map north 107;NPC reports shipment size 108;NPC returns stolen shipment items 109;Set Pablo bribe delay 110;NPC asks about escorting him 111;NPC drinks 112;Trigger end of Food quest 113;Pacos starts hiding 114;Pacos starts following 115;Set delayed package timer 116;Set random package damage timer 117;Free kids (Doreen) 118;Choose Doctor 119;Report Balance 120;NPC asks about paying RPC 121;Delayed make Brenda leave 122;NPC has sex 123;Kyle gets money (requires tile object on specific tile, works in any map with any NPC, works more than once) 124;Layla given wrong amount of cash 125;Set girls available 126;Set delay until girls available 127;Set waited for girls false 128;Trigger Layla's record 13, 14 or 15 129;Open Carla's door 130;Open Cindy's door 131;Open Bambi's door 132;open Maria's door 133;Possibly advertise Cindy 134;Possible advertise Bambi 135;Darren pop-up request 136;Add Joey to World 137;Mark Kingpin's quote 0 as used 138;Start boxing match //139 is obsolete 140;Martha has heart-attack //Reminder: 140 works for all NPCs with last change, update when ready! 141;Darren given cash 142;Angel given cash 143;Trigger Angel's record 17 or 18 144;Buy leather Kevlar vest 145;Trigger Maria 146;Trigger Angel's record 16 or 19 147;Angel leaves deed (works for any NPC, drops item 226 to grid 12700 or 12701 something. 148;Trigger Angel's record 21 or 22 149;UN recruit NPC 150;Teleport NPC // This also works without a path, from flat roofs and high roofs to the ground (not vice-versa) 151;Remove Doreen 152;Reset shipment arrival stuff //153 Fix helicopter by next morning? 154;Decide active terrorists 155;Trigger Father's record 15, 18 or 20 156;Check last terrorist head 157;Carmen leaves for C13 158;Carmen leaves for good 159;Carmen leaves when new sector is loaded 160;Trigger Vince by loyalty 161;Medical pop-up request 162;Medical pop-up request 2 163;Check doctoring money given 164;Start doctoring 165;Vince unrecruitable 166;End combat 167;Become friendly at end of combat 168;Set Escorted PC to NPC 169;Buy vehicle pop-up request 170;End cut-scene 171;Start bloodcat quest 172;Start mine 173;Stop mine 174;Reset mine captured 175;Set Oswald's record 13 as used 176;Set Calvin's record 13 as used 177;Set Carl's record 13 as used 178;Set Fred's record 13 as used 179;Set Matt's record 13 as used 180;Trigger Matt 181;Reduce Conrad's salary conditions 182;Remove Conrad 183;Krott's pop-up request 184;Krott increases loyalty 185;Trigger Yanni 186;Trigger Mary/John's record 9 187;Trigger Mary/John's record 10 188;Add John's gun shipment //189 unused 190;Trigger Krott's record 11 or 12 191;Madlab given gun 192;Madlab given camera 193;Madlab attaches good camera 194;Madlab readies Robot 195;Walter given money initially 196;Walter given money 197;Make NPC 1st bartender 198;Make NPC 2nd bartender 199;Make NPC 3nd bartender 200;Make NPC 4th bartender 201;Gerard given cash 202;Fill up car (obsolete??) 203;Joe given cash 204;Trigger Elliot's record 9 or 10 205;Handle end of fight 206;Darren pays PC 207;Fight again pop-up request 208;Trigger Spike or Darren //209 210;Change Manny position 211;Timer for vehicle 212;Ask about paying RPC with daily salary 213;Trigger Micky BY SCI-FI //214 215;Trigger Elliot by battle result 216;Trigger Elliot by SAM disabled (obsolete??) 217;Layla's next line after Carla 218;Layla's next line after Cindy 219;Layla's next line after Bambi 220;Layla's next line after Maria 221;Prompt player to lie 222;Remove Joe Queen 223;Remove Elliot and end cut-scene 224;No SCI-FI end cut-scene //225 226;Trigger Marry/Darly prompt 227;Have married NPC leave the team 228;Kingpin given money 229;Trigger Kingpin's record 14 or 25 230;Send Enrico/Miguel email 231;End Demo (unused??) 232;Enter conversation mode //233 234;Timer on Keither going out of business 235;Keith going back to business 236;Make Rat disappear 237;Doctor escorts patients 238;Elliot decides quote for PC attack 239;Queen decides quote PC attack 240;NPC cancels waypoints //241 242;Reveal Tixa 243;Reveal Orta 244;Drink wine 245;Drink Booze 246;Trigger Angel's record 22 or 24 247;Set Trigger 105 to false 248;Make Brenda stationary 249;Trigger Kingpin/Darren impressed 250;Trigger Kingpin impressed 251;Add rat //252 253;Endgame state 1 254;Endgame state 2 255;Make Miguel stationary 256;Make Estoni a fuel-site 257;24 hours since Joey resqued 258;24 hours since doctors talked to 259;Send soldiers to Omerta 260;Add more elites 261;Give knowledge of all mercs 262;Remove Merc for marriage 263;Trigger Joe's record 32 or 33 264;Remove NPC //--------------------------------- // History log beeps: // these will beep "History log updated" // and will add relevant lines like Got the RR from Krott // Note that UC uses different logs // string-search the exe to replace those strings and they become very useful!! // 265;History: Got rocket Rifles 266;History: Deidranna dead bodies 267;History: Boxing matches 268;History: Something in mines 269;History: Devin 270;History: Mike 271;History: Tony 272;History: Krott 273;History: Kyle 274;History: Madlab 275;History: Gabby 276;History: Keith out of buniness 277;History: Howard Cyanide 278;History: Keith 279;History: Howard 280;History: Perko 281;History: Sam 282;History: Franz 283;History: Arnold 284;History: Fredo 285;History: Richguy Balime 286;History: Jake 287;History: Bum Keycard 288;History: Walter 289;History: Dave 290;History: Pablo 291;History: Kingpin money //--------------------- 292;Send soldiers to SAM 293;Move Pacos to basement 294;History: Assasin 295;Trigger Hans by room 296;Trigger Madlab's record 31 297;Trigger Madlab's record 32 298;Trigger Brewster by warden proximity
kyle one record before dissappearance 300
310=Открыть окно торговца
//--- 500;Turns to face nearest merc 501;Turns to face profile ID
miguel script action 559 denies recruitment
601; npc moves to different location
650;Last turn to face profile //---- // Reminder: Fix the list of additional codes. 1000;Train Health 1001;Train Agility 1002;Train Dexterity 1003;Train Wisdom 1004;Train Medical 1005;Train Explosives 1006;Train Mechanical 1007;Train Marksmanship 1008;Train Strength 1009;Train Leadership 1010;NPC suicides kamikazi-style (with C1) [End]
Along with the triggers, these npc actions are the core of scripting and storytelling. there's tons of things you can do with those actions and some imagination. Some of them work always, others only do certain specific, hardcoded things, like placing the deed item on a specific grid.
You see that not only the actions of the npc are defined here, but also some history log entries, Merc comments, experience gain, mines starting and ending to produce income, have sex, and even activate the End Game.
Some actions (like slap elliot) are restricted to certain situations (elliot seems to be needed for this... at least i didn't manage to get myself slapped here, lol)
i tried to add some comments to some of the non self explanatory actions, but by far not all actions are reseached enough
|
- OFFLINE
Top
|
|
|
|
#188163 - 10 June, 2008 05:28 PM
Re: NPC scripting info
[Re: the scorpion]
|
 General
Posts: 5492
Loc: CH
______
BANNED
|
4. Npc gives an item
This is the counterpart to npc has an item and or npc gets an item. See above, npc's should only give items if they also have it, otherwise you risk crashes.
5. Quest given/ activated
the output side my also activate quests and add entries to the history log while doing so.
for a list of quest, see above my comments on the input side
6. Quest closed
this closes the quest, adding a black entry to the history log and turning the other, formerly red entry, black too.
7. Jump/ Activate other scripts/ records
This one is particuliarly important for any storytelling beyond simplictiy. It is (one of) the counterpart of player interaction 10 (record was activated by other record or npc) of the input side.
By entering the npc number to jump to and the record in the script of this NPC to which you want to jump you can activate a different npc's and sometimes also EPC's npc script without any more player interaction. However, a jump may sometimes also cancel an NPC action or movement or such, so place them wisely in the script.
note that there are specialities in the cut scene scripts where deidranna/ elliot/ joe jump to each other.
8. Move to grid
This is the output counterpart of "npc stands on grid" it makes npc walk to the grid specified if they can reach it (pathfinding, locked doors with the npc not having "key" box checked in the map file, etc) see the additional posting below for means to modify movement from grid to grid
9. Stopwatch
if ever you encounter these numbers
-536 Stopwatch -535 Stopwatch off
it means that the player can't do anything during the stopwatch. This can be used to prevent exploits like shooting questgivers after doing their quests or simply to prevent the player from interfering into a difficult scripted action.
there ae a couple of more entries that i don't know or that are always 0 or that i forgot.
i will be updating these posts if get around to, and hopefully fix mistakes and give credit
most of the lines were probably first dug out by trailblazer, then neyros and the makers of the npc scripter deserve credit too.
if somebody would be so nice to translate the gibbersih entries to russian and from russian to english, that'd be nice too.
The different entries match more or less to the list of triggers and npc actions in the code, credits to realist for digging them out.
|
- OFFLINE
Top
|
|
|
|
#188187 - 10 June, 2008 06:29 PM
Re: NPC scripting info
[Re: the scorpion]
|
 General
Posts: 5492
Loc: CH
______
BANNED
|
addition:
not all NPC actions can be done by all bodytypes.
If an action doesn't work despite all conditions being met, try assigning a fighting bodytpye (e.g. reg male, reg female) to the character in question using proedit
addition: some npc actions (e.g. action 8, running, or action 3 opening closest door, or action 150 teleporting) are used in conjunction with movement (see earlier the explanations on movement)
teleporting needs no path from one grid to the other.
the activation of these actions may slightly differ from script to script and according to which programme you use.
addition: Dual-use scripts:
The scripts 160-196 are used for deidranna-elliot cut scenes:
Elliot Record Deidranna Record
Event: Omerta 180 160 Event: Drassen 181 161 15 Event: Cambria 182 162 Event: Alma 183 163 Event: Grumm 184 164 Event: Chitzena 185 165 Event: NW sam site 186 166 Event: NE sam site 187 167 Event: Central sam site 188 168 57 Event: Sent Flowers 189 169 Event: Won back a town 190 170 70 Event: Interrogation 191 171 73 Event: lose support scifi 192 172 101 Event: Skyrider 193 173 109 Event: Madlab Quest 194 174 113 Event: approach meduna 195 175 Event: Balime 196 176
however, current prof.dat's go up to slot 169. (Mods like Demise of Man may have even more slots, but demise of man also has the possibility to use "alternate npc scripts" so these slots don't conflict in DoM) This means, for example, that your script for character 163's npc interaction is the same script that is used for deidranna during the "alma" cut scene. So you're not supposed to carelessly overwrite it in order to change slot 163's behaviour. Rather "add" your records for slot 163 after the records needed for the cut scene. According to my observations, these records ARE used and not, as we coudl suspect, be ignored. Remark to this example: slot 163 might be used for vehicles or other "invisible" profiles. Handle with care times two...
|
- OFFLINE
Top
|
|
|
|
#241991 - 16 January, 2010 02:29 AM
Re: NPC scripting info
[Re: Sincleanser]
|
 General
Posts: 6167
Loc: Pleasantville, NJ
______
|
Man,this is pure gold! Thank you scorpion.
Action Scripting (I call it this to separate it from regular dialogue scripting for anyone reading this who is not familiar with the term as it pertains to this subject) is about the most difficult and frustrating part of mod making. If I could pick one aspect to rework from the ground up it would be this one (and maybe the way tilesets are restricted to sets instead of available in any map). But if someone comes along and actually starts to understand how to externalize this stuff into a more workable format every new modder might not have to reinvent the wheel when we want to do something with the action scripts.
_________________________
Dan Watson
|
- OFFLINE
Top
|
|
|
|
#242018 - 16 January, 2010 01:26 PM
Re: NPC scripting info
[Re: Khor1255]
|
 General
Posts: 5492
Loc: CH
______
BANNED
|
@ sincleanser
1. Most characters have such scripts by default in npcdata.slf. so you don't have to add any new scripts for most characters to work and certainly not for the game as such to run. if you add a character on slot 65 or 71 for example, where thre's no script already in place, then you just can't interact with them if they don't have a script. Some slots share their script with cutscenes though. i think i should add that to my above postings. Btw the .npc scripts don't cover all aspects of noc dialogue, e.g. some comments are "standard" without mention in the scripts. But even these "standards" seem to only exist for default used character slots, e.g. not slot 65 or 71.
2. "Completely changeable" would require a lot. See, for most npc actions to function, there needs to be hardcoded npc action. the scripts only activate these actions, if the exe doesn't have code for them, the scripts won't have any effect. Fo example the "sex with npc" script doesn't work in that censored version of ja2 where the "sex" animation is disabled. In order to change these scripts within the realms of currently existing triggers and code, you don't need to change the format or anything, often, simply replacing one value with another does the job. However, in order to move beyond the limits of current npc actions and triggers, it is most likely that a move to .lua would be the most beneficial thing to do and also the most innovative thing for story modding to ever happen. That said, the idea that scripting will become easy just because we'd use luad instead of .npc is an illusion. The subject matter as such is hard and complicated and i don't know if even the mighty lua can make this matter accesible enough for easy editing.
@Khor
Advancements in the scripting engine would be the very requirement for non-hardcoded new events of all sorts. That would be nothing short of a quantum leap. There are a few coders that work with .lua and they do great things, let's hope the npc scripting at some point is possible for them to tackle. Whether a complete rewrite is possible, or if .lua would allow to simply add new, custom npcactions that can be triggered with npc scripts, both would open the doors very wide for future modders to achieve custom stories and events. For example translating the existing "facts" from hardcode to external lua would allow to majorly redesign many quests and add flexibility where we, as of today, have to work around the hard code.
|
- OFFLINE
Top
|
|
|
|
|
|