This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts Menu //If the player clicks the same region the player is in it can always interact.
if (clickedRegion == playerRegion)
{
canWalkToObject = true;
}
//If the player clicks the same region the player is in it can always interact.
if (clickedRegion.ID == playerRegion.ID)
{
canWalkToObject = true;
}
// GIVE TO (characters only)
else if(UsedAction(eGA_GiveTo))
{
if (player.ActiveInventory == iMonsterArm)
{
player.Say("Nah, that would be rude!");
}
else if (player.ActiveInventory == iChili)
{
checkArea();
if (canWalkToObject == true)
{
if (player == cFive)
{
cFuzzy.Say("Oh, Fuzzy like!");
cFive.LoseInventory(iChili);
cFuzzy.AddInventory(iChili);
}
else if (player == cFuzzy)
{
cFive.Say("Thanks!");
cFuzzy.LoseInventory(iChili);
cFive.AddInventory(iChili);
}
else
{
}
}
else
{
sayCantReachPlayer();
}
}
else if (player.ActiveInventory == imutatedChili)
{
checkArea();
if (canWalkToObject == true)
{
if (player == cFive)
{
cFuzzy.Say("Oooh, Fuzzy like!");
cFive.LoseInventory(imutatedChili);
cFuzzy.AddInventory(imutatedChili);
}
else if (player == cFuzzy)
{
cFive.Say("Thanks!");
cFuzzy.LoseInventory(imutatedChili);
cFive.AddInventory(imutatedChili);
}
else
{
}
}
else
{
sayCantReachPlayer();
}
}
}
QuoteAnyway, you are making it needlessly complex for yourself. If you want to stop the player (or other character) from going to certain parts of the room you could just divide to room up in different walkable areas.
Quote from: Khris on Sun 03/02/2019 10:06:40
Just in case this is a scrolling room, it should beCode: ags Region*clickedRegion = Region.GetAtRoomXY(mouse.x + GetViewportX(), mouse.y + GetViewportY());
You should also make sure you've actually drawn Regions, and not Walkbehinds or Hotspots.
if (player.ActiveInventory == iChili)
{
checkArea();
if (canWalkToObject == true)
{
if (player == cFive)
{
cFuzzy.Say("Oh, Fuzzy like!");
cFive.LoseInventory(iChili);
cFuzzy.AddInventory(iChili);
}
else if (player == cFuzzy)
{
cFive.Say("Thanks!");
cFuzzy.LoseInventory(iChili);
cFive.AddInventory(iChili);
}
else
{
}
}
else
{
sayCantReachPlayer();
}
}
// Check if what the player clicks are in the same region as the player.
function checkArea()
{
Region*playerRegion = Region.GetAtRoomXY(player.x, player.y); //get current player region
Region*clickedRegion = Region.GetAtRoomXY(mouse.x, mouse.y); //get current mouse region
Wait(10);
//debug dialog
player.Say("Player region is %d.", Region.GetAtRoomXY(player.x, player.y));
player.Say("Mouse region is %d.", clickedRegion);
//If the player clicks the same region the player is in it can always interact.
if (clickedRegion == playerRegion)
{
canWalkToObject = true;
}
//If player clicks on region 1
if (clickedRegion == region[1])
{
if (playerRegion == region[2])
{
sayCantReach();
canWalkToObject = false;
}
else if (playerRegion == region[3])
{
if (cellDoorIsOpen == false)
{
sayCantReach();
canWalkToObject = false;
}
else
{
canWalkToObject = true;
}
}
else if (playerRegion == region[4])
{
sayCantReach();
canWalkToObject = false;
}
}
//If player clicks on region 2
else if (clickedRegion == region[2])
{
if (playerRegion == region[1])
{
sayCantReach();
canWalkToObject = false;
}
else if (playerRegion == region[3])
{
if (cellDoor2IsOpen == false)
{
sayCantReach();
canWalkToObject = false;
}
else
{
canWalkToObject = true;
}
}
else if (playerRegion == region[4])
{
sayCantReach();
canWalkToObject = false;
}
}
//If player clicks on region 3
else if (clickedRegion == region[3])
{
if (playerRegion == region[1])
{
if (cellDoorIsOpen == false)
{
sayCantReach();
canWalkToObject = false;
}
else
{
canWalkToObject = true;
}
}
else if (playerRegion == region[2])
{
if (cellDoor2IsOpen == false)
{
sayCantReach();
canWalkToObject = false;
}
else
{
canWalkToObject = true;
}
}
else if (playerRegion == region[4])
{
sayCantReach();
canWalkToObject = false;
}
}
if (clickedRegion == region[4])
{
}
}
// Push
else if(UsedAction(eGA_Push))
{
checkArea();
if (canWalkToObject == false)
{
return;
}
else
{
if (player == cFive)
{
player.Say("No, I like the Feng Shui here.");
}
else if (player == cFuzzy)
{
player.Say("Fuzzy can't move it!");
}
else
{
player.Say("");
}
}
}
By continuing to use this site you agree to the use of cookies. Please visit this page to see exactly how we use these.
Page created in 0.092 seconds with 14 queries.