Kingpin_Xatrix Tutorial

Discuss all things regarding the art of making MODELS for Kingpin. Models can be new weapons, new characters, or new "props" Also discuss Kingpin Editing which involves code or scripting issues or procedures.
Zeppelin FnR
Registered User
Joined: 09 Oct 2002, 09:06

29 May 2003, 03:12 #1

I took the liberty of trying out the little tutorial and well it had some error's (I never tested it ) Just got it to compile !
Here is the fixed version
I asume you know basic of C++, we going to write a code for a new episode in Kingpin.
To start you need to have kpsdk, which you can download from,
and C++ compiler.
When you opened C++ Compiler(I use MS Visual C++), look at .h files.
C++ has two kinds of files .c and .h
Now find ep_all.h, open it and go to line 17, now write this:*/
#define EP_DAYTON 7
You just defined number of you episode, which you use when you build maps in KPRadiant.
Now go to line 356, and write this:*/
#define NAME_MAL 100
#define NAME_DREW 101
What you just did, is defined names(NAME_MAL and NAME_DREW),
100 and 101 is numbers, which C++ Compiler will substitute for names.
Now go to line 530 in ep_all.h, and write this:*/
qboolean EP_Dayton_EventSpeech (edict_t *self, edict_t *other);
void EP_DT_Rgister_EPFLAG (edict_t *self, int ep_flag);
Now find ep_all.c, open it and go to line 131, now write this:
Remember names, which you defined in ep_all.h, you just defined them
the way they will look in game not NAME_MAL, but Mal.
Now go to line 353 in ep_all.c file, and write this
case EP_DAYTON://He forgot the :
return EP_Dayton_EventSpeech (self, other);
Now, we need to create file .c with name of episode you want to create.
In my case it's "Dayton", so you can create file Dayton.c
Now Iam going to use "//" to write comments in the code, "//" this simply
means that C++ Compiler will ignore line with "//".
The other way to use comments is "/*" is by putting text between these simbols "*//*".
Now, write or copy this in your dayton.c
DAYTON - Episode specific code
#include "g_local.h" // Adding library to your code
#include "voice_punk.h" // Adding library to your code
#include "voice_bitch.h" // Adding library to your code
// Starting our function
/*EROR THIS WAS AFTER THE qboolean EP_Dayton_EventSpeech Function if you look it call's this
EP_DT_Register_EPFLAG so it wouldn't compile */
void EP_DT_Register_EPFLAG (edict_t *self, int ep_flag)
&nbsp &nbsp &nbsp &nbsp if (self->client->pers.episode_flags & ep_flag)
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp return;
&nbsp &nbsp &nbsp &nbsp self->episode_flags = self->client->pers.episode_flags |= ep_flag;
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp
&nbsp &nbsp &nbsp &nbsp EP_Flash_Newflag (self, ep_flag);
qboolean EP_Dayton_EventSpeech (edict_t *self, edict_t *other)
//cast_memory *mem;//error
cast_memory_t&nbsp &nbsp &nbsp &nbsp *mem;
mem = level.global_cast_memory[ self->character_index][ other->character_index ];
&nbsp &nbsp &nbsp &nbsp if (self->name_index == NAME_MAL && other->client) // Call NAME_MAL character
&nbsp &nbsp &nbsp &nbsp {
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp if (other->episode_flags & EP_DT_MAL_TOOK_WATCH)
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp {
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp if (mem->inc == 0)
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp {
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp Voice_Random( self, other, &lenny_table[14], 2); // Voice from voice_punk.h
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp mem->inc++;
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp }
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp else
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp {
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp Voice_Specific( self, other, lenny_table, 13 ); // Voice from voice_punk.h
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp mem->inc = 0;
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp }
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp return true;
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp }
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp if (other->client->pers.inventory[ITEM_INDEX(FindItem("Watch"))]) // Check plauer inventory for item Watch
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp {
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp int index;
gitem_t *item;

// Mal takes the watch
&nbsp &nbsp &nbsp &nbsp item = FindItem ("Watch");
&nbsp &nbsp &nbsp &nbsp index = ITEM_INDEX (item);
&nbsp &nbsp &nbsp &nbsp other->client->pers.inventory[ index ] = 0;
&nbsp &nbsp &nbsp &nbsp
&nbsp &nbsp &nbsp &nbsp // Mal gives player the key
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp Voice_Specific( self, other, lenny_table, 2 ); // here's the key
&nbsp &nbsp &nbsp &nbsp item = FindItem ("StoreRoomKey");
&nbsp &nbsp &nbsp &nbsp index = ITEM_INDEX (item);
&nbsp &nbsp &nbsp &nbsp other->client->pers.inventory[ index ]++;
&nbsp &nbsp &nbsp &nbsp // show icon and name on status bar
&nbsp &nbsp &nbsp &nbsp other->client->ps.stats[STAT_PICKUP_ICON] = gi.imageindex(item->icon);
&nbsp &nbsp &nbsp &nbsp other->client->ps.stats[STAT_PICKUP_STRING] = CS_ITEMS+index;
&nbsp &nbsp &nbsp &nbsp other->client->pickup_msg_time = level.time + 5.5;
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp mem->inc = 0;
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp }
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp else
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp {
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp if (!mem->inc)
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp {
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp Voice_Specific( self, other, lenny_table, 3 ); // Voice from voice_punk.h
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp mem->inc = 2;
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp }
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp else if (mem->inc == 2)
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp {
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp Voice_Random( self, other, &lenny_table[4],5 ); // Voice from voice_punk.h
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp mem->inc = 3;
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp }
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp else
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp {
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp Voice_Random( self, other, &lenny_table[22], 3 ); // Voice from voice_punk.h
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp mem->inc = 2;
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp }
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp }
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp return true;
&nbsp &nbsp &nbsp &nbsp }
&nbsp &nbsp &nbsp &nbsp return false;
void EP_DT_Register_EPFLAG */
Every where you see "Dayton" or "DT", substitute your episode name, you don't have to know everything about C++,
you just need to knoe C++ for Quake2 Engine.
In this episode you need to kill ai named "Drew", get watch and bring them to "Mal", I used the same thing as "Lenny" and "Lamont" in Skidrow.
Now go to KPRadiant build a map, press 'n' and find "worldspawn" and write in "Key" "episode", and in "Value" "7".
Remember we put EP_DAYTON 7 in ep_all.h?
Also create two thugs or punks and give them name Mal and Drew, in "Key" put "name" in "Value" put "Mal" and "Drew".
I hope you understand it, if I made some mistake mail me or if you have any questions.
[email protected]*/
He did'nt Define EP_DT_MAL_TOOK_WATCH
So it was an error
So i defined it as
#define EP_DT_MAL_TOOK_WATCH&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp 0x00400000
Right after #define EP_RC_THE_WARNING&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp 0x02000000
in ep_all.h&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp
This is untested i assume it would work but i did'nt try it
Give this a try and if it don't work then maybe someone else can fix it
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp Image