08 Aug, 2009, Xrakisis wrote in the 1st comment:
Votes: 0
Hi im makeing it so differant classes have differnat round times.. but im having a small problem..

update.c

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


if (ch->class == 0) pulse_violence = 2; // 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;
}

the numbers are strange cause im testing it.. my alt is a Hoplite, but his roundtime is still only 2 or at least it seems like it because rounds come in rapid succession…

update handler
if (–pulse_violence <= 0)
{
pulse_violence = get_pulse(ch);
violence_update ();
}

am i doing something wrong, where my hoplite char, isnt getting the pulse_violence 20 for roundtime while fighting?
08 Aug, 2009, Kline wrote in the 2nd comment:
Votes: 0
violence_update() is a MUD-wide thing. So in your total MUD char_list there is probably a NPC/PC still using "2" for theirs, which then forces the update for everybody after only "2". Does this make sense?
08 Aug, 2009, Xrakisis wrote in the 3rd comment:
Votes: 0
i saw a rom mud with roundtime, and liked it.. wanted to do something simliar.. am i going about this the wrong way?
08 Aug, 2009, Xrakisis wrote in the 4th comment:
Votes: 0
Quote
violence_update() is a MUD-wide thing. So in your total MUD char_list there is probably a NPC/PC still using "2" for theirs, which then forces the update for everybody after only "2". Does this make sense?


isnt the pulse for violence update only mud wide because its the same length of time for everyone when it calls on PULSE_VIOELENCE? and isnt violence update still just between a ch and a vict?
08 Aug, 2009, David Haley wrote in the 5th comment:
Votes: 0
violence_update causes the entire MUD to progress a round, not a single character. You would need to track the pulses per character, and in the update function, only process those who are ready. It will be a fair bit more complicated than what you've got so far.
08 Aug, 2009, Kline wrote in the 6th comment:
Votes: 0
Go look in fight.c – that's probably where your violence_update() is.

The first thing it does is iterate through every single character on the MUD. So with what you have now, you should see "some" rounds as longer, not all. It will keep firing every 2 pulses for the majority if your characters then take 20 pulses every time it finds a Hoplite.

Out of curiosity, did you modify your update_handler() to accept a player? Because the default one should just be a void function.
08 Aug, 2009, Kline wrote in the 7th comment:
Votes: 0
If you're truly wanting characters to have different rounds, grab a copy of AckFUSS and grep for "speed". You can see how I wrote that system which (in my implementation) gives each hand a separate speed, but you could easily modify it just per-player instead of per-player-per-hand.
08 Aug, 2009, Xrakisis wrote in the 8th comment:
Votes: 0
void update_handler (void)
{
static int pulse_area;
static int pulse_mobile;
static int pulse_violence;
static int pulse_point;
CHAR_DATA *ch;


void update_handler (void) do i need to change the void in this to something?
08 Aug, 2009, Xrakisis wrote in the 9th comment:
Votes: 0
is this what you wanted me to look at?

float get_speed( CHAR_DATA *ch, int slot )
{
float value = 4.00;
int i;
OBJ_DATA *wield;

if( !IS_NPC(ch) )
{
switch(slot) {
case SPEED_LH: wield = get_eq_char(ch,WEAR_HOLD_HAND_L); break;
case SPEED_RH: wield = get_eq_char(ch,WEAR_HOLD_HAND_R); break;
case SPEED_TAIL: wield = NULL; break;
default: wield = NULL; break;
}
if( wield != NULL && wield->item_type == ITEM_WEAPON )
value = wield->speed;
else
{
if( slot == SPEED_TAIL )
value = number_range(30,60);
for( i = ch->level; i > 0; i– )
value -= 0.01;
}
}
else
{
for( i = ch->level; i > 0 && value > 0.99; i -= 13 )
value -= 0.14;
}
value += stance_app[ch->stance].speed_mod;
if( (IS_NPC(ch) && IS_SET(ch->npcdata->skills,MOB_REFLEXES) && number_percent() < 80) || (!IS_NPC(ch) && number_percent() < ch->pcdata->learned[gsn_enhanced_reflexes]) )
value -= 0.02;
if( (IS_NPC(ch) && IS_SET(ch->npcdata->skills,MOB_SLEIGHT) && number_percent() < 80) || (!IS_NPC(ch) && number_percent() < ch->pcdata->learned[gsn_sleight_of_hand]) )
value -= 0.04;
if( (IS_NPC(ch) && IS_SET(ch->npcdata->skills,MOB_QUICKSTRIKE) && number_percent() < 80) || (!IS_NPC(ch) && number_percent() < ch->pcdata->learned[gsn_quickstrike]) )
value -= 0.06;

if( value < 1 )
value = 1;

return value;
}
08 Aug, 2009, Kline wrote in the 10th comment:
Votes: 0
That's part of it, yes, also look at combat_update() in fight.c Then you'll see how I've got "rounds" of different speeds among everybody.
08 Aug, 2009, Xrakisis wrote in the 11th comment:
Votes: 0
Hmm.. Im not sure what im supposed to take away from this.. Im dont know much about for..

void combat_update( void )
{
FIGHT_DATA *fight;
CHAR_DATA *ch;
CHAR_DATA *victim;

for( fight = first_fight; fight != NULL; fight = fight->next )
{
if( fight->ch == NULL )
{
//monitor_chan("Removing a null fight->ch from queue.",MONITOR_DEBUG);
UNLINK(fight,first_fight,last_fight,next,prev);
delete fight;
return;
}
if( fight->ch->fighting == NULL )
{
//monitor_chan("Removing a null fight->ch->fighting from queue.",MONITOR_DEBUG);
UNLINK(fight,first_fight,last_fight,next,prev);
delete fight;
return;
}
ch = fight->ch;
victim = ch->fighting;

/*
* Speed based combat. Arms attack independantly of each other,
* as do special racials such as fangs or tails. –Kline
*/
if( ch->position == POS_FIGHTING && victim != NULL )
{
/* Left hand attack (primary) */
ch->speed[SPEED_LH] -= 0.01;

if( ch->speed[SPEED_LH] <= 0 )
{
one_hit(ch, victim, TYPE_UNDEFINED);
ch->speed[SPEED_LH] = get_speed(ch,SPEED_LH);
}

/* Right hand attack (if we dualwield) */
if( (IS_NPC(ch) && IS_SET(ch->npcdata->skills,MOB_DUALWIELD)) || (!IS_NPC(ch) && ch->pcdata->learned[gsn_dualwield] > 10) )
{
ch->speed[SPEED_RH] -= 0.01;

if( ch->speed[SPEED_RH] <= 0 )
{
one_hit(ch, victim, TYPE_UNDEFINED);
ch->speed[SPEED_RH] = get_speed(ch,SPEED_RH);
}
}

/* Tail attack (if we have one) */
if( IS_SET(race_table[ch->race].race_flags,RACE_MOD_TAIL) )
{
ch->speed[SPEED_TAIL] -= 0.01;

if( ch->speed[SPEED_TAIL] <= 0 )
{
one_hit(ch,victim,(TYPE_HIT + 13));
ch->speed[SPEED_TAIL] = get_speed(ch,SPEED_TAIL);
}
}
}
}
}
08 Aug, 2009, Xrakisis wrote in the 12th comment:
Votes: 0
for my purposes is for supposed to go through the char list, check class and set the PULSE_VIOLENCE?
08 Aug, 2009, Kline wrote in the 13th comment:
Votes: 0
Wow I still have UNLINK lists? You musta grabbed an older version…lol Anyhow.

for( … ) just loops through something. Here's a very basic example for you to read up on: http://www.morrowland.com/apron/tutorial...

I created a separate list of characters from the char_list, of only ones who are fighting. combat_update() loops through that list, decrements the speed counters, attacks when they reach 0, then resets them with get_speed().
08 Aug, 2009, Xrakisis wrote in the 14th comment:
Votes: 0
Thanks for the link Kline, i found it very informative..

Should i port over your list of who is fighting from ACKFUSS to my rom?

Then am i supposed to check who is fighting, and if char fighting is hoplite pulse_violence = x?
08 Aug, 2009, Kline wrote in the 15th comment:
Votes: 0
I'd start off just using your char_list, and if you're successful with that, make a separate list of only who is fighting so you're not iterating through 100 NPC/Players if only like…5 are fighting. You won't be able to just change pulse_violence, though, you'll need to start storing a speed value on each character.
08 Aug, 2009, Xrakisis wrote in the 16th comment:
Votes: 0
should it be something similar to this?

when setting class…
if (ch->class == 0) ch->roundtime = 18; // sorcerer

in int get_pulse(ch)
for ( ch = char_list; ch != NULL; ch = ch_next )
{
if (IS_NPC(ch) pulse_violence = 20;
if (!IS_NPC(ch) pulse_violence = ch->roundtime;
return;
}
08 Aug, 2009, KaVir wrote in the 17th comment:
Votes: 0
The combat in GodWars Deluxe works that way as well - perhaps looking at multiple examples will make it easier to understand. If you grab a copy from the Code Repository you can check the violence_update() and get_speed() functions in update.c to see how it works.
08 Aug, 2009, Xrakisis wrote in the 18th comment:
Votes: 0
is this what i should be looking at? add in first fight?

for ( ch = first_fight; ch != NULL; ch = ch_next )
{
ch_next = ch->next_fight;
08 Aug, 2009, Xrakisis wrote in the 19th comment:
Votes: 0
I put in first_fight, prev_fight and next_fight from GW Deluxe
I also put in ch->roundtime, and read and write in save.c
Not sure where to go from here..

Edit: Also just put init in save.c and violence_update in fight.c
Also renamed get_pulse to get_speed..
08 Aug, 2009, Xrakisis wrote in the 20th comment:
Votes: 0
hmm.. i think im missing something..
0.0/24