trying to modify f__intdb.acs file on shotgun frenzy 1.4 unofficial patch 6 test 1

Discuss all aspects related to modding Zandronum here.
Post Reply
gregm9999
New User
Posts: 3
Joined: Sun Sep 14, 2014 8:17 am

trying to modify f__intdb.acs file on shotgun frenzy 1.4 unofficial patch 6 test 1

#1

Post by gregm9999 » Mon Oct 20, 2014 10:32 am

Hi, i was attempting to use add a script into the f_intdb.acs file

reason.
basically once there are 5 or more players playing
it changes the no of kills required to earn upgrade points

currently regardless of the no of players
this is the current no of kills required to get upgrade points
int p_RankExp[NUM_RANKS] = { 0, 50, 125, 190, 230, 300, 500, 1000, 2000, 3000, 0 };

above cmd is in the sf14 unofficial 6 test1 pk3 file in the f_intdc.acs file

i tried using the scripts at http://zdoom.org/wiki/A_quick_beginner%27s_guide_to_ACS
as a template
basically i would like to change
p_RankExp[NUM_RANKS] = { 0, 50, 125, 190, 230, 300, 500, 1000, 2000, 3000, 0 };
to
p_RankExp[NUM_RANKS] = { 0, 30, 100, 150, 230, 300, 500, 1000, 2000, 3000, 0 };
if there is more than 5 players

can anyone give me any pointers / solution
fyi i have tried googling and reading the wiki but it didn't help me so i am hoping someone on the forum can help.



by the way i am not the orginal creator of this acs

wadaholic created it first
then t3hdoom updated it with new options
thanks
gregm9999

ps below is the code of the acs file since i am not allowed to attach acs files

///////////////////////////////////////////////////
// SHOTGUN FRENZY
// a mod by Wad'a'Holic

// f_IntDB.acs
// manages the sectors

// USEABLE NAMING CONVENTIONS
// f - Frenzy - Script related, or General Purpose
// g - Game - Important stuff involving the game functions
// p - Player - Player interaction
// c - Commander - Commander interaction
// m - Monster - Monster interaction
// l - Local - Locally used values
// s - Settings - Global game settings, mainly used for screen resolutions

// g_Status reminders:
// 0 = Games not active
// 1 = Game active, sector 1 under attack
// 2 = Sector 2 under attack
// 3 = Sector 3 under attack
// 4 = Standard Active

#library "f_IntDB"
#include "zcommon.acs"

// game
int g_Status;
int g_FinalSkillScore;
int g_SpecialPortal;
int g_AIDirector_TrackRockets;
int g_AIDirector_TrackPlasma;
int g_AIDirector_TrackFlamer;
int f_AIDir_SpawnCount;
int f_Gametype;
int g_TenMinMark;
int g_GuardianMode;

int aiSubtract;

// test variable
int playercountReplicate = 0;

// game settings
int f_UseScoreSystem; // automatic research, used in CF and SD maps
int f_Startcash; // player starting cash, 2500 is the default
int c_Startcash; // starting cash for the commander (SF maps only)
int f_Doortype; // 0 is a normal door, 1 is a floor based door
int f_Doorspeed; // speed of the door opening, 50 is the default
int f_GameLength; // Gametime in minutes, +2 min after guardian warning, 28 default (30 min gametime)
int f_AISkillMultiplier; // increase in levels, higher means harder (aka: the RapeFactor variable)
int f_SurvivalLastLevel;
int f_PercentFast = 0; // what percentage of enemies are randomly made fast

int f_Cacodemons;
int f_AdaptiveSpawning;

int f_AllowNuke;
int f_AllowIon;

// player
int p_Credits[31];
int p_Exp[31];
int p_Exp_Points[31];
int p_Rank[31];
int p_MenuSelection[31];
int p_MenuSelection_Active[31];
int p_MenuSelection_Category[31];
int p_MenuSelection_Limit[31];
int p_Streak[31];
int p_TipQue[10];
int p_TotalPlayerDeaths;
int p_Combo[31];
int p_SplatCombo[31];
int p_UpgradeStack[31]; // soon to be redundant
int p_TankSlot[31]; // player tank status
int p_KickSlot[31];
int p_LastWeap[31];//for the autowep switching feature
int p_MechUpgradeWeapons[31];
int p_MechUpgradeArmor[31];

// commander
int c_Commander = 99;
int c_Credits;
int c_Techflag[99];
int c_ButtonSel; // selected button
int c_ButtonCat; // current category
int c_ButtonClick;
int c_ConstructSpeed = 50;
int c_NukeLaunched;
int c_BridgeStatus_1;
int c_BridgeStatus_2;
int c_BridgeStatus_3;
int c_BridgeStatus_4;
int c_BridgeStatus_5;
int c_BridgeStatus_6;
int c_KickVotes;
int c_KickVotesNeeded;
int c_HaltSpawning;
int c_ManualClick;

int c_Onscreen_Time = 15.0;
int c_Onscreen_Type = 1;

// monster
int m_InSector[4];
int m_SpawnRate = 1;
int m_Wave = 1;
int m_WaveSub;
int m_SurvivalWave = 1;

// settings
int s_ScreenSize[3] = {800, 600, 1};

// exp needed to get rank
#libdefine NUM_RANKS 11
int p_RankExp[NUM_RANKS] = { 0, 50, 125, 190, 230, 300, 500, 1000, 2000, 3000, 0 };

// amount of credits given for killing monster by class
int p_MonsterCredits[7] = { 2, 10, 22, 27, 65, 90, 200 }; // { 2, 10, 20, 25, 60, 90, 200 };

// chance of dropping item on monster death
int p_MonsterItem[7] = { 2, 6, 8, 10, 13, 20, 25 };//{ 5, 10, 15, 25, 50, 75, 99 };

// monster item rewards for different classes
#libdefine NUM_MONSTER_REWARDS 4

str m_rewardItems0[NUM_MONSTER_REWARDS] =
{
"Rnd_Inventory_Soulsphere",
"Medikit"
};
int m_rewardChances0[NUM_MONSTER_REWARDS] =
{ 25, 15, 10, 10 };

str m_rewardItems1[NUM_MONSTER_REWARDS] =
{
"Rnd_Inventory_Megasphere"
};

//"Rnd_Inventory_TurretBullet"

int m_rewardChances1[NUM_MONSTER_REWARDS] =
{ 25, 10, 10, 5 };

str m_rewardItems2[NUM_MONSTER_REWARDS] =
{
"Rnd_Inventory_Megasphere",
"Rnd_Inventory_Soulsphere"
};
//"Rnd_Inventory_TurretBullet",

int m_rewardChances2[NUM_MONSTER_REWARDS] =
{ 40, 20, 20, 5 };

str m_rewardItems3[NUM_MONSTER_REWARDS] =
{
"Rnd_Inventory_TurretBullet",
"Rnd_Inventory_Soulsphere",
"Rnd_Inventory_Berserk2"
};

int m_rewardChances3[NUM_MONSTER_REWARDS] =
{ 50, 30, 20, 10 };

str m_rewardItems4[NUM_MONSTER_REWARDS] =
{
"Rnd_Inventory_TeslaCoil",
"Rnd_Inventory_TurretBullet",
"Rnd_Inventory_Berserk2",
"Rnd_Inventory_Godsphere"
};

int m_rewardChances4[NUM_MONSTER_REWARDS] =
{ 30, 20, 20, 10 };

str m_rewardItems5[NUM_MONSTER_REWARDS] =
{
"Rnd_Inventory_Berserk2",
"Rnd_Inventory_Megasphere",
"Rnd_Inventory_Godsphere",
"Rnd_Inventory_AmmoGiver"
};
int m_rewardChances5[NUM_MONSTER_REWARDS] =
{ 30, 25, 20, 20 };

str m_rewardItems6[NUM_MONSTER_REWARDS] =
{
"Rnd_Inventory_Berserk2",
"Rnd_Inventory_Megasphere",
"Rnd_Inventory_Godsphere",
"Rnd_Inventory_AmmoGiver"
};
int m_rewardChances6[NUM_MONSTER_REWARDS] =
{ 50, 40, 20, 20 };

function void readconsole(void)
{
int sf_startcash = GetCVar("sf_startcash");
int sf_teamcash = GetCVar("sf_teamcash");
int sf_gamelength = GetCVar("sf_gamelength");
int sf_skillmult = GetCVar("sf_skillmult");
int sf_adaptivespawn = GetCVar("sf_adaptivespawn");
int sf_cacodemons = GetCVar("sf_cacodemons");
int sf_percentfast = GetCVar("sf_percentfast");

if (sf_startcash)
{
f_Startcash = sf_startcash;
}

if (sf_teamcash)
{
c_Startcash = sf_teamcash;
}

if (sf_gamelength)
{
f_Gamelength = sf_gamelength;
}

if (sf_skillmult)
{
f_AISkillMultiplier = sf_skillmult;
}

if (sf_adaptivespawn)
{
f_AdaptiveSpawning = sf_adaptivespawn;
}

if (sf_cacodemons)
{
f_Cacodemons = sf_cacodemons;
}

if (sf_percentfast)
{
f_PercentFast = sf_percentfast;
}
}

Cruduxy
Zandrone
Posts: 1059
Joined: Fri Jun 08, 2012 4:24 pm

RE: trying to modify f__intdb.acs file on shotgun frenzy 1.4 unofficial patch 6 test 1

#2

Post by Cruduxy » Wed Oct 22, 2014 11:45 pm

You should use pastepin instead of pasting a very large code so people find it easier to search :P. Anyway the file you linked is just masses of declaration sentences that are used by other scripts.

the file you've pasted here just defines the numbers, some other file has the function that gives upgrade points you should find that to help figuring it out :P. I think if you define your own array with a name like p_rankedexp2, you can use an if sentence together with http://zdoom.org/wiki/PlayerCount to use the correct array.
Last edited by Cruduxy on Wed Oct 22, 2014 11:45 pm, edited 1 time in total.
[][][][][][][][][][][][][][][]
Nothing to see here
[][][][][][][][][][][][][][][]

Watermelon
Zandrone
Posts: 1244
Joined: Thu Jun 28, 2012 9:07 pm
Location: Rwanda

RE: trying to modify f__intdb.acs file on shotgun frenzy 1.4 unofficial patch 6 test 1

#3

Post by Watermelon » Thu Oct 23, 2014 12:07 am

A quick and probably messy solution:

Why not just make one like this

Code: Select all

p_RankExpFivePlayers[NUM_RANKS] = { 0, 30, 100, 150, 230, 300, 500, 1000, 2000, 3000, 0 };
Then where p_RankExp is located, but an if statement checking for > 5 players, and if it is true, then use the new p_RankExpFivePlayers?



You could even wrap it in a function to make life 100x easier like so:

Code: Select all

function int getRankExp(int index)
{
    if (PlayerCount() >= 5)
        return p_RankExpFivePlayers[index];
    return p_RankExp[index];
}
Then just use this function everywhere p_getRankExp is called and pass the index as the argument.

So for example, your code would go from
if (p_RankExp[2]) ...
to
if (getRankExp(2)) ...
Last edited by Watermelon on Thu Oct 23, 2014 12:10 am, edited 1 time in total.

Ijon Tichy
Frequent Poster Miles card holder
Posts: 901
Joined: Mon Jun 04, 2012 5:07 am

RE: trying to modify f__intdb.acs file on shotgun frenzy 1.4 unofficial patch 6 test 1

#4

Post by Ijon Tichy » Thu Oct 23, 2014 1:32 am

Watermelon wrote: A quick and probably messy solution:

Why not just make one like this

Code: Select all

p_RankExpFivePlayers[NUM_RANKS] = { 0, 30, 100, 150, 230, 300, 500, 1000, 2000, 3000, 0 };
Then where p_RankExp is located, but an if statement checking for > 5 players, and if it is true, then use the new p_RankExpFivePlayers?
time to make a [PLAYERCOUNT][NUM_RANK] dimensioned array for maximum adaptability

this is a logical and necessary next step
Last edited by Ijon Tichy on Thu Oct 23, 2014 1:33 am, edited 1 time in total.

User avatar
Dusk
Developer
Posts: 581
Joined: Thu May 24, 2012 9:59 pm
Location: Turku

RE: trying to modify f__intdb.acs file on shotgun frenzy 1.4 unofficial patch 6 test 1

#5

Post by Dusk » Thu Oct 23, 2014 1:05 pm

gregm9999 wrote:can anyone give me any pointers

Code: Select all

	FILE* fp;

	if ((fp = fopen ("/dev/urandom", "rb")) != NULL)
	{
		size_t a;
		fread (&a, sizeof a, 1, fp);
		int* pointer = reinterpret_cast<int*> (a);
		printf ("%p\n", pointer);
	}
~/Desktop $ ./a.out
0x7f2c42191f8c773d
.. oh wait, you mean-

Watermelon
Zandrone
Posts: 1244
Joined: Thu Jun 28, 2012 9:07 pm
Location: Rwanda

RE: trying to modify f__intdb.acs file on shotgun frenzy 1.4 unofficial patch 6 test 1

#6

Post by Watermelon » Thu Oct 23, 2014 4:43 pm

Dusk wrote:
gregm9999 wrote:can anyone give me any pointers

Code: Select all

	FILE* fp;

	if ((fp = fopen ("/dev/urandom", "rb")) != NULL)
	{
		size_t a;
		fread (&a, sizeof a, 1, fp);
		int* pointer = reinterpret_cast<int*> (a);
		printf ("%p\n", pointer);
	}
~/Desktop $ ./a.out
0x7f2c42191f8c773d
.. oh wait, you mean-
:v:

gregm9999
New User
Posts: 3
Joined: Sun Sep 14, 2014 8:17 am

RE: trying to modify f__intdb.acs file on shotgun frenzy 1.4 unofficial patch 6 test 1

#7

Post by gregm9999 » Thu Oct 30, 2014 5:31 am

update while i still can't get the above to work on my zan test svr, i have got it to work via shotguns frenzy weapons system

basically when there are a certain amount of players on svr some of the upgrade point requirements for some of the weapons get reduced and it does work both on my test server and on a production server so thanks everyone for their suggestions/ ideas/ opinions and this seems to be a dynmic script i have done because i have noticed that if more players join during gameplay the script takes effect. i won't go into the code so i don't give too much away to other shotgun frenzy players
thanks for everyones help

t3hplayer
 
Posts: 29
Joined: Thu Sep 19, 2013 10:58 pm

RE: trying to modify f__intdb.acs file on shotgun frenzy 1.4 unofficial patch 6 test 1

#8

Post by t3hplayer » Fri Oct 31, 2014 7:42 am

Hey gregm. Good to see more and more people contributing to Shotgun Frenzy!

Regarding your question, it's been a while since I've looked at the code. However, I'm pretty sure the

int p_RankExp[NUM_RANKS] = { 0, 50, 125, 190, 230, 300, 500, 1000, 2000, 3000, 0 };

line is just a globally defined array that's used elsewhere in the code. If you want to change it based on the number of players, probably the best way to do it is gonna be to modify the function which is run every time a player joins. It should be possible to do by just sticking a line in that function that checks the player count every time a new player joins, and if the count is over 5, just change the values of the p_RankExp array. You'd have to add corresponding line to the function that's run when a player disconnects too, or the game mode wouldn't ever switch back when the player count goes back down.

I'd go into more detail, but I don't have the code in front of me right now

Post Reply