Jump to content

All characters disapear ingame after modification on SPLibrary


Recommended Posts

Hi !

I recently joined RJA to help him with Epic Challenge Mod IV. My part of the job is to code the new powers and add it to the modification already done.

I took the code in my computer with the modification of Asgarath who added new weapons and new sabercolor which worked great when i tried to compile it. 

 

Then I tried to add powers following the tutorial of Asgarath "How to add force power for Single Player", and after these modification if i put the jagamex64.dll in the gamedata/base folder, all characters in game disapear (I still hear the song, i can use the UI, moove my player, but the characters models are gone).

After the last time it worked, i touched these files :

  • q_shared.h
  • g_active.cpp
  • g_itemload.cpp
  • q3_interface.h
  • q3_interface.cpp
  • npc_stats.cpp
  • g_target.cpp
  • g_svcmds.cpp
  • cg_main.cpp
  • cg_local.h
  • cg_info.cpp
  • bg_pmove.cpp
  • wp_saber.cpp

 

So my question is : What ot these modification could have cause this problem ?

Thank you in advance for my help, and ask me if you want more informations about this problem

Regards ! :)
Link to comment

Sure ! 

I forgot to say that actually the code to add the power works because i can find it in the list of powers when i tape "SetForceAll 1138" in the command console. The only problem is that all the characters models disapear.
 

 

q_shared.h

 

I added here the power "FP_FREEZE" to the power enum and to the GENCMD enum

typedef enum
{
FP_FIRST = 0,//marker
FP_HEAL = 0,//instant
FP_LEVITATION,//hold/duration
FP_SPEED,//duration
FP_PUSH,//hold/duration
FP_PULL,//hold/duration
FP_TELEPATHY,//instant
FP_GRIP,//hold/duration
FP_LIGHTNING,//hold/duration
FP_SABERTHROW,
FP_SABER_DEFENSE,
FP_SABER_OFFENSE,
//new Jedi Academy powers
FP_RAGE,//duration - speed, invincibility and extra damage for short period, drains your health and leaves you weak and slow afterwards.
FP_PROTECT,//duration - protect against physical/energy (level 1 stops blaster/energy bolts, level 2 stops projectiles, level 3 protects against explosions)
FP_ABSORB,//duration - protect against dark force powers (grip, lightning, drain - maybe push/pull, too?)
FP_DRAIN,//hold/duration - drain force power for health
FP_SEE,//duration - detect/see hidden enemies
FP_FREEZE, //duration - freeze ennemies
NUM_FORCE_POWERS
} forcePowers_t;
typedef enum
{
GENCMD_FORCE_HEAL = 1,
GENCMD_FORCE_SPEED,
GENCMD_FORCE_THROW,
GENCMD_FORCE_PULL,
GENCMD_FORCE_DISTRACT,
GENCMD_FORCE_GRIP,
GENCMD_FORCE_LIGHTNING,
GENCMD_FORCE_RAGE,
GENCMD_FORCE_PROTECT,
GENCMD_FORCE_ABSORB,
GENCMD_FORCE_DRAIN,
GENCMD_FORCE_SEEING,
GENCMD_FORCE_FREEZE,
} genCmds_t;

 

g_active.cpp

 

I Added ForceFreeze extern void reference to the list then added in the switch case trigering its method from GENCMD Selected 

extern qboolean ForceDrain2(gentity_t *ent);
extern void ForceGrip(gentity_t *ent);
extern void ForceLightning(gentity_t *ent);
extern void ForceProtect(gentity_t *ent);
extern void ForceRage(gentity_t *ent);
extern void ForceSeeing(gentity_t *ent);
extern void ForceTelepathy(gentity_t *ent);
extern void ForceAbsorb(gentity_t *ent);
extern void ForceHeal(gentity_t *ent);
extern void ForceFreeze(gentity_t *ent);
static void ProcessGenericCmd(gentity_t *ent, byte cmd)
{
switch(cmd) {
default:
break;
case GENCMD_FORCE_HEAL:
ForceHeal( ent );
break;
case GENCMD_FORCE_SPEED:
ForceSpeed( ent );
break;
case GENCMD_FORCE_THROW:
ForceThrow(ent, qfalse);
break;
case GENCMD_FORCE_PULL:
ForceThrow(ent, qtrue);
break;
case GENCMD_FORCE_DISTRACT:
ForceTelepathy(ent);
break;
case GENCMD_FORCE_GRIP:
ForceGrip(ent);
break;
case GENCMD_FORCE_LIGHTNING:
ForceLightning(ent);
break;
case GENCMD_FORCE_RAGE:
ForceRage(ent);
break;
case GENCMD_FORCE_PROTECT:
ForceProtect(ent);
break;
case GENCMD_FORCE_ABSORB:
ForceAbsorb(ent);
break;
case GENCMD_FORCE_DRAIN:
ForceDrain2( ent );
break;
case GENCMD_FORCE_SEEING:
ForceSeeing(ent);
break;
case GENCMD_FORCE_FREEZE:
ForceFreeze(ent);
break;
}
}
 

 

g_itemload.cpp

 

 

I added the power to the available items in g_itemload.cpp
 

[...]else if (!Q_stricmp(tokenStr,"FP_GRIP"))
{
tag = FP_GRIP;
}
else if (!Q_stricmp(tokenStr,"FP_LIGHTNING"))
{
tag = FP_LIGHTNING;
}
else if (!Q_stricmp(tokenStr, "FP_FREEZE"))
{
tag = FP_FREEZE;
}[...]

q3_interface.h

 

 

I Added SetForceFreeze and SetForceFreezeLevel in Q3_Interface.cpp
 

SET_NO_PVS_CULL,//## %t="BOOL_TYPES" # This entity will *always* be drawn - use only for special case cinematic NPCs that have anims that cover multiple rooms!!!
SET_CLOAK, //## %t="BOOL_TYPES" # Set a Saboteur to cloak (true) or un-cloak (false).
SET_FORCE_HEAL,//## %t="BOOL_TYPES" # Causes this ent to start force healing at whatever level of force heal they have
SET_FORCE_SPEED,//## %t="BOOL_TYPES" # Causes this ent to start force speeding at whatever level of force speed they have (may not do anything for NPCs?)
SET_FORCE_PUSH,//## %t="BOOL_TYPES" # Causes this ent to do a force push at whatever level of force push they have - will not fail
SET_FORCE_PUSH_FAKE,//## %t="BOOL_TYPES" # Causes this ent to do a force push anim, sound and effect, will not push anything
SET_FORCE_PULL,//## %t="BOOL_TYPES" # Causes this ent to do a force push at whatever level of force push they have - will not fail
SET_FORCE_MIND_TRICK,//## %t="BOOL_TYPES" # Causes this ent to do a jedi mind trick at whatever level of mind trick they have (may not do anything for NPCs?)
SET_FORCE_FREEZE, //FORCE FREEZE
SET_FORCE_HEAL_LEVEL,//## %t="FORCE_LEVELS" # Change force power level
SET_FORCE_JUMP_LEVEL,//## %t="FORCE_LEVELS" # Change force power level
SET_FORCE_SPEED_LEVEL,//## %t="FORCE_LEVELS" # Change force power level
SET_FORCE_PUSH_LEVEL,//## %t="FORCE_LEVELS" # Change force power level
SET_FORCE_PULL_LEVEL,//## %t="FORCE_LEVELS" # Change force power level
SET_FORCE_MINDTRICK_LEVEL,//## %t="FORCE_LEVELS" # Change force power level
SET_FORCE_FREEZE_LEVEL,

 

 

q3_interface.cpp

 

I added the Icarus command next to the other powers in the switch case
 

case SET_FORCE_HEAL:
Q3_SetForcePower( entID, FP_HEAL, (qboolean)(Q_stricmp("true",(char*)data)==0) );
break;
case SET_FORCE_SPEED:
Q3_SetForcePower( entID, FP_SPEED, (qboolean)(Q_stricmp("true",(char*)data)==0) );
break;
case SET_FORCE_PUSH:
Q3_SetForcePower( entID, FP_PUSH, (qboolean)(Q_stricmp("true",(char*)data)==0) );
break;
case SET_FORCE_PUSH_FAKE:
ForceThrow( &g_entities[entID], qfalse, qtrue );
break;
case SET_FORCE_PULL:
Q3_SetForcePower( entID, FP_PULL, (qboolean)(Q_stricmp("true",(char*)data)==0) );
break;
case SET_FORCE_MIND_TRICK:
Q3_SetForcePower( entID, FP_TELEPATHY, (qboolean)(Q_stricmp("true",(char*)data)==0) );
break;
case SET_FORCE_GRIP:
Q3_SetForcePower( entID, FP_GRIP, (qboolean)(Q_stricmp("true",(char*)data)==0) );
break;
case SET_FORCE_LIGHTNING:
Q3_SetForcePower( entID, FP_LIGHTNING, (qboolean)(Q_stricmp("true",(char*)data)==0) );
break;
case SET_FORCE_FREEZE:
Q3_SetForcePower(entID, FP_FREEZE, (qboolean)(Q_stricmp("true", (char*)data) == 0));
break;

 

npc_stats.cpp

 

 

I made the power usable by the NPC adding it in the table of powers
 

stringID_table_t FPTable[] =
{
ENUM2STRING(FP_HEAL),
ENUM2STRING(FP_LEVITATION),
ENUM2STRING(FP_SPEED),
ENUM2STRING(FP_PUSH),
ENUM2STRING(FP_PULL),
ENUM2STRING(FP_TELEPATHY),
ENUM2STRING(FP_GRIP),
ENUM2STRING(FP_LIGHTNING),
ENUM2STRING(FP_SABERTHROW),
ENUM2STRING(FP_SABER_DEFENSE),
ENUM2STRING(FP_SABER_OFFENSE),
//new Jedi Academy powers
ENUM2STRING(FP_RAGE),
ENUM2STRING(FP_PROTECT),
ENUM2STRING(FP_ABSORB),
ENUM2STRING(FP_DRAIN),
ENUM2STRING(FP_SEE),
//EPIC CHALLENGE MOD IV POWERS
ENUM2STRING(FP_FREEZE),
{ "", -1 }
};

 

 

g_target.cpp

 

 

I added the power in list in order to make it appear in the power choice in the begining of a mission :

 

gi.cvar_set("ui_stats_absorb", va("%d",client->sess.missionStats.forceUsed[FP_ABSORB]));
gi.cvar_set("ui_stats_heal", va("%d",client->sess.missionStats.forceUsed[FP_HEAL]));
gi.cvar_set("ui_stats_mindtrick", va("%d",client->sess.missionStats.forceUsed[FP_TELEPATHY]));
gi.cvar_set("ui_stats_protect", va("%d",client->sess.missionStats.forceUsed[FP_PROTECT]));


gi.cvar_set("ui_stats_jump", va("%d",client->sess.missionStats.forceUsed[FP_LEVITATION]));
gi.cvar_set("ui_stats_pull", va("%d",client->sess.missionStats.forceUsed[FP_PULL]));
gi.cvar_set("ui_stats_push", va("%d",client->sess.missionStats.forceUsed[FP_PUSH]));
gi.cvar_set("ui_stats_sense", va("%d",client->sess.missionStats.forceUsed[FP_SEE]));
gi.cvar_set("ui_stats_speed", va("%d",client->sess.missionStats.forceUsed[FP_SPEED]));
gi.cvar_set("ui_stats_defense", va("%d",client->sess.missionStats.forceUsed[FP_SABER_DEFENSE]));
gi.cvar_set("ui_stats_offense", va("%d",client->sess.missionStats.forceUsed[FP_SABER_OFFENSE]));
gi.cvar_set("ui_stats_throw", va("%d",client->sess.missionStats.forceUsed[FP_SABERTHROW]));


gi.cvar_set("ui_stats_drain", va("%d",client->sess.missionStats.forceUsed[FP_DRAIN]));
gi.cvar_set("ui_stats_grip", va("%d",client->sess.missionStats.forceUsed[FP_GRIP]));
gi.cvar_set("ui_stats_lightning", va("%d",client->sess.missionStats.forceUsed[FP_LIGHTNING]));
gi.cvar_set("ui_stats_rage", va("%d",client->sess.missionStats.forceUsed[FP_RAGE]));


gi.cvar_set("ui_stats_freeze", va("%d", client->sess.missionStats.forceUsed[FP_FREEZE]));

 

 

g_svcmds.cpp

 

 

I added here the command line to the cmd table to have the power in cheat commands :
 

SetForceCmd SetForceTable[NUM_FORCE_POWERS] = {
{ "forceHeal", "setForceHeal", FORCE_LEVEL_3 },
{ "forceJump", "setForceJump", FORCE_LEVEL_3 },
{ "forceSpeed", "setForceSpeed", FORCE_LEVEL_3 },
{ "forcePush", "setForcePush", FORCE_LEVEL_3 },
{ "forcePull", "setForcePull", FORCE_LEVEL_3 },
{ "forceMindTrick", "setForceMindTrick", FORCE_LEVEL_4 },
{ "forceGrip", "setForceGrip", FORCE_LEVEL_3 },
{ "forceLightning", "setForceLightning", FORCE_LEVEL_3 },
{ "saberThrow", "setSaberThrow", FORCE_LEVEL_3 },
{ "saberDefense", "setSaberDefense", FORCE_LEVEL_3 },
{ "saberOffense", "setSaberOffense", SS_NUM_SABER_STYLES-1 },
{ "forceRage", "setForceRage", FORCE_LEVEL_3 },
{ "forceProtect", "setForceProtect", FORCE_LEVEL_3 },
{ "forceAbsorb", "setForceAbsorb", FORCE_LEVEL_3 },
{ "forceDrain", "setForceDrain", FORCE_LEVEL_3 },
{ "forceSight", "setForceSight", FORCE_LEVEL_3 },
{ "forceFreeze", "setForceFreeze", FORCE_LEVEL_3 },


};

cg_local.h

 

I modified the max Powers and powers to show (MAX_SHOWPOWERS from 12 to 13 and MAX_DPSHOPOWERS from 16 to 17)

#define MAX_SHOWPOWERS 13
extern int showPowers[MAX_SHOWPOWERS]; 
extern const char *showPowersName[MAX_SHOWPOWERS];
extern int force_icons[NUM_FORCE_POWERS];
#define MAX_DPSHOWPOWERS 17
 

 

 

cg_main.cpp

 

 

I gave an icon to the power ( i chose temporarly the push icon)

const char *force_icon_files[NUM_FORCE_POWERS] =
{//icons matching enums forcePowers_t
"gfx/mp/f_icon_lt_heal", //FP_HEAL,
"gfx/mp/f_icon_levitation", //FP_LEVITATION,
"gfx/mp/f_icon_speed", //FP_SPEED,
"gfx/mp/f_icon_push", //FP_PUSH,
"gfx/mp/f_icon_pull", //FP_PULL,
"gfx/mp/f_icon_lt_telepathy", //FP_TELEPATHY,
"gfx/mp/f_icon_dk_grip", //FP_GRIP,
"gfx/mp/f_icon_dk_l1", //FP_LIGHTNING,
"gfx/mp/f_icon_saber_throw", //FP_SABERTHROW
"gfx/mp/f_icon_saber_defend", //FP_SABERDEFEND,
"gfx/mp/f_icon_saber_attack", //FP_SABERATTACK,
"gfx/mp/f_icon_dk_rage", //FP_RAGE,
"gfx/mp/f_icon_lt_protect", //FP_PROTECT,
"gfx/mp/f_icon_lt_absorb", //FP_ABSORB,
"gfx/mp/f_icon_dk_drain", //FP_DRAIN,
"gfx/mp/f_icon_sight", //FP_SEE,
"gfx/mp/f_icon_dk_grip", //FP_FREEZE,


};

I added the powers to the showpowers table

int showPowers[MAX_SHOWPOWERS] =
{
	FP_ABSORB,
	FP_HEAL,
	FP_PROTECT,
	FP_TELEPATHY,

	FP_SPEED,
	FP_PUSH,
	FP_PULL,
	FP_SEE,

	FP_DRAIN,
	FP_LIGHTNING,
	FP_RAGE,
	FP_GRIP,
	FP_FREEZE,
};

I added the name in "Showpowersname"
 

const char *showPowersName[MAX_SHOWPOWERS] =
{
	"SP_INGAME_ABSORB2",
	"SP_INGAME_HEAL2",
	"SP_INGAME_PROTECT2",
	"SP_INGAME_MINDTRICK2",

	"SP_INGAME_SPEED2",
	"SP_INGAME_PUSH2",
	"SP_INGAME_PULL2",
	"SP_INGAME_SEEING2",

	"SP_INGAME_DRAIN2",
	"SP_INGAME_LIGHTNING2",
	"SP_INGAME_DARK_RAGE2",
	"SP_INGAME_GRIP2",
	"SP_INGAME_FREEZE2",

};

I added it in showdatapadpowers

int showDataPadPowers[MAX_DPSHOWPOWERS] =
{
	// Light side
	FP_ABSORB,
	FP_HEAL,
	FP_PROTECT,
	FP_TELEPATHY,

	// Core Powers
	FP_LEVITATION,
	FP_SPEED,
	FP_PUSH,
	FP_PULL,
	FP_SABERTHROW,
	FP_SABER_DEFENSE,
	FP_SABER_OFFENSE,
	FP_SEE,

	//Dark Side
	FP_DRAIN,
	FP_LIGHTNING,
	FP_RAGE,
	FP_GRIP,
	FP_FREEZE,
};

I added it in showpowersdesc
 

const char *forcepowerDesc[NUM_FORCE_POWERS] =
{
"FORCE_ABSORB_DESC",
"FORCE_HEAL_DESC",
"FORCE_PROTECT_DESC",
"FORCE_MIND_TRICK_DESC",

"FORCE_JUMP_DESC",
"FORCE_SPEED_DESC",
"FORCE_PUSH_DESC",
"FORCE_PULL_DESC",
"FORCE_SABER_THROW_DESC",
"FORCE_SABER_DEFENSE_DESC",
"FORCE_SABER_OFFENSE_DESC",
"FORCE_SENSE_DESC",

"FORCE_DRAIN_DESC",
"FORCE_LIGHTNING_DESC",
"FORCE_RAGE_DESC",
"FORCE_GRIP_DESC",
"FORCE_FREEZE_DESC",

};

And also added the powers 1,2 and 3 desc
 

const char *forcepowerLvl1Desc[NUM_FORCE_POWERS] =
{
"FORCE_ABSORB_LVL1_DESC",
"FORCE_HEAL_LVL1_DESC",
"FORCE_PROTECT_LVL1_DESC",
"FORCE_MIND_TRICK_LVL1_DESC",

"FORCE_JUMP_LVL1_DESC",
"FORCE_SPEED_LVL1_DESC",
"FORCE_PUSH_LVL1_DESC",
"FORCE_PULL_LVL1_DESC",
"FORCE_SABER_THROW_LVL1_DESC",
"FORCE_SABER_DEFENSE_LVL1_DESC",
"FORCE_SABER_OFFENSE_LVL1_DESC",
"FORCE_SENSE_LVL1_DESC",

"FORCE_DRAIN_LVL1_DESC",
"FORCE_LIGHTNING_LVL1_DESC",
"FORCE_RAGE_LVL1_DESC",
"FORCE_GRIP_LVL1_DESC",
"FORCE_FREEZE_LVL1_DESC",

};

const char *forcepowerLvl2Desc[NUM_FORCE_POWERS] =
{
"FORCE_ABSORB_LVL2_DESC",
"FORCE_HEAL_LVL2_DESC",
"FORCE_PROTECT_LVL2_DESC",
"FORCE_MIND_TRICK_LVL2_DESC",

"FORCE_JUMP_LVL2_DESC",
"FORCE_SPEED_LVL2_DESC",
"FORCE_PUSH_LVL2_DESC",
"FORCE_PULL_LVL2_DESC",
"FORCE_SABER_THROW_LVL2_DESC",
"FORCE_SABER_DEFENSE_LVL2_DESC",
"FORCE_SABER_OFFENSE_LVL2_DESC",
"FORCE_SENSE_LVL2_DESC",

"FORCE_DRAIN_LVL2_DESC",
"FORCE_LIGHTNING_LVL2_DESC",
"FORCE_RAGE_LVL2_DESC",
"FORCE_GRIP_LVL2_DESC",
"FORCE_FREEZE_LVL2_DESC",

};

const char *forcepowerLvl3Desc[NUM_FORCE_POWERS] =
{
"FORCE_ABSORB_LVL3_DESC",
"FORCE_HEAL_LVL3_DESC",
"FORCE_PROTECT_LVL3_DESC",
"FORCE_MIND_TRICK_LVL3_DESC",

"FORCE_JUMP_LVL3_DESC",
"FORCE_SPEED_LVL3_DESC",
"FORCE_PUSH_LVL3_DESC",
"FORCE_PULL_LVL3_DESC",
"FORCE_SABER_THROW_LVL3_DESC",
"FORCE_SABER_DEFENSE_LVL3_DESC",
"FORCE_SABER_OFFENSE_LVL3_DESC",
"FORCE_SENSE_LVL3_DESC",

"FORCE_DRAIN_LVL3_DESC",
"FORCE_LIGHTNING_LVL3_DESC",
"FORCE_RAGE_LVL3_DESC",
"FORCE_GRIP_LVL3_DESC",
"FORCE_FREEZE_LVL3_DESC",

};

cg_infos.cpp

 
I added the power to the list in showloaspowersname
const char *showLoadPowersName[] = 
{
	"SP_INGAME_HEAL2",
	"SP_INGAME_JUMP2",
	"SP_INGAME_SPEED2",
	"SP_INGAME_PUSH2",
	"SP_INGAME_PULL2",
	"SP_INGAME_MINDTRICK2",
	"SP_INGAME_GRIP2",
	"SP_INGAME_LIGHTNING2",
	"SP_INGAME_SABER_THROW2",
	"SP_INGAME_SABER_OFFENSE2",
	"SP_INGAME_SABER_DEFENSE2",
	"SP_INGAME_FREEZE2",
	NULL,
};

bg_pmove.cpp

 

I added the extern void and the trigger to the method of the power in PM_CheckForceButton

extern void ForceHeal( gentity_t *self );
extern void ForceTelepathy( gentity_t *self );
extern void ForceRage( gentity_t *self );
extern void ForceProtect( gentity_t *self );
extern void ForceAbsorb( gentity_t *self );
extern void ForceSeeing( gentity_t *self );
extern void ForceFreeze(gentity_t *self);
void PM_CheckForceUseButton( gentity_t *ent, usercmd_t *ucmd  )
{
	if ( !ent )
	{
		return;
	}
	if ( ucmd->buttons & BUTTON_USE_FORCE )
	{
		if (!(ent->client->ps.pm_flags & PMF_USEFORCE_HELD))
		{
			//impulse one shot
			switch ( showPowers[cg.forcepowerSelect] )
			{
			case FP_HEAL:
				ForceHeal( ent );
				break;
			case FP_SPEED:
				ForceSpeed( ent );
				break;
			case FP_PUSH:
				ForceThrow( ent, qfalse );
				break;
			case FP_PULL:
				ForceThrow( ent, qtrue );
				break;
			case FP_TELEPATHY:
				ForceTelepathy( ent );
				break;
				// Added 01/20/03 by AReis.
				// New Jedi Academy powers.
			case FP_RAGE:		//duration - speed, invincibility and extra damage for short period, drains your health and leaves you weak and slow afterwards.
				ForceRage( ent );
				break;
			case FP_PROTECT:	//duration - protect against physical/energy (level 1 stops blaster/energy bolts, level 2 stops projectiles, level 3 protects against explosions)
				ForceProtect( ent );
				break;
			case FP_ABSORB:		//duration - protect against dark force powers (grip, lightning, drain - maybe push/pull, too?)
				ForceAbsorb( ent );
				break;
			case FP_SEE:		//duration - detect/see hidden enemies
				ForceSeeing( ent );
				break;
			case FP_FREEZE:
				ForceFreeze(ent);
				break;
			}
		}

wp_saber.cpp

 

 

 

I defined the power as a DARK power

int forcePowerDarkLight[NUM_FORCE_POWERS] = //0 == neutral
{ //nothing should be usable at rank 0..
	FORCE_LIGHTSIDE,//FP_HEAL,//instant
	0,//FP_LEVITATION,//hold/duration
	0,//FP_SPEED,//duration
	0,//FP_PUSH,//hold/duration
	0,//FP_PULL,//hold/duration
	FORCE_LIGHTSIDE,//FP_TELEPATHY,//instant
	FORCE_DARKSIDE,//FP_GRIP,//hold/duration
	FORCE_DARKSIDE,//FP_LIGHTNING,//hold/duration
	0,//FP_SABERATTACK,
	0,//FP_SABERDEFEND,
	0,//FP_SABERTHROW,
	//new Jedi Academy powers
	FORCE_DARKSIDE,//FP_RAGE,//duration
	FORCE_LIGHTSIDE,//FP_PROTECT,//duration
	FORCE_LIGHTSIDE,//FP_ABSORB,//duration
	FORCE_DARKSIDE,//FP_DRAIN,//hold/duration
	0,//FP_SEE,//duration
	FORCE_DARKSIDE, //FP_FREEZE // Duration
	//NUM_FORCE_POWERS
};

i set the powers needed for this power to 30

int forcePowerNeeded[NUM_FORCE_POWERS] =
{
	0,//FP_HEAL,//instant
	10,//FP_LEVITATION,//hold/duration
	50,//FP_SPEED,//duration
	15,//FP_PUSH,//hold/duration
	15,//FP_PULL,//hold/duration
	20,//FP_TELEPATHY,//instant
	1,//FP_GRIP,//hold/duration - FIXME: 30?
	1,//FP_LIGHTNING,//hold/duration
	20,//FP_SABERTHROW,
	1,//FP_SABER_DEFENSE,
	0,//FP_SABER_OFFENSE,
	//new Jedi Academy powers
	50,//FP_RAGE,//duration - speed, invincibility and extra damage for short period, drains your health and leaves you weak and slow afterwards.
	30,//FP_PROTECT,//duration - protect against physical/energy (level 1 stops blaster/energy bolts, level 2 stops projectiles, level 3 protects against explosions)
	30,//FP_ABSORB,//duration - protect against dark force powers (grip, lightning, drain)
	1,//FP_DRAIN,//hold/duration - drain force power for health
	20,//FP_SEE,//duration - detect/see hidden 
	30 // FP_FREEZE
	//NUM_FORCE_POWERS
};

I chose the times of freezing according to the power level

int freezeTime[NUM_FORCE_POWER_LEVELS] =
{
	0,//none
	10000,//5000,
	15000,//10000,
	30000//15000
};

and i added the method for the power effect ( currently empty)

void ForceFreeze(gentity_t *self)
{
	
}

cg_local.h

 

I modified the max Powers and powers to show (MAX_SHOWPOWERS from 12 to 13 and MAX_DPSHOPOWERS from 16 to 17)

#define MAX_SHOWPOWERS 13
extern int showPowers[MAX_SHOWPOWERS]; 
extern const char *showPowersName[MAX_SHOWPOWERS];
extern int force_icons[NUM_FORCE_POWERS];
#define MAX_DPSHOWPOWERS 17
 
Link to comment

Sorry i was in hospital.

 

Holy crap. there is nothing wrong to your code edit. i experienced other time models disappering in game after code edit, but at moment i not remember when happened , why and how i fix .

the only thing i can tell is my tutorial is wrote using as basic the first version of openjk release on 2013 , now up to grade, and on these version works for sure! i have 16 new force power in my mod working without any issues.

i thinks it should depend for some strange issues of updated version.

also that i see into tutorial comment:

 

 

 

However, I had some problems when finding the function PM_CheckForceUseButton, because I think the source code changed since the writting of this tuto ^^ Indeed, I noticed this function is not in the file mentionned in the tuto : In the tuto it is said PM_CheckForceUseButton is i bg_misc.cpp, but after searching I finally found it in bg_pmove.cpp. So I think this little change could help the tuto to be up to date, even if it is already pretty cool and well explained ! :)

 

 

this is changed respect of original openjk early version. but i not think is the cause of issue. pretty strange.

sorry i cannot help you.

also because in this time i really have not head for code stuff. i feel too bad @.@

 

optherwise, i have already in my code mod a perfect working force freeze power builded some years ago merging mindtrick and force grip code... was pretty HARD to do but it work.

Smoo likes this
Link to comment

Ok, no problem, thank you for your time ! :) 

I think it may come from the new openJk versions because on the older version i created a Force Freeze power without problems, and i recently went back to JKA coding after not touching it for few mounth, so I downloaded the new OpenJK version and tried to add a power in order to remember how to code in JKA, and I had the same problem. In this momentI thought it was my bad because I wanted to go fast, but this time i re-writed the code above at least 4-5 times  and always had this problem !

I think I will re-download the OpenJK current version in order to test adding new force power in an empty project, without any code added and therefore It will show if the problem come from code added in the ECM project or from the Open JK Version.

So I will do it and tell here if the problem is still here.

But if someone else here is reading this topic and managed to add powers in new OpenJK versions without code problem I would want to know how he/she did it :3 

I keep you informed about the problem then :) 

Asgarath83 likes this
Link to comment

You need to be careful with changing anything that's related to force powers or player state. The networking code is setup to send a specific amount of data and changing the number of force powers or changing the player state can cause wrong things to be networked.

 

Take a look in msg.cpp. This is where the code decides how many bits to network for each of the player state fields (including force powers ones).

Smoo likes this
Link to comment
  • 2 weeks later...

Thanks for your response, I will check that !

And sorry for not giving much news about this problem, but my computer broke and I have to reinstall all my softwares, so i'm a little stuck at this moment.
You will have new soon ! :) 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...