Questionnaire idea

  • Papaya Pete
  • Papaya Pete's Avatar Topic Author
  • Offline
  • Gold Boarder
  • Gold Boarder
More
5 years 2 weeks ago #2106 by Papaya Pete
Papaya Pete created the topic: Questionnaire idea
Anyone here remember playing Arena, Daggerfall, etc. in which they used a questionnaire to determine what class you played? I have an idea of doing something similar, but instead using it to modify your character's stats, skills, etc.

Is this something anyone else would be interested in? If so I can upload it once it's complete.

This is also going to be my first attempt at not asking for help on something, as I'd like to build on my coding skills. Anyways, sharing is caring, so let me know if this is something anyone else wants. If I do post, I'll try to make it so it will work on stock tbaMUD.

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

More
5 years 2 weeks ago #2107 by Kewlb
Kewlb replied the topic: Questionnaire idea
I gave the ability for the player to set stats based on a pool of available points. I will post it up here and maybe it will help you get your code together.

You could edit this slightly and save a bit array of flags for answers to questions and assign stats at the end based on all the flags they have set.


added the following to interpreter.c in their appropriate places. I also added tmpint and selection (both integers) to the descriptor struct in structs.h. I removed classes in my mud so this is right after choosing sex.. for you it could be after choosing class or race depending on if you put races in. You also have to add this CON to structs.h.
    /* CLASS WAS ASSIGNED HERE */

      if (d->olc) {
        free(d->olc);
        d->olc = NULL;
      }
      if (GET_PFILEPOS(d->character) < 0)
      GET_PFILEPOS(d->character) = create_entry(GET_PC_NAME(d->character));
    /* Now GET_NAME() will work properly. */
    init_char(d->character);

	d->tmpint = 15;
	vitals_menu(d);
	STATE(d) = CON_VITALSMENU;
	break;

		case CON_VITALSMENU:
		switch (*arg) {
			case 'v':
			case 'V':
				d->selection = 0;
				write_to_output(d, "What do you want your vision to be? (5-20) : ");
				STATE(d) = CON_EDITVITALS;
			break;
			case 'i':
			case 'I':
				d->selection = 1;
				write_to_output(d, "What do you want your invincibility to be? (5-20) : ");
				STATE(d) = CON_EDITVITALS;
			break;
			case 't':
			case 'T':
				d->selection = 2;
				write_to_output(d, "What do you want your technology to be? (5-20) : ");
				STATE(d) = CON_EDITVITALS;
			break;
			case 'a':
			case 'A':
				d->selection = 3;
				write_to_output(d, "What do you want your agility to be? (5-20) : ");
				STATE(d) = CON_EDITVITALS;
			break;
			case 'l':
			case 'L':
				d->selection = 4;
				write_to_output(d, "What do you want your luck to be? (5-20) : ");
				STATE(d) = CON_EDITVITALS;
			break;
			case 's':
			case 'S':
				d->selection = 5;
				write_to_output(d, "What do you want your strength to be? (5-20) : ");
				STATE(d) = CON_EDITVITALS;
			break;
			case 'q':
			case 'Q':
				if (d->tmpint == 0) {
					d->tmpint = 0;
					d->selection = 0;
					save_char(d->character);
					save_player_index();
					write_to_output(d, "%s\r\n*** PRESS RETURN TO ENTER BODY: ", motd);
					STATE(d) = CON_RMOTD;
					/* make sure the last log is updated correctly. */
					GET_PREF(d->character)= rand_number(1, 128000);
					GET_HOST(d->character)= strdup(d->host);
					mudlog(NRM, LVL_GOD, TRUE, "%s [%s] new player.", GET_NAME(d->character), d->host);

					/* Add to the list of 'recent' players (since last reboot) */
					if (AddRecentPlayer(GET_NAME(d->character), d->host, TRUE, FALSE) == FALSE)
					{
						mudlog(BRF, MAX(LVL_IMMORT, GET_INVIS_LEV(d->character)), TRUE, "Failure to AddRecentPlayer (returned FALSE).");
					}
					break;				
				} else {
					vitals_menu(d);
					write_to_output(d, "You can't quit until you assign all points\r\n");
					write_to_output(d, "What stat do you wish to edit? : ");
					return;
				}
			break;
			default:
				write_to_output(d, "Invalid Choice...\r\n"
					"What stat do you wish to edit? : ");
			return;			
		}																					
	return;

	case CON_EDITVITALS:
		if (isdigit(*arg)){
			num = atoi(arg);
			if (d->selection == 0) {
				stat_was = d->character->real_abils.vis;
				stat = LIMIT(num, 5, 20);
				if (stat > stat_was) {
					i = d->tmpint - (stat - stat_was);
					if (i < 0)
						stat = stat + i;
				}
				d->character->real_abils.vis = stat;
				if (stat > stat_was)
					d->tmpint = d->tmpint - (stat - stat_was);
				else
					d->tmpint = d->tmpint + (stat_was - stat);
			} else if (d->selection == 1) {
				stat_was = d->character->real_abils.inv;
				stat = LIMIT(num, 5, 20);
				if (stat > stat_was) {
					i = d->tmpint - (stat - stat_was);
					if (i < 0)
						stat = stat + i;
				}
				d->character->real_abils.inv = stat;
				if (stat > stat_was)
					d->tmpint = d->tmpint - (stat - stat_was);
				else
					d->tmpint = d->tmpint + (stat_was - stat);
			} else if (d->selection == 2) {
				stat_was = d->character->real_abils.tec;
				stat = LIMIT(num, 5, 20);
				if (stat > stat_was) {
					i = d->tmpint - (stat - stat_was);
					if (i < 0)
						stat = stat + i;
				}
				d->character->real_abils.tec = stat;
				if (stat > stat_was)
					d->tmpint = d->tmpint - (stat - stat_was);
				else
					d->tmpint = d->tmpint + (stat_was - stat);
			} else if (d->selection == 3) {
				stat_was = d->character->real_abils.agi;
				stat = LIMIT(num, 5, 20);
				if (stat > stat_was) {
					i = d->tmpint - (stat - stat_was);
					if (i < 0)
						stat = stat + i;
				}
				d->character->real_abils.agi = stat;
				if (stat > stat_was)
					d->tmpint = d->tmpint - (stat - stat_was);
				else
					d->tmpint = d->tmpint + (stat_was - stat);
			} else if (d->selection == 4) {
				stat_was = d->character->real_abils.luc;
				stat = LIMIT(num, 5, 20);
				if (stat > stat_was) {
					i = d->tmpint - (stat - stat_was);
					if (i < 0)
						stat = stat + i;
				}
				d->character->real_abils.luc = stat;
				if (stat > stat_was)
					d->tmpint = d->tmpint - (stat - stat_was);
				else
					d->tmpint = d->tmpint + (stat_was - stat);
			} else if (d->selection == 5) {
				stat_was = d->character->real_abils.str;
				stat = LIMIT(num, 5, 20);
				if (stat > stat_was) {
					i = d->tmpint - (stat - stat_was);
					if (i < 0)
						stat = stat + i;
				}
				d->character->real_abils.str = stat;
				if (stat > stat_was)
					d->tmpint = d->tmpint - (stat - stat_was);
				else
					d->tmpint = d->tmpint + (stat_was - stat);
			}
		} else {
			vitals_menu(d);
			write_to_output(d, "You entered an invalid argument.\r\n");
			write_to_output(d, "What stat do you wish to edit? : ");
			STATE(d) = CON_VITALSMENU;
			break;	
		}
		vitals_menu(d);
		STATE(d) = CON_VITALSMENU;		
	break;


added this to class.c and included the prototype in class.h
void vitals_menu(struct descriptor_data *d)
{

	write_to_output(d, "\r\n\r\n|=============================================================================|\r\n"
	"|                          \tRCognizance Recycler\tn                                |\r\n"
	"|  Module ID: VITALS (Very Intelligent Teratogen Allocation Lligase System)   |\r\n"
	"|=============================================================================|\r\n"
	"| [V : %2d] - Vision: How well you perceive the environment and other people  |\r\n"
	"|             EXAMPLES: GUNS BOWS SNEAKING INFRAVISION TRACKING ETC...        |\r\n"
	"| [I : %2d] - Invincibility: How much damage you can take                     |\r\n"
	"|             EXAMPLES: HEALTH GAINS/HEALING/REGEN, DAMAGE MITIGATION, ETC... |\r\n"
	"| [T : %2d] - Technology: Proficiency with using technology                   |\r\n"
	"|             EXAMPLES: FIREBALLS, CLOAKING, TELEPORTING, CRAFTING, ETC...    |\r\n"
	"| [A : %2d] - Agility: How quickly you can react, how long before winded      |\r\n"
	"|             EXAMPLES: BLOCKING, SNEAKING, BACKSTAB, ACTION REGEN, ETC...    |\r\n"
	"| [L : %2d] - Luck: How favorable chance based rolls are                      |\r\n"
	"|             EXAMPLES: BONUS TO CRITIAL HITS, ACCURACY, CRAFTING, ETC...     |\r\n"
	"| [S : %2d] - Strength: Raw physical damage                                   |\r\n"
	"|             EXAMPLES: UNARMED COMBAT, MELEE, CARRY WEIGHT, ETC...           |\r\n"
	"| Q) Accept current values, create body, and transfer Cognizance              |\r\n"
	"|=============================================================================|\r\n"
	"| You have %2d more points to distribute.                                     |\r\n"
	"| You may set a stat to be anywhere in the 5-20 range.                        |\r\n"
	"| Statistics in the game range from 3-50 for all players and NPC(s)           |\r\n"
	"| Your currently allowed in-game stat range is 3-25.                          |\r\n"
	"|=============================================================================|\r\n",
	d->character->real_abils.vis, d->character->real_abils.inv, d->character->real_abils.tec,
	d->character->real_abils.agi, d->character->real_abils.luc, d->character->real_abils.str,
	d->tmpint);
	write_to_output(d, "\r\nWhat stat do you wish to edit? : ");
}

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

More
5 years 2 weeks ago #2109 by Fizban
Fizban replied the topic: Questionnaire idea
A lot of more recent games do this as well still. I know both Fallout 3 and New Vegas both had similar setups, though they let you override the class-setup that the players answers initially chose.

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

More
5 years 2 weeks ago #2112 by rudeboyrave
rudeboyrave replied the topic: Questionnaire idea
Questionnaire idea sounds awesome Pete, i think the original idea for this came from the Ultima games maybe? Any snippets we can get contributed to the site will help this community grow. Awesome skill snippet kewlb, which mud is that from, it looks like its going to be fun.

CyberASSAULT
www.cyberassault.org
cyberassault.org 11111
A post-apocalyptic, sci-fi MUD.

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

More
5 years 2 weeks ago #2114 by Kewlb
Kewlb replied the topic: Questionnaire idea

rudeboyrave wrote: Questionnaire idea sounds awesome Pete, i think the original idea for this came from the Ultima games maybe? Any snippets we can get contributed to the site will help this community grow. Awesome skill snippet kewlb, which mud is that from, it looks like its going to be fun.


I am calling it Dead Survival. I am taking all of the best things from all the various MUDS I have programmed over the years and really trying to come up with something half way fresh. There is nothing I am doing that probably has not been done before in other muds, but I am not sure if they have all been in the same one.

The premise of the MUD is it is a post-apocalyptic world with remnants of old working technology.. one piece called the Cognizance Recycler allows people's consciousnesses to live on in another body after death.. as long as their DNA sequence remains strong [perm char death is possible]. What caused the near annihilation of the human race was DNA modifications that got out of hand. There will be many mutated NPC(s) and the main thing, of course, that wiped out humanity were zombies [yes not original.. but I have a mechanic for them that will work very well].

The game itself is a completely classless and raceless [at least for players] MUD. The skill system is handled via skill chips [think FF7 Materia] that can level up and are placed in equipment. The skill chips are tied to a players VITALS [stats system] for pre-requisites. I plan for the leveling process to be fairly fast. Initially players can have stats from 3-25.. but gain a +5 to max after each "remort" up to 5 total remorts whereby the character will be maxed. Each skill has a cooldown timer, range it can be used from, and damage type.

I am replacing the current movement system of the mud and implementing a definable grid for each room. When players move "n/s/e/w/ne/nw/se/sw" they will actually be moving on the grid inside of the room. Once they moved far enough to hit the edge they will move towards the next room. This, obviously, opens up a whole world of possibilities. I will be implementing objects people can take cover behind or climb to gain a height advantage over their foes. They will be able to move around and preposition during combat, etc..

As far as combat I am replacing the 2 second round based system with a complete events driven system. This will allow me to have quite a lot of skills/activated abilities [were spells] require some type of execution time so that they can be avoided and or countered. Rest assured you are not just going to type kill blah and watch the screen scroll for 4 minutes while you quaff a heal potion to stay alive..

I made use of the old assemblies snippet and re-wrote quite a bit of it for my Fallout mud. I will be re-using a lot of that. it is one of the more robust crafting systems I have seen in a mud. Combine that with various places to mine, fish, harvest, skin fallen non-humanoid NPC corpses, and break down old equipment into components and you will have a robust system where almost nothing goes to waste or is junked.

I am still pretty early in the develop stages for all of this. A lot of it I have working in other mud and must re-write to adapt to this one.. quite a lot of it is also brand new to me, like the grid system. I am currently working on this grid system and hope to be completed in the next week or two with it. I probably only have about 2 or so hours to program per night.

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

  • Papaya Pete
  • Papaya Pete's Avatar Topic Author
  • Offline
  • Gold Boarder
  • Gold Boarder
More
5 years 2 weeks ago #2119 by Papaya Pete
Papaya Pete replied the topic: Questionnaire idea
That looks pretty nice, man. Well, my idea actually was to ask questions like...

"You're walking down the street when you hear a man scream for help in an alleyway. You take a peek and see two men wrestling another man to the ground. What do you do?

A.) Run in and try and fight the men off.
B.) Shout for help.
C.) Just keep walking."

Depending on what you respond has an effect on your character. For instance, running in and fighting them might give an improvement to unarmed skill to start with, while shouting for help can give an additional point to WIS. Just walking by would lower your alignment. This would give players a chance to mod their stats and starting skills. I don't really mind character stats being determined the stock way.

My approach was to actually take a look at the basic races snippet and go from there. Seeing as I'm busy for the rest of the weekend, I'm going to start on Monday.

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

  • Papaya Pete
  • Papaya Pete's Avatar Topic Author
  • Offline
  • Gold Boarder
  • Gold Boarder
More
5 years 2 weeks ago - 5 years 2 weeks ago #2152 by Papaya Pete
Papaya Pete replied the 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...
} 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: 5 years 2 weeks ago 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
5 years 2 weeks ago #2154 by Fizban
Fizban replied the topic: Questionnaire idea
I think the issue is that you have this:
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:
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.

  • Papaya Pete
  • Papaya Pete's Avatar Topic Author
  • Offline
  • Gold Boarder
  • Gold Boarder
More
5 years 2 weeks ago - 5 years 2 weeks ago #2156 by Papaya Pete
Papaya Pete replied the topic: Questionnaire idea
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;

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:
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...
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: 5 years 2 weeks ago by Papaya Pete. Reason: Discovered something...

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

More
5 years 2 weeks ago #2163 by Kewlb
Kewlb replied the 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.

  • Papaya Pete
  • Papaya Pete's Avatar Topic Author
  • Offline
  • Gold Boarder
  • Gold Boarder
More
5 years 1 week ago - 5 years 1 week ago #2170 by Papaya Pete
Papaya Pete replied the 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. Going to clean it up and upload tomorrow.

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: 5 years 1 week ago 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: 1.365 seconds