Welcome to the Builder Academy

Question Questionnaire idea

More
06 May 2013 17:06 - 06 May 2013 17:08 #2152 by Papaya Pete
Replied by Papaya Pete on topic Questionnaire idea
So I said I wasn't going to ask for help on this... but heh! Guess things don't work out as we plan sometimes.

Actually, I've been doing pretty well at getting this to work. There is just one snag, however: for some reason, one of the CASEs in a switch statement is always being chosen! Here's the little snippet...
Code:
} else GET_CLASS(d->character) = load_result; write_to_output(d, "\r\nHmmm... interesting..."); write_to_output(d, "\r\nI'm going to ask you a series of questions that will tell me about yourself."); write_to_output(d, "\r\n\r\nPlease note that your decisions will have an impact on your character!"); write_to_output(d, "\r\nNow then... let's begin..."); write_to_output(d, "\r\n\r\n\r\nWhich would you want more? Health, Mana, or Move?\r\n%s", quizchoice_menu); STATE(d) = CON_QQUIZ; break; case CON_QQUIZ: // Please note that there is already a break for this case: you don't need to add one. load_result = parse_quiz(*arg); if (load_result == QUIZ_UNDEFINED) { write_to_output(d, "\r\nSorry, that's not a valid choice."); return; } else { switch (load_result) { case QUIZ_CHOICE1: d->character->points.max_hit = 100; break; case QUIZ_CHOICE2: d->character->points.max_mana = 100; break; case QUIZ_CHOICE3: d->character->points.max_move = 100; break; } }

I'm just using this as an example, just to see if it will work. Now you're given a choice between getting a boost for hp, mana, or move. Problem is, no matter what choice you get, you get an additional 100 mana including whatever choice you made.

For example, you take the bonus health. You get the bonus HP and the bonus mana. You take movement. You get the bonus move and the bonus mana. But when you get the bonus mana, you get just that.

Likely this is just something really small I'm overlooking. The last step I'm going to work on after getting this to work (since I know how to mod existing ability scores, thank you Kewlb!) is figuring out how to mod skill levels in interpreter.c.

This is going surprisingly quick, though.
Last edit: 06 May 2013 17:08 by Papaya Pete. Reason: Included a few more lines of code to reflect the changes that have been made.

Please Log in or Create an account to join the conversation.

More
06 May 2013 17:15 #2154 by Fizban
Replied by Fizban on topic Questionnaire idea
I think the issue is that you have this:
Code:
switch (load_result) { case QUIZ_CHOICE1: d->character->points.max_hit = 100; break; case QUIZ_CHOICE2: d->character->points.max_mana = 100; break; case QUIZ_CHOICE3: d->character->points.max_move = 100; break; }

when what you actually are trying to do would be:
Code:
switch (load_result) { case QUIZ_CHOICE1: d->character->points.max_hit += 100; break; case QUIZ_CHOICE2: d->character->points.max_mana += 100; break; case QUIZ_CHOICE3: d->character->points.max_move += 100; break; }

Specifically, your case isn't raising any of those stats by 100, it's setting them to 100, I haven't checked, but I'm going to guess that default starting mana is 100, so it appears to you as if it is being increased by 100 when it is actually 100 whether that case is called or not since that case is setting a value to 100 when it is already equal to 100 before the case in question is called.

Please Log in or Create an account to join the conversation.

More
06 May 2013 17:34 - 06 May 2013 18:17 #2156 by Papaya Pete
Replied by Papaya Pete on topic Questionnaire idea
[strike]Actually I was double-checking that... at this point, when you're being quizzed, none of your stats, mana, hp, etc. has been set to anything. The default amount of mana is 100, like you said. What's happening is that, whether you pick hp, mana, or move, it's being kicked up to 200. I changed class.c a little to make GET_MAX_HP(ch) (etc.) to, in the instance of max mana, GET_MAX_MANA(ch) += 100;[/strike]

This might start getting a little tricky. For instance, I was planning on making the quiz being able to mod your stats. Where it is at now, with no stats, makes it more difficult. Might be good to perform the roll_real_abils function at the beginning of the quiz. For instance... putting it here:
Code:
case CON_QQUIZ: // Please note that there is already a break for this case: you don't need to add one. roll_real_abils(d->character); // Roll stats here instead load_result = parse_quiz(*arg); if (load_result == QUIZ_UNDEFINED) { write_to_output(d, "\r\nSorry, that's not a valid choice."); return;

I did a little bit of testing. I kept the quiz from being able to make any changes to mana and such. what I did do was the following in class.c...
Code:
void do_start(struct char_data *ch) { GET_LEVEL(ch) = 1; GET_EXP(ch) = 1; set_title(ch, NULL); roll_real_abils(ch); GET_MAX_HIT(ch) += 20; if (IS_DWARF(ch)) // Dwarves are stockier than other races. GET_MAX_HIT(ch) += 40; GET_MAX_MANA(ch) += 100; GET_MAX_MOVE(ch) += 82; if (IS_DWARF(ch)) // While it takes them longer to travel, they have higher stamina. GET_MAX_MOVE(ch) += 100;

Strangely enough, everything works just fine (I've had it this way when I started working on the quiz). After removing the quiz's effects though... starting a new character still generates someone with 200 mana. Likely, perhaps, it's set when the save_char function is called after verifying a password. Maybe it has something to do with PFDEF_MAXMANA?

Anyways, thanks for the help and for listening. :)
Last edit: 06 May 2013 18:17 by Papaya Pete. Reason: Discovered something...

Please Log in or Create an account to join the conversation.

More
06 May 2013 22:33 #2163 by Kewlb
Replied by Kewlb on topic Questionnaire idea
in do start instead of GET_MAX_MANA(ch) += 100; make it GET_MAX_MANA(ch) = 100;

Please Log in or Create an account to join the conversation.

More
07 May 2013 23:45 - 08 May 2013 06:26 #2170 by Papaya Pete
Replied by Papaya Pete on topic Questionnaire idea
Ok, after going to a friend of mine who knows MUCH more about coding and circlemud than I do... he helped me to see what mistakes I had made and what things I did not take into consideration (thanks Rob!).

Snippet is done. [strike]Going to clean it up and upload tomorrow.[/strike]

I cleaned it up a bit and uploaded it. The only thing I didn't do was put in switch statements instead of if-thens (sorry, got a little lazy there).

Hope you folks enjoy it.
Last edit: 08 May 2013 06:26 by Papaya Pete. Reason: Got it uploaded.
The following user(s) said Thank You: zusuk

Please Log in or Create an account to join the conversation.

Time to create page: 0.192 seconds