Welcome to the Builder Academy

Question Need some tad help.

More
12 Nov 2012 19:23 #1032 by Liko
Need some tad help. was created by Liko
Well I'm running into a small bug that I can't seem to figure out. When setting the item that is getting the modifier applied to it, it sets the correct amount, but not the correct location(MAX_HIT,MAX_MANA) etc. I know the exact line that is causing it, I'm just stumped at what to put.
Code:
while (*socket_types[i] != '\n') { if(socket_types[a->bonus[i].location]) { /* This is the line. I need to figure this out.*/ apply = i; break; } i++; }

Randian(0.0.0)
Owner/Developer

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

More
12 Nov 2012 20:17 #1033 by Gahan
Replied by Gahan on topic Re: Need some tad help.
I'm guessing your socket_types struct and your apply_types struct dont align.

That would be my first suggestion.

For example, if it finds socket_type[4] -> this might be a completely different value than in your apply_types.

Unfortunately because I cant see the entire function I cannot see the issue. Can you either dump the entire function here or email it to me? I'll sort-er out for ya.

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

More
12 Nov 2012 21:08 #1034 by Liko
Replied by Liko on topic Re: Need some tad help.

Gahan wrote: I'm guessing your socket_types struct and your apply_types struct dont align.

That would be my first suggestion.

For example, if it finds socket_type[4] -> this might be a completely different value than in your apply_types.

Unfortunately because I cant see the entire function I cannot see the issue. Can you either dump the entire function here or email it to me? I'll sort-er out for ya.


They are only checking socket_types. I completely programmed it so sockets are a stand-alone. I will post the whole thing
Code:
bool socket_apply(struct obj_data *a, struct obj_data *b) { int i = 0, apply = -1, location = -1, mod = 0, empty = -1; while (*socket_types[i] != '\n') { if(socket_types[a->bonus[i].location]) {/* Just need to figure out this line*/ apply = i; break; } i++; } if (apply == -1) return FALSE; for (i = 0; i < MAX_SOCKET_AFFECT; i++) { if (b->bonus[i].location == apply) { location = i; mod = a->bonus[i].modifier; break; } else if (b->bonus[i].location == SOCKET_NONE && empty == -1) { empty = i; } } /* No slot already using SOCKET_XXX, so use an empty one... if available */ if (location == -1) location = empty; /* There is no slot already using our SOCKET_XXX type, and no empty slots either */ if (location == -1) return FALSE; b->bonus[location].modifier = mod; b->obj_flags.num_sockets += 1; /* Our modifier is set at 0, so lets just clear the SOCKET location so that it may * be reused at a later point */ if (b->bonus[location].modifier != 0) b->bonus[location].location = apply; else b->bonus[location].location = SOCKET_NONE; return TRUE; }

Randian(0.0.0)
Owner/Developer

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

More
12 Nov 2012 21:17 #1035 by Liko
Replied by Liko on topic Re: Need some tad help.
The error it is causing is this:

+10 to None

when it should be

+10 to Max Hit.

Only thing not working correctly is getting the modifiers socket location and applying to the weapon.

Randian(0.0.0)
Owner/Developer

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

More
13 Nov 2012 12:00 #1037 by Liko
Replied by Liko on topic Re: Need some tad help.

Liko wrote: The error it is causing is this:

+10 to None

when it should be

+10 to Max Hit.

Only thing not working correctly is getting the modifiers socket location and applying to the weapon.


I have fixed this issue. I wasn't grabbing the modifier's bit location before changing it. So it was always reading 0.

Randian(0.0.0)
Owner/Developer

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

More
13 Nov 2012 18:26 #1038 by Gahan
Replied by Gahan on topic Re: Need some tad help.
Sorry I couldnt get to you sooner, trying to fight the flu! Although, glad you figured it out.

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

Time to create page: 0.219 seconds