Welcome to the Builder Academy

Question Is this possible with Set_skill?

More
15 Jul 2025 00:20 #10806 by wlessard1
Maybe somewhere in restore somehow? Will go diving into it and see what happens.

Thanks for the insights and the patience. Sheesh, you know how many typos I made doing this line? Time to get off the computer.

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

More
16 Jul 2025 16:51 #10807 by Plex
I think the simple answer is no, you can't assign a class a skill using set_skill.   Set_skill only sets the percentage of the skill practiced.  In order for a class to use a skill that class has to have a minimum level associated with the skill or spell.
 
1.       Assign spells and skills to make them usable. - spell_parser.c
                void mag_assign_spells(void) {
 
                spello(SPELL_FIREBALL, "fireball", 40, 30, 2, POS_FIGHTING,
                  TAR_CHAR_ROOM | TAR_FIGHT_VICT, TRUE, MAG_DAMAGE, NULL);
 
                skillo(SKILL_KICK, "kick");
 
 
2.       Make all skills usable by immortals by setting the minimum level. - spell_parser.c

      static void spello(int spl, const char *name, int max_mana, int min_mana,
      int mana_change, int minpos, int targets, int violent, int routines,
       const char *wearoff) {
        int i;
 
  for (i = 0; i < NUM_CLASSES; i++)
    spell_info[spl].min_level = LVL_IMMORT;
 
3.       Assign spells to classes. - class.c
 
This will override the minimum level for the skill for the specified class and make it usable for that class. The mimimum will no longer be LVL_IMMORT.  You can assign spells here, but this will apply to all members of the class and not just the remort version.
 
void init_spell_levels(void)
{
  /* MAGES */
  spell_level(SPELL_FIREBALL, CLASS_MAGIC_USER, 15);
                               
  /* WARRIORS */
  spell_level(SKILL_KICK, CLASS_WARRIOR, 1);
  spell_level(SKILL_RESCUE, CLASS_WARRIOR, 3);
  spell_level(SKILL_BANDAGE, CLASS_WARRIOR, 7);
  spell_level(SKILL_TRACK, CLASS_WARRIOR, 9);
  spell_level(SKILL_BASH, CLASS_WARRIOR, 12);
  spell_level(SKILL_WHIRLWIND, CLASS_WARRIOR, 16);
 
  spell_level(SPELL_FIREBALL, CLASS_WARRIOR, 1); 
 
4.       Use set skill in do_advance so that when a char becomes immortal all the skills are set to 100%. - act.wizard.c
 
ACMD(do_advance) {
        for (i = 1; i <= MAX_SKILLS; i++)
          SET_SKILL(victim, i, 100);
 
5.       A possible to solution to the problem is to modify the code where the minimum level gets checked. This happens in multiple places like when you type practice or cast a spell.  Check to see if the character is a remort and if they have access to a remort skill.   The remort skills would need to be defined somewhere. 

Ex.
int remort_skills[] = {
  {26},   -> fireball
  {32}   -> magic missile
};
 
void list_skills(struct char_data *ch)
{
  const char *overflow = "\r\n**OVERFLOW**\r\n";
  int i, sortpos, ret;
  size_t len = 0;
  char buf2[MAX_STRING_LENGTH];
 
  len = snprintf(buf2, sizeof(buf2), "You have %d practice session%s remaining.\r\n"
                "You know of the following %ss:\r\n", GET_PRACTICES(ch),
                GET_PRACTICES(ch) == 1 ? "" : "s", SPLSKL(ch));
 
  for (sortpos = 1; sortpos <= MAX_SKILLS; sortpos++) {
    i = spell_sort_info[sortpos];
    if ((GET_LEVEL(ch) >= spell_info.min_level[(int) GET_CLASS(ch)])  ||  
       (IS_REMORT(ch) && < spellnum is in remort_skills[] >)) {
 
 
 
ACMD(do_cast) {
/* spellnum = search_block(s, spells, 0); */
  spellnum = find_skill_num(s);
 
  if ((spellnum < 1) || (spellnum > MAX_SPELLS) || !*s) {
    send_to_char(ch, "Cast what?!?\r\n");
    return;
  }
  if ((GET_LEVEL(ch) < SINFO.min_level[(int) GET_CLASS(ch)]) ||  
       (IS_REMORT(ch) && <spellnum is NOT in remort_skills[] >)) {
 
) {
    send_to_char(ch, "You do not know that spell!\r\n");
    return;
  }

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

More
17 Jul 2025 11:23 #10809 by wlessard1
While it is possible to GIVE a skill to a character, at this time, those who know the trick either are not going to tell me, which keeping something unique is not a bad thing, or aren't reading this forum.

The reason I know it CAN be done is I play a MUD that it IS done.

Not sure if I will find it, but I will find the answer.

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

More
17 Jul 2025 16:59 #10810 by thomas
Ah, but I think you misunderstand me. Let me be clearer. We need to know a lot more than we have been told to be useful on this topic. TbaMUD (and circlemud before it) were not created with a "remort" system in place. So, for us to help you, you need to tell us what you have already, what you expect to happen in different circumstances and how the remort system is supposed to work. As it stands, I have no idea what you mean by remort; it isn't a general term with a fixed meaning.

There are plenty of ways to set skills also for people who usually can't learn them (class.c and the limitations there primarily affect the ability to _practice_ skills and spells at guildmasters). %actor.skillset(bash 40)% in a script will set the players' bash skill, regardless of their class. But I can't shake the feeling you want something more "internal" in the mud code to handle it instead?

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

More
17 Jul 2025 18:47 - 17 Jul 2025 21:50 #10812 by wlessard1
Remort - return to level 1, with some tweaks. Increased mana move hits currently this function works fine.
Trying to add a function to give skills to a character that are not in their class list.
Found that answer. I have it working that far now.
I knew it could be done. Was mainly getting practice and list_skill to show the actual skills a character had.
Code:
#include "conf.h" #include "sysdep.h" #include "structs.h" #include "utils.h" #include "comm.h" #include "interpreter.h" #include "handler.h" #include "db.h" #include "remort.h" #include "spells.h" extern const char *class_menu; int parse_class(char arg); void do_remort_start(struct char_data *ch); /* Remort snippet bramage */ ACMD(do_remort) { char arg[MAX_STRING_LENGTH]; char buf[MAX_INPUT_LENGTH]; if(GET_LEVEL(ch) < 51 || GET_LEVEL(ch) > 51){ send_to_char(ch, "You cannot remort at this time!"); return; } one_argument(argument, arg); if(GET_REMORT_LEVEL(ch) < 20) { switch(*arg) { case 'n': case 'N': send_to_char(ch, "\r\nYour not going to remort at this time."); send_to_char(ch, "\r\nThe immortals have allowed you to stay at your level");     break; case 'y': case 'Y': send_to_char(ch, "\r\nCongrulations!"); send_to_char(ch, "\r\nYou have decided to remort!"); send_to_char(ch, "\r\nYou are now leaving you old body, to start a new!"); send_to_char(ch, "\r\nA new journey has begun for you!\r\n"); GET_LEVEL(ch) = 1; log("DEBUG: Setting remort level for %s to %d", GET_NAME(ch), GET_REMORT_LEVEL(ch) + 1); GET_REMORT_LEVEL(ch) = GET_REMORT_LEVEL(ch) + 1;         if (GET_REMORT_LEVEL(ch) == 1)         ch->points.max_hit = 100 + (GET_REMORT_LEVEL(ch) * 50); ch->points.max_mana = 100 + (GET_REMORT_LEVEL(ch) * 50); ch->points.max_move = 100 + (GET_REMORT_LEVEL(ch) * 50); ch->points.hit = 100; ch->points.mana = 100; ch->points.move = 100; ch->points.exp = 1;     do_remort_start(ch); log("DEBUG: Saving character %s after remort", GET_NAME(ch)); save_char(ch); sprintf(buf, "%s has remorted to level 1.", GET_NAME(ch)); /* mudlog(buf, NRM, MAX(LVL_IMMORT, GET_INVIS_LEV(ch)), TRUE); TEMP REMOVAL */ break; default:     send_to_char(ch, "\r\n(type: \"remort y\" if u DO OR \"remort n\" if you DON'T!"); send_to_char(ch, "\r\nAre you sure you want to remort: "); return;   }   } else {   send_to_char(ch, "\r\nYou can't remort anymore!");   send_to_char(ch, "\r\nContact Management if you need help!");   } } void do_remort_start(struct char_data *ch) {   int sortpos;   /* Debug: Confirm do_remort_start is called */   log("DEBUG: do_remort_start called for %s (class: %d, remort level: %d)", GET_NAME(ch), GET_CLASS(ch), GET_REMORT_LEVEL(ch));   /* Initialize based on do_start */   set_title(ch, NULL);   GET_LEVEL(ch) = 1;   GET_EXP(ch) = 1;   /* Set stats (minimal, to be adjusted in class.c or elsewhere) */   GET_MAX_HIT(ch) = 100 + (GET_REMORT_LEVEL(ch) * 50);   GET_MAX_MANA(ch) = 100 + (GET_REMORT_LEVEL(ch) * 50);   GET_MAX_MOVE(ch) = 100 + (GET_REMORT_LEVEL(ch) * 50);   GET_HIT(ch) = GET_MAX_HIT(ch);   GET_MANA(ch) = GET_MAX_MANA(ch);   GET_MOVE(ch) = GET_MAX_MOVE(ch);   /* Assign class-specific skills */   switch (GET_CLASS(ch)) {     case CLASS_MAGIC_USER:       break;     case CLASS_CLERIC:       break;     case CLASS_THIEF:       break;     case CLASS_WARRIOR:       SET_SKILL(ch, SKILL_SNEAK, 10); /* Test non-Warrior skill with max proficiency */       SET_SKILL(ch, SPELL_IDENTIFY, 10); /* Test non-Warrior skill with max proficiency */       log("DEBUG: Assigned SNEAK to %s (Warrior): SNEAK=%d, IDENTIFY=%d", GET_NAME(ch), GET_SKILL(ch, SKILL_SNEAK), GET_SKILL(ch, SPELL_IDENTIFY));       break;     case CLASS_BARD:       break;     default:       log("DEBUG: No skills assigned for %s (unknown class: %d)", GET_NAME(ch), GET_CLASS(ch));       break;   }   /* Debug: Verify skills after assignment */   log("DEBUG: Post-assignment skills for %s: SNEAK=%d, IDENTIFY=%d", GET_NAME(ch), GET_SKILL(ch, SKILL_SNEAK), GET_SKILL(ch, SPELL_IDENTIFY));   /* Set conditions (drunk can be 0, no hunger/thirst) */   GET_COND(ch, THIRST) = -1;   GET_COND(ch, HUNGER) = -1;   GET_COND(ch, DRUNK) = 0;   /* Save character with debug */   log("DEBUG: Saving character %s", GET_NAME(ch));   save_char(ch);   log("DEBUG: Save completed for %s", GET_NAME(ch));   /* Debug: Verify skills after save */   log("DEBUG: Post-save skills for %s: SNEAK=%d, IDENTIFY=%d", GET_NAME(ch), GET_SKILL(ch, SKILL_SNEAK), GET_SKILL(ch, SPELL_IDENTIFY));   /* Log completion */   log("DEBUG: do_remort_start completed for %s. Final stats: Level=%d, HP=%d, Mana=%d, Move=%d",       GET_NAME(ch), GET_LEVEL(ch), GET_MAX_HIT(ch), GET_MAX_MANA(ch), GET_MAX_MOVE(ch)); }

Just in my other tinkering I somehow lost the character saving itself. If I log out and back in, I lose the save. Even if I do a SAVE before logging out.
Last edit: 17 Jul 2025 21:50 by thomas. Reason: formatting

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

More
17 Jul 2025 21:35 #10813 by wlessard1
I admit I am a butcher when it comes to trying to make brand new code. BUT give me a snippet or a half working piece of code and let me troubleshoot and I can find a solution.

Set_skill works for what I want in my remort system.
I had to build a do_remort_start function based on do_start that got me to a certain point. Then I had to figure out what remorts weren't saving. Got that fixed.

Added some misc to help with remort stuff and now it compiles, it works. Sadly I forgot all the different files and changes I made. Really need to figure out how to make this a snippet I can post.

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

Time to create page: 0.217 seconds