Sign in to follow this  
Followers 0
Wraith

[TUTORIAL]How to make deathrun abilities unlockable by levels

12 posts in this topic

First of all this is not me asking for help(I've already done that and I didn't get what I asked for) I am making a short tutorial for some people(I will not specify who) who asked me how to do this.

 

Yes, I have asked for this same thing in the past and now I am trying to help those who are doing the same thing I did before.

 

So lets get on with the tutorial >>>>
 

First of all you will need the deathrun source code, got it? then lets move forward(if you don't then search for it on google)

Then you need cod4 mod tools to compile your mod.ff file(if you don't have this then google it aswell :D)

and you will need a good text editor, for beginners i'll recommend Notepad ++

 

Once you have both of those, then go to the deathrun source code folder(Cod4 Directory/mods/deathrun_dev)

then go to the ui_mp folder, inside the folder open dr_common.inc with Notepad ++

 

Scroll down and look at the code for a bit(this is important if you want to understand what you are doing)

you'll see the code divided into sections such as dr_weapons,dr_abilities,dr_characters,dr_sprays etc

This is the folder where it is defined where and how the menu buttons are, aswell as when and how the function

Unless your making more pages for the customization menu, you will only need to be concerned about the dr_abilities section,

since you will be changing that to make the abilities unlockable by levels,

 

Now onto the actual part of the tutorial 

 

First of all Select the code from '#define DR_ABILITY( y, itemID ) \' till one line above '#define DR_SPRAY( row, column, itemID ) \' and replace the code with

#define DR_ABILITY( y, itemID ) \
itemDef \
{ \
	visible			when( rank < tableLookup(ABILITY_TABLE, 0, itemID, 2) ) /*locked*/ \
	rect			90 y 220 35 DR_BUTTON_ALIGN \
	style			WINDOW_STYLE_FILLED \
	border			1 \
	bordercolor		DR_BUTTON_BORDERCOLOR \ 
	forecolor		DR_BUTTON_FORECOLOR \ 
	backcolor		DR_BUTTON_BACKCOLOR \
} \
itemDef \
{ \
	visible			when( rank >= tableLookup(ABILITY_TABLE, 0, itemID, 2) ) /*unlocked*/ \
	rect			90 y 220 35 DR_BUTTON_ALIGN \
	style			WINDOW_STYLE_FILLED \
	border			1 \
	bordercolor		DR_BUTTON_BORDERCOLOR \ 
	forecolor		DR_BUTTON_FORECOLOR \ 
	backcolor		DR_BUTTON_BACKCOLOR_FOCUSED \
} \
itemDef \
{ \
	rect			92 (y+1) 55 35 DR_BUTTON_ALIGN \
	style			WINDOW_STYLE_SHADER \
	exp				material( tablelookup(ABILITY_TABLE, 0, itemID, 4) ) \
	visible			when( rank >= tableLookup(ABILITY_TABLE, 0, itemID, 2) ) /*unlocked*/ \
	forecolor		1 1 1 1 \
	decoration \
} \
itemDef \
{ \
	rect			92 (y+1) 55 35 DR_BUTTON_ALIGN \
	style			WINDOW_STYLE_SHADER \
	exp				material( tablelookup(ABILITY_TABLE, 0, itemID, 4) ) \
	visible			when( rank < tableLookup(ABILITY_TABLE, 0, itemID, 2) ) /*locked*/ \
	forecolor		0.8 0.8 0.8 0.6 \
	decoration \
} \
itemDef \
{ \
	style		WINDOW_STYLE_FILLED \
	rect		90 y 220 35 DR_BUTTON_ALIGN \
	forecolor	1 1 1 0.8 \
	exp			text( tableLookup(ABILITY_TABLE, 0, itemID, 5) ) \
	type		ITEM_TYPE_BUTTON \
	textfont	UI_FONT_NORMAL \
	textstyle	ITEM_TEXTSTYLE_SHADOWED \
	textalign	ITEM_ALIGN_LEFT \
	textscale	0.32 \
	textalignx	70 \
	textaligny	22 \
	visible		when( rank >= tableLookup(ABILITY_TABLE, 0, itemID, 2) ) /*unlocked*/ \
	mouseEnter \
	{ \
		play "mouse_over"; \
	} \
	action \
	{ \
		scriptMenuResponse itemID; \
		close self; \
		open "character_stuff"; \
	} \
} \ 
itemDef \
{ \
	style		WINDOW_STYLE_FILLED \
	rect		90 y 220 35 DR_BUTTON_ALIGN \
	forecolor	0.8 0.8 0.8 0.6 \
	exp			text( tableLookup(ABILITY_TABLE, 0, itemID, 5) ) \
	type		ITEM_TYPE_BUTTON \
	textfont	UI_FONT_NORMAL \
	textstyle	ITEM_TEXTSTYLE_SHADOWED \
	textalign	ITEM_ALIGN_LEFT \
	textscale	0.32 \
	textalignx	70 \
	textaligny	22 \
	visible		when( rank < tableLookup(ABILITY_TABLE, 0, itemID, 2) ) /*locked*/ \
} \
itemDef \
{ \
	visible		1 \
	rect		90 y 220 35 DR_BUTTON_ALIGN \
	textscale	0.18 \
	textalignx	70 \
	textaligny	33 \
	forecolor	1 1 1 0.8 \
	exp			text( tableLookup(ABILITY_TABLE, 0, itemID, 6) ) \
	textfont	UI_FONT_NORMAL \
	textalign	ITEM_ALIGN_LEFT \
	textscale	0.2 \
	decoration \
} \
itemDef \
{ \
	visible		when( rank < tableLookup(ABILITY_TABLE, 0, itemID, 2) ) /*locked*/ \
	origin		308 y \
	textscale	0.22 \
	textaligny	11 \
	forecolor	1 1 1 0.8 \
	exp			text( "^1Locked("+tableLookup(ABILITY_TABLE, 0, itemID, 2)+")" ) \
	textfont	UI_FONT_NORMAL \
	textalign	ITEM_ALIGN_RIGHT \
	textscale	0.2 \
	decoration \
} \
itemDef \
{ \
	visible		when( rank >= tableLookup(ABILITY_TABLE, 0, itemID, 2) ) /*unlocked*/ \
	origin		308 y \
	textscale	0.22 \
	textaligny	11 \
	forecolor	1 1 1 0.8 \
	exp			text( "^2Unlocked" ) \
	textfont	UI_FONT_NORMAL \
	textalign	ITEM_ALIGN_RIGHT \
	textscale	0.2 \
	decoration \
}


// 20 sprays - 96x90
// 25 sprays = 96x72#define DR_ABILITY( y, itemID ) \
itemDef \
{ \
	visible			when( rank < tableLookup(ABILITY_TABLE, 0, itemID, 2) ) /*locked*/ \
	rect			90 y 220 35 DR_BUTTON_ALIGN \
	style			WINDOW_STYLE_FILLED \
	border			1 \
	bordercolor		DR_BUTTON_BORDERCOLOR \ 
	forecolor		DR_BUTTON_FORECOLOR \ 
	backcolor		DR_BUTTON_BACKCOLOR \
} \
itemDef \
{ \
	visible			when( rank >= tableLookup(ABILITY_TABLE, 0, itemID, 2) ) /*unlocked*/ \
	rect			90 y 220 35 DR_BUTTON_ALIGN \
	style			WINDOW_STYLE_FILLED \
	border			1 \
	bordercolor		DR_BUTTON_BORDERCOLOR \ 
	forecolor		DR_BUTTON_FORECOLOR \ 
	backcolor		DR_BUTTON_BACKCOLOR_FOCUSED \
} \
itemDef \
{ \
	rect			92 (y+1) 55 35 DR_BUTTON_ALIGN \
	style			WINDOW_STYLE_SHADER \
	exp				material( tablelookup(ABILITY_TABLE, 0, itemID, 4) ) \
	visible			when( rank >= tableLookup(ABILITY_TABLE, 0, itemID, 2) ) /*unlocked*/ \
	forecolor		1 1 1 1 \
	decoration \
} \
itemDef \
{ \
	rect			92 (y+1) 55 35 DR_BUTTON_ALIGN \
	style			WINDOW_STYLE_SHADER \
	exp				material( tablelookup(ABILITY_TABLE, 0, itemID, 4) ) \
	visible			when( rank < tableLookup(ABILITY_TABLE, 0, itemID, 2) ) /*locked*/ \
	forecolor		0.8 0.8 0.8 0.6 \
	decoration \
} \
itemDef \
{ \
	style		WINDOW_STYLE_FILLED \
	rect		90 y 220 35 DR_BUTTON_ALIGN \
	forecolor	1 1 1 0.8 \
	exp			text( tableLookup(ABILITY_TABLE, 0, itemID, 5) ) \
	type		ITEM_TYPE_BUTTON \
	textfont	UI_FONT_NORMAL \
	textstyle	ITEM_TEXTSTYLE_SHADOWED \
	textalign	ITEM_ALIGN_LEFT \
	textscale	0.32 \
	textalignx	70 \
	textaligny	22 \
	visible		when( rank >= tableLookup(ABILITY_TABLE, 0, itemID, 2) ) /*unlocked*/ \
	mouseEnter \
	{ \
		play "mouse_over"; \
	} \
	action \
	{ \
		scriptMenuResponse itemID; \
		close self; \
		open "character_stuff"; \
	} \
} \ 
itemDef \
{ \
	style		WINDOW_STYLE_FILLED \
	rect		90 y 220 35 DR_BUTTON_ALIGN \
	forecolor	0.8 0.8 0.8 0.6 \
	exp			text( tableLookup(ABILITY_TABLE, 0, itemID, 5) ) \
	type		ITEM_TYPE_BUTTON \
	textfont	UI_FONT_NORMAL \
	textstyle	ITEM_TEXTSTYLE_SHADOWED \
	textalign	ITEM_ALIGN_LEFT \
	textscale	0.32 \
	textalignx	70 \
	textaligny	22 \
	visible		when( rank < tableLookup(ABILITY_TABLE, 0, itemID, 2) ) /*locked*/ \
} \
itemDef \
{ \
	visible		1 \
	rect		90 y 220 35 DR_BUTTON_ALIGN \
	textscale	0.18 \
	textalignx	70 \
	textaligny	33 \
	forecolor	1 1 1 0.8 \
	exp			text( tableLookup(ABILITY_TABLE, 0, itemID, 6) ) \
	textfont	UI_FONT_NORMAL \
	textalign	ITEM_ALIGN_LEFT \
	textscale	0.2 \
	decoration \
} \
itemDef \
{ \
	visible		when( rank < tableLookup(ABILITY_TABLE, 0, itemID, 2) ) /*locked*/ \
	origin		308 y \
	textscale	0.22 \
	textaligny	11 \
	forecolor	1 1 1 0.8 \
	exp			text( "^1Locked("+tableLookup(ABILITY_TABLE, 0, itemID, 2)+")" ) \
	textfont	UI_FONT_NORMAL \
	textalign	ITEM_ALIGN_RIGHT \
	textscale	0.2 \
	decoration \
} \
itemDef \
{ \
	visible		when( rank >= tableLookup(ABILITY_TABLE, 0, itemID, 2) ) /*unlocked*/ \
	origin		308 y \
	textscale	0.22 \
	textaligny	11 \
	forecolor	1 1 1 0.8 \
	exp			text( "^2Unlocked" ) \
	textfont	UI_FONT_NORMAL \
	textalign	ITEM_ALIGN_RIGHT \
	textscale	0.2 \
	decoration \
}


// 20 sprays - 96x90
// 25 sprays = 96x72

 

 

Once your done with this, your abilities are now unlockable by levels, however it doesn't end yet

then go to 'mp' folder and open abilityTable.csv, it can be opened with Microsoft Excel, but for now i'll recommend Notepad ++ for it,

 

and replace the code with

1,0,0,specialty_null,specialty_null,@PERKS_NONE,@PERKS_NONE,
2,1,5,specialty_longersprint,specialty_longersprint,@PERKS_EXTREME_CONDITIONING,@PERKS_SPRINT_FOR_LONGER_DISTANCES,
3,2,10,specialty_holdbreath,specialty_holdbreath,@PERKS_IRON_LUNGS,@PERKS_LONGER_BREATH_FOR_STEADIER,
4,3,15,specialty_bulletdamage,specialty_bulletdamage,@PERKS_STOPPING_POWER,@PERKS_INCREASED_BULLET_DAMAGE,
5,4,25,specialty_bulletaccuracy,specialty_bulletaccuracy,@PERKS_STEADY_AIM,@PERKS_INCREASED_HIPFIRE_ACCURACY,
6,5,28,specialty_rof,specialty_rof,@PERKS_DOUBLE_TAP,@PERKS_INCREASED_RATE_OF_FIRE,
7,6,29,specialty_fastreload,specialty_fastreload,@PERKS_SLEIGHT_OF_HAND,@PERKS_FASTER_RELOADING,
8,7,30,specialty_armorvest,specialty_armorvest,@PERKS_JUGGERNAUT,@PERKS_INCREASED_HEALTH, 

 

now compile and you should be done, unless your using the mod.gsc edited by BaKn, then the abilities will not work, to fix that 

you can either replace the mod.gsc with the one made by BraXi or if you want to keep the ghostmode scripts of BaKn's edited mod.gsc then you can do this :

 

P.S unless you don't know where the mod.gsc is, it is located in the Braxi folder :)

 

you need to replace this part of the code(in BaKn's edited mod.gsc)

buildAbilityInfo()
{
	level.abilityInfo = [];
	level.numAbilities = 0;
	
	tableName = "mp/abilityTable.csv";

	for( idx = 1; isdefined( tableLookup( tableName, 0, idx, 0 ) ) && tableLookup( tableName, 0, idx, 0 ) != ""; idx++ )
	{
		id = int( tableLookup( tableName, 0, idx, 1 ) );
		level.abilityInfo[id]["stat"] = int(tableLookup( tableName, 0, idx, 2 ));
		level.abilityInfo[id]["codeName"] = tableLookup( tableName, 0, idx, 3 );
		level.abilityInfo[id]["shader"] = tableLookup( tableName, 0, idx, 4 );
		level.abilityInfo[id]["name"] =  tableLookup( tableName, 0, idx, 5 );
		level.abilityInfo[id]["desc"] = tableLookup( tableName, 0, idx, 6 );
		
		precacheShader( level.abilityInfo[id]["shader"] );
		level.numSprays++;
	}
} 

 

with 

 

buildAbilityInfo()
{
	level.abilityInfo = [];
	level.numAbilities = 0;
	
	tableName = "mp/abilityTable.csv";

	for( idx = 1; isdefined( tableLookup( tableName, 0, idx, 0 ) ) && tableLookup( tableName, 0, idx, 0 ) != ""; idx++ )
	{
		id = int( tableLookup( tableName, 0, idx, 1 ) );
		level.abilityInfo[id]["stat"] = int(tableLookup( tableName, 0, idx, 2 ));
		level.abilityInfo[id]["codeName"] = tableLookup( tableName, 0, idx, 3 );
		level.abilityInfo[id]["shader"] = tableLookup( tableName, 0, idx, 4 );
		level.abilityInfo[id]["name"] =  tableLookup( tableName, 0, idx, 5 );
		level.abilityInfo[id]["desc"] = loadFx( tableLookup( tableName, 0, idx, 6 ) );
		
		precacheShader( level.abilityInfo[id]["shader"] );
		level.numSprays++;
	}
} 

 

then you should be done :D

 

if you are still having any problems send me a message and i'll help you out.

1

Share this post


Link to post
Share on other sites

Should have been posted in the tutorial section, an admin+ will move it soon.

 

Nonetheless, was a good tutorial and people will find it helpful, good job!

1

Share this post


Link to post
Share on other sites

nice errors cuz you know since was an fx a string?

0

Share this post


Link to post
Share on other sites

not my errors  :P

 

and my apologies didn't actually notice there was a tutorial section till now :3

0

Share this post


Link to post
Share on other sites

if you're going to make a tutorial at least make sure it's script error free... don't care who you stole it from. but obviously you know nothing about gsc so don't post any more tuts till you learn.

3

Share this post


Link to post
Share on other sites

Yes this tutorial have error.. But help me i set Ability woark on my server.. So i will say Tnx..

0

Share this post


Link to post
Share on other sites

ye the last part do it the other way round :3

i messed up on that since i was working on something else while do it.

0

Share this post


Link to post
Share on other sites

ye the last part do it the other way round :3

i messed up on that since i was working on something else while do it.

Ok, if you wish to use the edit function that would be recommended to updated that error.

0

Share this post


Link to post
Share on other sites

LOL why don't u simply edit abilitytable and _rank.gsc? :dave:

 

Those are the only things u need to do.

 

EDIT: Forgot that I made my custom menu, you need to change stat to rank on DR_ABILITY i tinky winky :troll:

0

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  
Followers 0