Welcome to the Builder Academy

Question Newbie Equipment

More
11 Aug 2012 07:46 - 11 Aug 2012 17:25 #641 by Liko
Newbie Equipment was created by Liko
Here is a snippet that loads a new character with starting equipment. It's loads equipment based on their class.


1. Open act.other and at the end of the file add:
Code:
void do_newbie(struct char_data *vict) { struct obj_data *obj; int give_warrior[] = {1, -1}; /* Change Vnums */ int give_mage[] = {1, -1}; /* Change Vnums */ int give_cleric[] = {1, -1}; /* Chnage Vnums */ int give_thief[] = {1, -1}; /* Change Vnums*/ int i; if(GET_CLASS(vict) == CLASS_WARRIOR) { for (i = 0; give_warrior[i] != -1; i++) { obj = read_object(give_warrior[i], VIRTUAL); obj_to_char(obj, vict); } } if (GET_CLASS(vict) == CLASS_MAGIC_USER) { for (i = 0; give_mage[i] != -1; i++) { obj = read_object(give_mage[i], VIRTUAL); obj_to_char(obj, vict); } if (GET_CLASS(vict) == CLASS_CLERIC) { for (i = 0; give_cleric[i] != -1; i++) { obj = read_object(give_cleric[i], VIRTUAL); obj_to_char(obj, vict); } } if (GET_CLASS(vict) == CLASS_THIEF) { for (i = 0; give_thief[i] != -1; i++) { obj = read_object(give_thief[i], VIRTUAL); obj_to_char(obj, vict); } } }

2. Close act.other.c and open act.h

3. search do_gen_tog and above it add
Code:
void do_newbie(struct char_data *vict);

4. close act.other.c and open class.c

5. search do_start and under roll_real_abils add:
Code:
do_newbie(ch);

6. Close and Compile.

This is just another way to start players with equipment. You can also do this with Newbie Equipment Dg Script .

Randian(0.0.0)
Owner/Developer
Last edit: 11 Aug 2012 17:25 by Liko.
The following user(s) said Thank You: bakarus

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

More
11 Aug 2012 17:26 #644 by Liko
Replied by Liko on topic Re: Newbie Equipment
Fix a small port error

Randian(0.0.0)
Owner/Developer

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

More
19 Apr 2025 01:58 - 19 Apr 2025 12:31 #10666 by zi
Replied by zi on topic Newbie Equipment
Odd problem:

I know the script runs for new characters (my debug message "balls!" triggers 4 times as it cycles through my object array) AND I see this weirdness when looking at new character Xexex...
Code:
> where rope O  1. a length of rope          - carried by Xexex > l xexex You see nothing special about him. Xexex is in excellent condition. You attempt to peek at his inventory: Nothing.
rope is object vnum 150.


I call do_newbie in do_start in class.c --- I've gotten the same result calling it in interpreter.c as well. Using this simple function...
Code:
void do_newbie(struct char_data *vict) {   struct obj_data *obj;   int obj_array[] = {150, 105, 108, 109, -1};   int i;   for (i = 0; obj_array[i] != -1; i++) {     obj = read_object(obj_array[i], VIRTUAL);     obj_to_char(obj, vict);     send_to_char(vict, "balls!");   } }

What can I do to make xexex's inventory visible to him?

in his player object file it's blank. So I'm guessing I'm not saving?
Code:
..../lib/plrobjs/U-Z>cat xexex.objs 2 1745027806 0 134 0 0 $~

EDIT: calling do_newbie in class.c or just after roll_real_abilities in interperter (I now have a re-roll function in a new character so this sits at the end of CON_QROLLSTATS for me)... doesn't matter. I get balls! in the appropriate places (ha) but the same problem - when my imp character where's the object it says it's in the new character's inventory but when looking at the new character or even 'inventory' from the new character nothing is there.

did a comparison and my obj_to_char is up to date as well so that's not it...
Last edit: 19 Apr 2025 12:31 by zi.

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

More
19 Apr 2025 21:47 - 19 Apr 2025 21:47 #10667 by thomas
Replied by thomas on topic Newbie Equipment
In enter_player_game() the character is reset. So, even if the object is loaded and obj->carried_by points to vict, vict->carrying is NULL.
You need to move the do_newbie() call later (after the reset_char() call).
github.com/tbamud/tbamud/blob/e6085172d5.../interpreter.c#L1234
Last edit: 19 Apr 2025 21:47 by thomas.

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

More
20 Apr 2025 12:13 #10668 by zi
Replied by zi on topic Newbie Equipment
Ah, thanks for that. I think the more I modify TBA the more comfortable I get with knowing "where things live."

So moving do_newbie after the reset would just give everyone entering the newbie equipment. I was toying with the idea of a yes/no bit but instead went down another path... I kept the do_newbie call in do_start in class.c and added crash save which worked!
Code:
  do_newbie(ch);   save_char(ch);   Crash_crashsave(ch);

I hate that capital C, but other than that, it worked. wrote to the plrobj file and was only called during the creation of a new character.

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

Time to create page: 0.185 seconds