![]() |
hacking monster_plugin
ok so I guess I just dont get it...
I've decided I'd like to change monster_plugin in a way that allows for team based monsters. To just test things for now I've changed barney to be assigned to v.team = 1. This works, I see his v.team assignment when I query using pmtools... so next step is to hack monsters.cpp in the BestVisibleEnemy() function to ignore players on same team as the monsters v.team right? ok so here is a my modified chunk of that function... Code:
edict_t *CMBaseMonster :: BestVisibleEnemy ( void ) btw that testing console output does work... *** MONSTER TEAM IS 1 *** MONSTER'S ENEMY TEAM IS 2 right now I have barneys team statically set to 1... I see no errors before crash, I dont even get that MONSTER TEAM IS part before crash unless I comment the if statement I added... I dont get it. pulling out hair here and know its something simple/stupid |
Re: hacking monster_plugin
oh and server dont crash if I dont spawn any barneys if that helps...
|
Re: hacking monster_plugin
did you check if pev or pEnt is NULL?
[edit] or maybe a memory error from somewhere else... [/edit] |
Re: hacking monster_plugin
first off keep in mind that I am a php dev and a newbie C hacker...
but printf("*** MONSTER TEAM IS %i\n",pev->team); printf("*** MONSTER'S ENEMY TEAM IS %i\n",pEnt->v.team); these return data... |
Re: hacking monster_plugin
comment out the part of the code that is causing the crashing and see if it still crashes..
|
Re: hacking monster_plugin
yeah did that. see code in first post? If I comment out the if statement all is fine... or if I dont comment it and dont spawn any barneys its fine so I know its that if statement...
// lets see if this monster shares same team as player if team based mod... if ( ( pev->team != pEnt->v.team ) || ( pEnt->v.team == 0 ) ) { |
Re: hacking monster_plugin
weird... this code is NOT crashing...
Code:
if ( UTIL_IsPlayer(pEnt) ) |
Re: hacking monster_plugin
i am not entirely sure why it crashes, though something tells me that somehow the information you try to print is not initialized properly.
Try this, first try to output the first sentence, but comment out the second one. Then try the second one only and comment out the first one. DO NOT change team data or whatever, simply try to print out the data. If that crashes, it means the data is not initialized. Make sure it IS. The piece of code in the latest post does a check on this data, thats why it is probably not crashing. Though i wonder if it works like you want it to work? |
Re: hacking monster_plugin
shouldn't that be
Code:
printf("*** MONSTER TEAM IS %d\n",pev->team); |
Re: hacking monster_plugin
I was under the impression that d and i are both int, but none the less that portion of the test code is working correctly...
|
All times are GMT +2. The time now is 04:34. |
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.