08 Aug, 2009, Xrakisis wrote in the 21st comment:
Votes: 0
I understand that my get_speed is going through the for loop in violence update, but im not sure how to have it check the pulse number its supposed to have for each class…..

Godwars Delux get_speed function fight.c
int get_speed( CHAR_DATA *ch )
{
int count = number_range(11,13);

if ( IS_STANCE(ch, STANCE_VIPER) && number_percent() >
ch->stance[STANCE_VIPER] * 0.5) count–;
else if ( IS_STANCE(ch, STANCE_MANTIS) && number_percent() >
ch->stance[STANCE_MANTIS] * 0.5) count–;
else if ( IS_STANCE(ch, STANCE_TIGER) && number_percent() >
ch->stance[STANCE_TIGER] * 0.5) count–;
else if ( !IS_NPC(ch) && ch->stance[0] >= 11 && ch->stance[0] <= 15 )
{
int stance = ch->stance[0];
if (number_percent() > (ch->stance[stance] * 0.5) &&
IS_SET(ch->pcdata->qstats[stance-11], QS_SUPER_SPEED)) count–;
}

if ( !IS_NPC(ch) && get_celerity(ch) > 0)
count -= (get_celerity(ch)<<1 );
if (!IS_NPC(ch) && IS_WEREWOLF(ch) && get_tribe(ch, TRIBE_SILENT_STRIDERS) > 0 )
{
if (get_tribe(ch, TRIBE_SILENT_STRIDERS) > 2 ) count -= 2;
else count–;
}
if ( !IS_NPC(ch) && IS_DEMON(ch) && IS_SET(ch->pcdata->disc[C_POWERS], DEM_SPEED) )
count-=3;
if ( IS_ITEMAFF(ch, ITEMA_SPEED) ) count–;

if (count < 2) count = 2;

if ( ch->in_room == NULL || IS_SET(ch->in_room->added_flags, ROOM2_TIMESLOW) )
count *= 2;

return count;
}


Godwars Deluxe Violence update function in fight.c
void violence_update( void )
{
CHAR_DATA *ch;
CHAR_DATA *ch_next;
CHAR_DATA *victim;
CHAR_DATA *rch;
CHAR_DATA *rch_next;
CHAR_DATA *mount;

for ( ch = first_fight; ch != NULL; ch = ch_next )
{
ch_next = ch->next_fight;

if ( ( victim = ch->fighting ) == NULL || ch->in_room == NULL )
{
stop_fighting(ch, FALSE);
continue;
}

if ( IS_AWAKE(ch) && IS_AWAKE(victim) &&
ch->in_room == victim->in_room )
{
if ( –ch->init <= 0 )
{
multi_hit( ch, victim, TYPE_UNDEFINED );
ch->init = get_speed(ch);
}
else continue;
}
else
stop_fighting( ch, FALSE );

if ( ( victim = ch->fighting ) == NULL )
{
stop_fighting(ch, FALSE);
continue;
}

/*
* Fun for the whole family!
*/
for ( rch = ch->in_room->people; rch != NULL; rch = rch_next )
{
rch_next = rch->next_in_room;

if ( IS_AWAKE(rch) && rch->fighting == NULL )
{
/*
* Mount's auto-assist their riders and vice versa.
*/
if ( (mount = rch->mount) != NULL )
{
if (mount == ch) multi_hit( rch, victim, TYPE_UNDEFINED );
continue;
}
/*
* PC's auto-assist others in their group.
*/
if ( !IS_NPC(ch) || IS_AFFECTED(ch, AFF_CHARM) )
{
if ( ( !IS_NPC(rch) || IS_AFFECTED(rch, AFF_CHARM) )
&& is_same_group(ch, rch) )
multi_hit( rch, victim, TYPE_UNDEFINED );
continue;
}

/*
* NPC's assist NPC's of same type or 12.5% chance regardless.
*/
if ( IS_NPC(rch) && !IS_AFFECTED(rch, AFF_CHARM) )
{
if ( rch->pIndexData == ch->pIndexData
|| number_bits( 3 ) == 0 )
{
CHAR_DATA *vch;
CHAR_DATA *target;
int number;

target = NULL;
number = 0;
for ( vch = ch->in_room->people; vch; vch = vch->next )
{
if ( can_see( rch, vch )
&& is_same_group( vch, victim )
&& number_range( 0, number ) == 0 )
{
target = vch;
number++;
}
}

if ( target != NULL )
multi_hit( rch, target, TYPE_UNDEFINED );
}
}
}
}
}

return;
}



my get_speed function in update.c

int get_speed (CHAR_DATA * ch)
{
static int pulse_violence;


if (ch->class == 0) pulse_violence = 5; // sor
if (ch->class == 1) pulse_violence = 2; // bishop
if (ch->class == 2) pulse_violence = 2; // ninja
if (ch->class == 3) pulse_violence = 20; // hoplite
if (ch->class == 4) pulse_violence = 2; // templar
if (ch->class == 5) pulse_violence = 2; // avenger
if (ch->class == 6) pulse_violence = 2; // lich
if (ch->class == 7) pulse_violence = 2; // shaman
if (ch->class == 8) pulse_violence = 2; // druid
if (ch->class == 9) pulse_violence = 2; // assassin
if (IS_NPC(ch)) pulse_violence = 20;
return pulse_violence;
}
08 Aug, 2009, Xrakisis wrote in the 22nd comment:
Votes: 0
Thanks guys.. i think i got it working.. Thank you Kline and KaVir

int get_speed (CHAR_DATA * ch)
{
int count = 21;
char buf[MAX_STRING_LENGTH];

if (ch->class == 0) count–; // sorcerer
if (ch->class == 1) count -= 3; // bishop
if (ch->class == 2) count -= 9; // ninja
if (ch->class == 3) count -= 11; // hoplite
if (ch->class == 4) count -= 9; // templar
if (ch->class == 5) count -= 8; // avenger
if (ch->class == 6) count–; // lich
if (ch->class == 7) count -= 3; // shaman
if (ch->class == 8) count -= 3; // druid
if (ch->class == 9) count -= 9; // assassin
// if (IS_NPC(ch)) count–;

sprintf (buf, "Violence Pulse: %d.\n\r", count);
send_to_char (buf, ch);


return count;
}
08 Aug, 2009, Xrakisis wrote in the 23rd comment:
Votes: 0
So far only seems to be only one bug..
Once a player kills a mob, it sets him to fighting another.. but the player cant retaliate,
and sometimes the mob thats attacking the player after a kill isnt even the one in the room.

Not sure whats causing this? any help would be greatly appreciated.. any functions i can post
i will, -Xrakisis, Ian Shirm
08 Aug, 2009, Xrakisis wrote in the 24th comment:
Votes: 0
here are two functions
sorry for posting my questions just stumped……

void violence_update (void)
{
CHAR_DATA *ch;
CHAR_DATA *ch_next;
CHAR_DATA *victim;

for (ch = first_fight; ch != NULL; ch = ch_next)
{
ch_next = ch->next_fight;

if ( ch->action[0] == ACTION_CASTING )
update_casting(ch);


if ((victim = ch->fighting) == NULL || ch->in_room == NULL)
{
stop_fighting(ch, FALSE);
continue;
}
if ( IS_AWAKE(ch) && IS_AWAKE(victim) &&
ch->in_room == victim->in_room )
{
if ( –ch->init <= 0 )
{
multi_hit( ch, victim, TYPE_UNDEFINED );
ch->init = get_speed(ch);
}
else continue;
}
else
stop_fighting( ch, FALSE );

if ((victim = ch->fighting) == NULL)
{
stop_fighting(ch, FALSE);
continue;
}

/*
* Fun for the whole family!
*/
check_assist (ch, victim);

if (IS_NPC (ch))
{
if (HAS_TRIGGER (ch, TRIG_FIGHT))
mp_percent_trigger (ch, victim, NULL, NULL, TRIG_FIGHT);
if (HAS_TRIGGER (ch, TRIG_HPCNT))
mp_hprct_trigger (ch, victim);
}
}

return;
}




void update_casting(void)
{
CHAR_DATA *ch, *ch_next;

// AWESOME SPELL SYSTEM!
for ( ch = first_fight; ch != NULL; ch = ch_next )
{
ch_next = ch->next_fight;

// Booya baby!
if (ch->spell_timer > 0)
{
ch->spell_timer–;
if(number_range(0, 7) == 3)
act_cast(ch);
}

// This is what happens to people that cast
if (ch->spell_timer == 1)
{
char buf[MSL];

// Always display the cast message!
act_final(ch);

// Ensure we are do not exceed our max (memory-leak protection)
snprintf(buf, MSL, "%s %s", ch->casting, ch->casting2);

// Initiate the command
do_function(ch, &do_cast, buf);

// Free the characters casting data
free_cast(ch);

// Ensure buf is nul, as to prevent memory leaks (heed my advice!)
buf[0] = '\0';
}
}
return;
}
20.0/24