stuck on balloon code

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
agentorangeguy
Posts: 565
Joined: Thu May 14, 2020 1:34 pm

stuck on balloon code

Post by agentorangeguy »

I've picked back up the mod and been working for the past few days. I attempted to make the U6 Balloon similiar to how it was in the original: you'd unpack it and double click the balloon, the party would walk on it and dissapear, then it would rise. I made a shape that was basically ripped from the u6 data and recolored. So far I was just getting the barebones of the code working to where it would be double clicked, Avatar and party walk on it (not implemented yet) , the DONT RENDER flags are turned on them (not implemented yet) and then it raises after setting all the appropriate flags. I was able to do this, and I can get the balloon to fly around just fine.

The problem is, I can't get it back down. I tried (manually) changing the balloon's quality number to 1 to trigger the landing function i made upon doubleclick, but it doesn't do anything to the Avatar, barge egg, or balloon. I'm wondering if my code is even finding them, can these search functions find objects that are on a different Z level? Or am I just doing it all wrong?

Code: Select all


void balloonbasket shape#(1201) ()
{	

const int SHAPE_BALLOON = 1201;
	var barge = get_barge();
	var party = UI_get_party_list();
	var balloon = UI_find_nearest(AVATAR, SHAPE_BALLOON, 31); //
	var quality = UI_get_item_quality(item);
	var basket_pos = UI_get_object_position(item); //balloon

	if (event == DOUBLECLICK)
		{
		var barge = UI_find_nearby(basket_pos, 961, 10, MASK_EGG); //hopefully find the barge before placing
		
	if (quality == 0)
		{
		if ((UI_get_container(item) == 0))  //checks if on the ground and not in container
			{
			if (!UI_is_pc_inside()) //checks if no roof above
				{
				if (!UI_find_nearby(basket_pos, 961, 10, MASK_EGG)) //will create barge if one not found 		
					{
					UI_create_barge_object(7, 7, NORTH);		
					UI_update_last_created([basket_pos]);

					}
					
					if (UI_on_barge()) //everyone should be on barge
						{
						var barge = UI_find_nearby(basket_pos, 961, 10, MASK_EGG); //hopefully find the barge before placing
							
						UI_remove_item(barge); //removes barge to create new one at proper z level

						script item
        						{
          							repeat 8
	            						{
								rise; //should lift item on z level 8
            							};

														wait 3;
							call AddBarge;
        
							}



							script AVATAR
        						{
          							repeat 9
            							{
								rise; //should lift item on z level 9
            							};

			
		 					}

							for (npc in party)
								{
								script npc
									{
					          	       		 repeat 9
					            				{
										rise; //should lift item on z level 9
										};
					
									}
        
								}

						//UI_set_lift(barge, 8); //sets barge lift (doesn't work)



						UI_set_item_quality(item, 1);

						}//on barge

							
				}
				else randomPartyBark("@The balloon can't be used here.@");
			}
			else randomPartyBark("@Place it on the ground first..@");
    	

		}

	else





	if (quality == 1) //descend
			{
			landBarge();
		 	}
		

			
		



}

} //end void

This part of the code works, but when landBarge is called, it doesn't function correctly:


Code: Select all

void landBarge ()
	{
	var barge = UI_find_nearby(AVATAR, 961, 10, MASK_EGG); //hopefully find the barge before placing
	var party = UI_get_party_list();
	var quality = get_item_quality();
	var balloon = UI_find_nearest(AVATAR, SHAPE_BALLOON, 31); //

	AVATAR.say("@Test@");
	AVATAR.hide();

	// Yes; so begin process of landing.
	// Flag 10 = 'on moving barge'
	barge->clear_item_flag(10);
	// Flag 26 = 'in motion'
	barge->clear_item_flag(26);
	// Make carpet descent until the ground.
	// Flag 10 = 'on moving barge'
	balloon->clear_item_flag(10);
	// Flag 26 = 'in motion'
	balloon->clear_item_flag(26);
	// Make carpet descent until the ground.
		script barge
			{
			repeat 10
				{
				descent;
				
				};
			}



		script balloon
			{
			repeat 9
				{
				descent; //should lift item on z level 8
      				};
			wait 3;
      
			}


		script AVATAR
			{
			repeat 9
     				{
				descent; //should lift item on z level 9
        			};
			}

		for (npc in party)
			{
			script npc
				{
        	       		 repeat 9
	      				{
		  			descent; //should lift item on z level 9
	  				};
					
				}
        		}


		UI_remove_item(barge);
		
	}

Am I just doing something completely wrong here? I've tried several times to alter it but haven't gotten any luck yet.
-------------------------------------------------------------------------------------
Ultima 6 Mod for Exult site: http://www.ultima6.realmofultima.com/
Dominus
Site Admin
Posts: 5656
Joined: Thu May 14, 2020 1:34 pm

Re: stuck on balloon code

Post by Dominus »

I can only say that the code for the rollable carpet in BG Keyring mod might help.
--
Read the documentation and the FAQ! There is no excuse for not reading them! RTFM
Read the Rules!
We do not support Piracy/Abandonware/Warez!
agentorangeguy
Posts: 565
Joined: Thu May 14, 2020 1:34 pm

Re: stuck on balloon code

Post by agentorangeguy »

I looked for it but I wasn't able to find the code for it, do you know where I can find it?
-------------------------------------------------------------------------------------
Ultima 6 Mod for Exult site: http://www.ultima6.realmofultima.com/
Dominus
Site Admin
Posts: 5656
Joined: Thu May 14, 2020 1:34 pm

Re: stuck on balloon code

Post by Dominus »

--
Read the documentation and the FAQ! There is no excuse for not reading them! RTFM
Read the Rules!
We do not support Piracy/Abandonware/Warez!
Knight Captain
Posts: 1219
Joined: Thu May 14, 2020 1:34 pm

Re: stuck on balloon code

Post by Knight Captain »

I wonder if this has to do with the handling of shape types in Exult. Try changing that without recompiling your Usecode and see if it works. There's a bug I found (but haven't submitted) where the shape type effectively prevents Usecode from working with the shape quality. You can see these shape types in ES.

Alternatively since the balloon is a unique item, you could create a gflag for if the balloon is in the air.
agentorangeguy
Posts: 565
Joined: Thu May 14, 2020 1:34 pm

Re: stuck on balloon code

Post by agentorangeguy »

I've noticed something else strange lately, when I make a new shape and #include it in the main usecode.uc file, it will say "cannot open " and the file and directory its listed in. I don' tknow why it isn't working since it's named correctly and in the proper folder
-------------------------------------------------------------------------------------
Ultima 6 Mod for Exult site: http://www.ultima6.realmofultima.com/
agentorangeguy
Posts: 565
Joined: Thu May 14, 2020 1:34 pm

Re: stuck on balloon code

Post by agentorangeguy »

Nevermind I think I figured it out... the file was not in the right format I guess hah.

Anyway, I was able to get my landing code to work by making another balloon shape and switching to it when in the air, so it could be double clicked to land. It's probably a lazy fix but it works hah.

Now, my question is, when you double click on an item, can you check to see if there is a roof above it? I know it can be done for the player but can it be done for an item?
-------------------------------------------------------------------------------------
Ultima 6 Mod for Exult site: http://www.ultima6.realmofultima.com/
Knight Captain
Posts: 1219
Joined: Thu May 14, 2020 1:34 pm

Re: stuck on balloon code

Post by Knight Captain »

There is a specific intrinsic that does this.
Donfrow
Posts: 308
Joined: Thu May 14, 2020 1:34 pm

Re: stuck on balloon code

Post by Donfrow »

There is an intrinsic to see if the Avatar is inside which is UI_is_pc_inside. Based on the description I would assume that this wouldn't work for an item but I've never tried.

Not sure if there is another one KC is thinking about that would work for items.
JjJ

Re: stuck on balloon code

Post by JjJ »

Maybe you could let the avatar move to the location of the balloon and check for is pc inside then?
Dominus
Site Admin
Posts: 5656
Joined: Thu May 14, 2020 1:34 pm

Re: stuck on balloon code

Post by Dominus »

that sounds like a good solution, or rather work around
--
Read the documentation and the FAQ! There is no excuse for not reading them! RTFM
Read the Rules!
We do not support Piracy/Abandonware/Warez!
Locked