Page 1 of 1
Item pickup
Posted: Tue Jan 27, 2009 6:51 pm
by Rawing
I've made it possible to pick three medkits at a time ages ago. Coz there aren't any other items than medkits in my mod, I've removed STAT_HOLDABLE_ITEM and changed the EV_USE_ITEM2 event. There's a problem with picking up medkits now; pickup_holdable looks like this:
Code: Select all
int Pickup_Holdable( gentity_t *other ) {
if ( other->client->ps.stats[STAT_MEDKITS] < 3 )
other->client->ps.stats[STAT_MEDKITS]++;
return RESPAWN_HOLDABLE;
}
Whenever you touch a medkit, the game crashes. I've just removed this line:
Code: Select all
other->client->ps.stats[STAT_HOLDABLE_ITEM] = ent->item - bg_itemlist;
It worked b4.
Re: Item pickup
Posted: Tue Jan 27, 2009 7:47 pm
by ^misantropia^
Compile the game in debug mode and run it in a debugger. After the crash, type 'bt' (in gdb) to get a stack trace. Probably a NULL pointer somewhere but hard to tell where exactly. You didn't modify the STAT_ enum, did you?
Re: Item pickup
Posted: Wed Jan 28, 2009 2:07 pm
by Rawing
Hmm, I'm using Q3Devel for compiling, is there anything like a debug mode?...
And yes, I did modify the STAT_ things, but all I did was to remove STAT_HOLDABLE_ITEM. Here it is, if you want to see it.
Code: Select all
// player_state->stats[] indexes
// NOTE: may not have more than 16
typedef enum {
STAT_HEALTH,
STAT_WEAPONS, // 16 bit fields
STAT_ARMOR_HEAD,
STAT_ARMOR_BODY,
STAT_ARMOR_LEGS,
STAT_DEAD_YAW, // look this direction when dead (FIXME: get rid of?)
STAT_CLIENTS_READY, // bit mask of clients wishing to exit the intermission (FIXME: configstring?)
STAT_MAX_HEALTH, // health / armor limit, changable by handicap
STAT_PLAYERHEAL, // amount of health player will receive through regeneration
STAT_MEDKITS, // amount of medkits in inventory
STAT_FALLINGDAMAGE // damage from falling down is saved here
} statIndex_t;
Re: Item pickup
Posted: Wed Jan 28, 2009 2:18 pm
by ^misantropia^
I suggest you put it back. Anything that is used in playerState_t is not something to be tampered with.
Re: Item pickup
Posted: Wed Jan 28, 2009 3:58 pm
by Rawing
Lol, I can't get it right anymore. I haven't saved the files before removing holdable_item (doh!), but it didn't help to add STAT_HOLDABLE_ITEM and
Code: Select all
other->client->ps.stats[STAT_HOLDABLE_ITEM] = ent->item - bg_itemlist;
I've even commented out the drawholdableitem thingy but it keeps crashing... well, I'll try to sort it out; hope I'll be lucky.
Re: Item pickup
Posted: Wed Jan 28, 2009 4:08 pm
by ^misantropia^
You don't use CVS or SVN? It's a life saver in situations like this. Simply roll back to the last known-good version and try again.
Re: Item pickup
Posted: Sat Jan 31, 2009 10:26 am
by Rawing
well, always I code something new I test it and save the files if it works

Had forgotten to do that lol... Anyway, it works again.