19 Feb, 2013, thebigirish wrote in the 1st comment:
Votes: 0
Okay so I'm fairly new to coding. I've been reading online c++ books, and going through tutorials and such but the learning is limited. I need more hands on examples lol. I have the following code, and basically what happens is when an immportal sets their powerlevel up high, he/she then gets spammed with energy/prac/stat gain messages, until they catch up. I'm pretty sure all I'd need to do is add like…. an else if (IS_IMMORTAL(ch) …… but not sure exactly where I'd put it :S heh little help for a learning newbie please?


if (!IS_NPC(ch))
{
kigain = number_range( 30, 40);
kigain *= get_curr_con(ch) / 5;
kicheck = (ch->skigain * ch->skigain) * 1000;
/* if (!IS_SET( ch->pcdata->flags, PCFLAG_DEADLY ))
{ SET_BIT(ch->pcdata->flags, PCFLAG_DEADLY); }*/

if (kicheck <= ch->exp)
{
ch->max_mana += kigain;
ch_printf(ch, "You feel stronger all of the sudden. You gain %d energy!\n\r", kigain);
ch->skigain += 1;
}
pracgain = 1;
praccheck = (ch->spracgain * ch->spracgain) * 250000;
if (praccheck <= ch->exp)
{
ch->practice += pracgain;
ch_printf(ch, "You have gained %d practice session(s)\n\r", pracgain);
ch->spracgain += 1;
}
statgain = 1;
statcheck = (ch->statgain * ch->statgain) * 12300;
if (statcheck <= ch->exp)
{
ch->stat += statgain;
ch_printf(ch, "You have gained %d attribute training session(s)\n\r", statgain);
ch->statgain += 1;
}
}
19 Feb, 2013, thebigirish wrote in the 2nd comment:
Votes: 0
Wow the above looked really really horrible so I'm going to post in a message here and see…. sorry guys.


if (!IS_NPC(ch))
{
kigain = number_range( 30, 40);
kigain *= get_curr_con(ch) / 5;
kicheck = (ch->skigain * ch->skigain) * 1000;
/* if (!IS_SET( ch->pcdata->flags, PCFLAG_DEADLY ))
{ SET_BIT(ch->pcdata->flags, PCFLAG_DEADLY); }*/

if (kicheck <= ch->exp)
{
ch->max_mana += kigain;
ch_printf(ch, "You feel stronger all of the sudden. You gain %d energy!\n\r", kigain);
ch->skigain += 1;
}
pracgain = 1;
praccheck = (ch->spracgain * ch->spracgain) * 250000;
if (praccheck <= ch->exp)
{
ch->practice += pracgain;
ch_printf(ch, "You have gained %d practice session(s)\n\r", pracgain);
ch->spracgain += 1;
}
statgain = 1;
statcheck = (ch->statgain * ch->statgain) * 12300;
if (statcheck <= ch->exp)
{
ch->stat += statgain;
ch_printf(ch, "You have gained %d attribute training session(s)\n\r", statgain);
ch->statgain += 1;
}
}
19 Feb, 2013, thebigirish wrote in the 3rd comment:
Votes: 0
Okay I got it working…. rofl. I replaced:
if ( !IS_NPC(ch))
with
if ( !IS_NPC(ch) && ch->level < LEVEL_IMMORTAL )
Now it works how it should. What an easy fix! :D I feel a little silly, but like I said I'm new lol.
0.0/3