Possible New Attack System

Newbie Spellweaver
Joined
Oct 31, 2006
Messages
20
Reaction score
0
Her is some code i have been working on its for the mosters attack power but it jusat doesnt work correctly...maybe someone out the can go off of what i did and make it that much better.

// -------------- UPDATE MONSTER ATTACK AND OR MOVEMENT STOPPERS --------------
for(unsigned i=0; i<MonsterList.size(); i++) {
CMonster* thismon = MonsterList;
CWorldClient* thisclient = GetClientByID( thismon->targetid );
if (thisclient==0) continue;

float dx=thismon->pos.x - thisclient->pos.x;
float dy=thismon->pos.y - thisclient->pos.y;
clock_t etime = clock() - thismon->lastAttackTime;
if (etime > 0.9*CLOCKS_PER_SEC && abs(dx*dx+dy*dy) <= 0) {

srand((unsigned)time(0));
int hitpower;
int multiplier;
int hitpowertotal;
int lowest=0, highest=100;
int lowest3=0, highest3=1;
int range=(highest-lowest)+1;
int range3=(highest3-lowest3)+1;
for (int index=0; index<20; index++)
multiplier = lowest+int(range3*rand()/(RAND_MAX + 1.0));
hitpower = lowest+int(range*rand()/(RAND_MAX + 1.0))-((thisclient->c_dex/4)+(thisclient->c_str/2));
if (multiplier = 0)
{

int lowest2=1, highest2=2;
int range2=(highest2-lowest2)+1;
for (int index=0; index<20; index++)
hitpowertotal = hitpower*lowest2+int(range2*rand()/(RAND_MAX + 1.0))-((thisclient->c_dex/4)+(thisclient->c_str/2));
thisclient->c_currenthp -= hitpowertotal;
}
else
{

hitpowertotal = hitpower;
thisclient->c_currenthp -= hitpowertotal;;
}

BEGINPACKET( pak, 0x799 );
ADDWORD( pak, thismon->clientid );
ADDWORD( pak, thisclient->clientid );
ADDDWORD( pak, hitpower );
ADDDWORD( pak, (thisclient->c_currenthp<=0)?16:0 );
SendToVisible( &pak, thismon );

thismon->lastAttackTime = clock();
}
}
 
Well we made a perfect attack code, and it's like 3 lines. There are easy resolutions to problems, people just got to think logical when it comes to C++.
 
I think he has his reasons, but i will test your code if i get my Visual C++ working again cuz 'trial' (30 days) has expired and now i must register and i don't want to xD
Maybe solution to it?
 
Well we made a perfect attack code, and it's like 3 lines. There are easy resolutions to problems, people just got to think logical when it comes to C++.
perfect attack code in 3 lines?? i dont think thats posible because you have to count stats/weapon/stats in equip/defense(enemy)/hitrate/dodge(enemy)
 
lol hes right perfect can mean anything to different people
but it must be a decent code if he says it perfect right
 
Visual C++ is free, you just need to enter your e-mail adress at the site :p
I think that's the point...
Those wimps are asking for my info etc.
dinobotclone - Possible New Attack System - RaGEZONE Forums


Should i do it?
What did others do?
 
Back