stuck on balloon code
Posted: Sun Aug 12, 2018 10:53 am
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?
This part of the code works, but when landBarge is called, it doesn't function correctly:
Am I just doing something completely wrong here? I've tried several times to alter it but haven't gotten any luck yet.
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.