New script function getDifficulty(int) to find which difficulty level a given player has. Also added four new
constants to check against: EASY, MEDIUM, HARD and INSANE. Semperfi modified to be less nasty in easy and medium difficulty levels.master
parent
02ca800a92
commit
d6ee18c895
|
@ -625,7 +625,7 @@ event arrived(reachedTr)
|
|||
exit;
|
||||
}
|
||||
|
||||
if (droid.droidType == DROID_CONSTRUCT or droid.droidType == DROID_CYBORG_CONSTRUCT)
|
||||
if (droid.droidType == DROID_CONSTRUCT or droid.droidType == DROID_CYBORG_CONSTRUCT && getDifficulty(me) > EASY)
|
||||
{
|
||||
dbgObj(droid, "Failed to build where we should - attempt to screw up enemy oil derrick");
|
||||
|
||||
|
@ -1006,7 +1006,7 @@ event startLevel(startLevelTr)
|
|||
{
|
||||
setEventTrigger(conDroids, chainloadTr);
|
||||
setEventTrigger(doResearch, chainloadTr);
|
||||
if ((numFactories() > 1) and (isStructureAvailable(defStructs[0], me)))
|
||||
if (numFactories() > 1 and isStructureAvailable(defStructs[0], me) and getDifficulty(me) > MEDIUM)
|
||||
{
|
||||
dbgPlr("TRUCK RUSH!");
|
||||
setEventTrigger(truckRush, chainloadTr);
|
||||
|
|
|
@ -141,6 +141,23 @@ BOOL scrScavengersActive()
|
|||
return true;
|
||||
}
|
||||
|
||||
BOOL scrGetDifficulty()
|
||||
{
|
||||
int player;
|
||||
if (!stackPopParams(1, VAL_INT, &player))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
ASSERT_OR_RETURN(false, player < MAX_PLAYERS, "Bad player index");
|
||||
scrFunctionResult.v.ival = NetPlay.players[player].difficulty;
|
||||
if (!stackPushResult(VAL_INT, &scrFunctionResult))
|
||||
{
|
||||
ASSERT(false, "Failed to initialize player");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL scrGetPlayer()
|
||||
{
|
||||
if (!stackPopParams(1, VAL_STRING, &strParam1))
|
||||
|
|
|
@ -37,6 +37,7 @@ struct DROID;
|
|||
extern BOOL scriptInit(void);
|
||||
extern void scriptSetStartPos(int position, int x, int y);
|
||||
extern BOOL scrGetPlayer(void);
|
||||
extern BOOL scrGetDifficulty(void);
|
||||
extern BOOL scrScavengersActive(void);
|
||||
extern BOOL scrGetPlayerStartPosition(void);
|
||||
extern BOOL scrSafeDest(void);
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
#include "intfac.h"
|
||||
#include "multimenu.h"
|
||||
#include "lib/framework/input.h" //for key constants
|
||||
#include "lib/netplay/netplay.h"
|
||||
#include "lib/script/chat_processing.h"
|
||||
|
||||
|
||||
|
@ -294,10 +295,6 @@ FUNC_SYMBOL asFuncTable[] =
|
|||
3, { (INTERP_TYPE)ST_INTMESSAGE, VAL_INT, VAL_INT },
|
||||
0, 0, NULL, 0, 0, NULL, NULL },
|
||||
|
||||
/* { "addTutorialMessage", scrAddTutorialMessage, VAL_VOID,
|
||||
2, { (INTERP_TYPE)ST_INTMESSAGE, VAL_INT },
|
||||
0, 0, NULL, 0, 0, NULL, NULL },*/
|
||||
|
||||
{ "selectDroidByID", scrSelectDroidByID, VAL_BOOL,
|
||||
2, { (INTERP_TYPE)ST_DROIDID, VAL_INT },
|
||||
0, 0, NULL, 0, 0, NULL, NULL },
|
||||
|
@ -1458,6 +1455,10 @@ FUNC_SYMBOL asFuncTable[] =
|
|||
9, { VAL_FLOAT, VAL_FLOAT, VAL_FLOAT, VAL_FLOAT, VAL_FLOAT, VAL_FLOAT, VAL_FLOAT, VAL_FLOAT, VAL_FLOAT },
|
||||
false, 0, NULL, 0, 0, NULL, NULL },
|
||||
|
||||
{ "getDifficulty", scrGetDifficulty, VAL_INT,
|
||||
1, { VAL_INT },
|
||||
false, 0, NULL, 0, 0, NULL, NULL },
|
||||
|
||||
/* This final entry marks the end of the function list */
|
||||
{ "FUNCTION LIST END", NULL, VAL_VOID, 0, { VAL_VOID }, 0, 0, NULL, 0, 0, NULL, NULL }
|
||||
};
|
||||
|
@ -2063,6 +2064,11 @@ CONST_SYMBOL asConstantTable[] =
|
|||
{ "KEY_KP_8", VAL_INT, false, KEY_KP_8, NULL, NULL, 0.0f },
|
||||
{ "KEY_KP_9", VAL_INT, false, KEY_KP_9, NULL, NULL, 0.0f },
|
||||
|
||||
{ "EASY", VAL_INT, false, DIFFICULTY_EASY, NULL, NULL, 0.0f },
|
||||
{ "MEDIUM", VAL_INT, false, DIFFICULTY_MEDIUM, NULL, NULL, 0.0f },
|
||||
{ "HARD", VAL_INT, false, DIFFICULTY_HARD, NULL, NULL, 0.0f },
|
||||
{ "INSANE", VAL_INT, false, DIFFICULTY_INSANE, NULL, NULL, 0.0f },
|
||||
|
||||
/* This entry marks the end of the constant list */
|
||||
{ "CONSTANT LIST END",VAL_VOID, false, 0, NULL, NULL, 0.0f }
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue