SI Magical Barges and seats

NOTICE: This forum is archived as read only.
Please use the Github Discussions at https://github.com/exult/exult/discussions
Forum rules
NOTICE: This forum is archived as read only.
Please use the Github Discussions at https://github.com/exult/exult/discussions
Locked
Donfrow
Posts: 308
Joined: Thu May 14, 2020 1:34 pm

SI Magical Barges and seats

Post by Donfrow »

It seems in my mod the magical barge can be used without having a scroll of the appropriate quality by clicking on the seats (shape 292) instead of the engine. Does the magical barge in SI behave differently than the sail boats? I can click on the seats in a sail boat and it does not let me move the sail boat, though they are the same shape.

I'm thinking my issue stems from lingering SI code in my mod as the magical barge is originally set with usecode flags for use rather than a scroll. I thought flag 236 did this but setting this as true or false does not seem to make a difference.

I also tried setting the seats in the barge to the same quality as the engine but the Avatar can happily sail away as long as the seat is clicked instead of the engine.

Any idea how to have the seats work the same way as the engine with the magical barge in SI?

Thanks
Knight Captain
Posts: 1219
Joined: Thu May 14, 2020 1:34 pm

Re: SI Magical Barges and seats

Post by Knight Captain »

Yes, the magical barges, sail boats, ice raft, and turtle all have different Usecode behind them. There are a few utility functions, but most of the flag-specific stuff is tied to the shapes themselves. The shapeSeat shape#(0x124) has some checks, including for the Quality of the engine. If it is 1, you should see the message about it belonging to Filbercio.

From reading the code a bit deeper, there's some hard coded parts to it. And that's just in the seat code. There's also more code for the engine itself.

Are you having magical barges for sale in your mod?
Donfrow
Posts: 308
Joined: Thu May 14, 2020 1:34 pm

Re: SI Magical Barges and seats

Post by Donfrow »

I don't have them for sale but I do have it so that you need to complete a quest before you can use a magical barge. Upon completion of this quest I give a scroll that is the same quality as the engine. This works fine, for the engine.

Since you can click the seats and bypass the engine quality+scroll requirement it lets you move the barge without actually completing the quest. This wouldn't be much of an issue, except it's my way of locking the player onto the main land until I'm ready to let them leave.
Knight Captain
Posts: 1219
Joined: Thu May 14, 2020 1:34 pm

Re: SI Magical Barges and seats

Post by Knight Captain »

Does setting gflag 5 make a difference?

What happens if you use a different seat shape? Or even replace the original code with:

void shapeSeat shape#(0x124) ()
{
return;
}
Donfrow
Posts: 308
Joined: Thu May 14, 2020 1:34 pm

Re: SI Magical Barges and seats

Post by Donfrow »

gflag 5 made no difference.

I used a different seat shape and the Avatar will sit, but not let it move.

Looks like replacing the seat usecode completely does stop it. Double clicking doesn't allow the Avatar to sit anymore. If I use the engine (with appropriate scroll) the Avatar will still path and sit down, and let it be used.

If I try with a different seat shape and click the engine the Avatar will not path to a seat, so I assume the engine code is specifically looking for shape 292.

Thanks for all your help by the way, you seem to be on top of a bunch of stuff around here!
Knight Captain
Posts: 1219
Joined: Thu May 14, 2020 1:34 pm

Re: SI Magical Barges and seats

Post by Knight Captain »

Thank you. I stand upon the shoulders of giants.

Like the magic wine press, there's hard-coded coordinates in the code, plus the gflags. My early guess is that this was coded before they put the teleporter between the lake island and MageLord's palace.

This will take me longer to untangle than I have available tonight, sadly.
Donfrow
Posts: 308
Joined: Thu May 14, 2020 1:34 pm

Re: SI Magical Barges and seats

Post by Donfrow »

Thanks for the code you sent over. Looking at it, I suspect this is my issue:

if ((UI_get_item_quality(engine) == 1) && (!gflags[CAN_USE_FILBERCIOS_BARGE]))
{
partyUttersSameWithFace("This is Filbercio's barge!");
abort;
}
else // Have approval
{
var0001 = Func08E7(item);

Func088D(item, 292);
distance_to_seat = (UI_get_distance(item, AVATAR) + 15);
var0001 = UI_delayed_execute_usecode_array(item, [no_halt, call_usecode, 292], distance_to_seat);
}

I'm guessing in my case, since my engine isn't quality 1, it's always reaching the else statement which near as I can tell is the path to sit down on the seat, and calling the scripted block?

I'm thinking if I were to remove all the code and simply have it a sit down code like any other chair it should work though you would always have to click the barge to move it. I think this would be fine overall, other than mangling the existing seat code for this and possibly breaking the sailboat as they use the same seats.

Is there common code that doesn't call external functions to sit down in a regular chair? I'm thinking a straight copy and paste of that may work if that's the case.

Thanks again for all your help.
Locked