got the pocketpicking done
Got the formula for pocketpicking done. I am pretty happy with it. its based on value, weight, and your dexterity. the better your dexterity, and lower value and weight of the item, the better chance of stealing.
|
@ -11,22 +11,40 @@ namespace RPGCreationKit
|
|||
{
|
||||
public override void OnClick(bool takeAll = false)
|
||||
{
|
||||
if (LootingInventoryUI.instance.curIsPickPocket)
|
||||
if (LootingInventoryUI.instance.curIsPickPocket && LootingInventoryUI.instance.curLootingPoint != null)
|
||||
{
|
||||
// Player is attempting to pickpocket
|
||||
// This is a VERY simple rule, if the weight of the item is over 1 the player will never be able to successfully pickpocket it
|
||||
// You may want to change/alter this for your own projects
|
||||
float chanceForFailure = ammoItemInInventory.item.Weight;
|
||||
float B = (float)EntityAttributes.PlayerAttributes.attributes.Dexterity / 100f; // Dexterity - Your dexterity divided by 100. level 5 is 5% chance
|
||||
float A = (1f - ((float)ammoItemInInventory.item.Value / 100f)); // Value - The value will work backwards starting at 50 Gold. if its value is 49, you have a 2% chance.
|
||||
float C = (1f - ((float)ammoItemInInventory.item.Weight / 100f)); // Weight - the weight will work backwards at 50 LBS. if it is 49 LBS, you have a 2% chance
|
||||
|
||||
float ChanceForSuccess = ((A+B+C) / 3); // add the percenct, divide by 3 to get average. - Done.
|
||||
|
||||
// lets base it off chance.
|
||||
|
||||
// Could use Vector3.Dot to make less likely to succeed when infront of the AI
|
||||
float RandomChance = (Random.value);
|
||||
Debug.Log("Item: "+ammoItemInInventory.item.ItemName+"; A: "+A+"; B: "+B+"; C: "+C+"; ChanceForSuccess:"+ChanceForSuccess+"; RandomChance: "+RandomChance+";");
|
||||
|
||||
if (chanceForFailure > Random.value)
|
||||
{
|
||||
if (ChanceForSuccess < RandomChance) { // random selects a percent between 0% and 100%, and sees if yours is greater, if so, you have success.
|
||||
// Failed chance check
|
||||
RckAI ai = LootingInventoryUI.instance.curLootingPoint.GetComponent<RckAI>();
|
||||
ai.TryEngageWithPlayer(); // Engage with player
|
||||
ai.TryEngageWithPlayer(); // Engage with player - Lets get faction instead of every fucker in the area.
|
||||
LootingInventoryUI.instance.CloseUI();
|
||||
return;
|
||||
} else { // Reward Player
|
||||
EntityAttributes.PlayerAttributes.attributes.DexterityPoints += 1;
|
||||
A = (float)EntityAttributes.PlayerAttributes.attributes.DexterityPoints;
|
||||
B = (float)EntityAttributes.PlayerAttributes.attributes.Dexterity;
|
||||
while (A >= (B*3)) {
|
||||
EntityAttributes.PlayerAttributes.attributes.Dexterity += 1;
|
||||
float D = (A-(B*3f));
|
||||
EntityAttributes.PlayerAttributes.attributes.DexterityPoints = (int)D;
|
||||
A = (float)EntityAttributes.PlayerAttributes.attributes.DexterityPoints;
|
||||
B = (float)EntityAttributes.PlayerAttributes.attributes.Dexterity;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Some palce in the codebase seems to be calling this method after the CloseUI randomly, not sure why or where yet
|
||||
|
|
|
@ -11,22 +11,40 @@ namespace RPGCreationKit
|
|||
{
|
||||
public override void OnClick(bool takeAll = false)
|
||||
{
|
||||
if (LootingInventoryUI.instance.curIsPickPocket)
|
||||
if (LootingInventoryUI.instance.curIsPickPocket && LootingInventoryUI.instance.curLootingPoint != null)
|
||||
{
|
||||
// Player is attempting to pickpocket
|
||||
// This is a VERY simple rule, if the weight of the item is over 1 the player will never be able to successfully pickpocket it
|
||||
// You may want to change/alter this for your own projects
|
||||
float chanceForFailure = keyItemInInventory.item.Weight;
|
||||
float B = (float)EntityAttributes.PlayerAttributes.attributes.Dexterity / 100f; // Dexterity - Your dexterity divided by 100. level 5 is 5% chance
|
||||
float A = (1f - ((float)keyItemInInventory.item.Value / 100f)); // Value - The value will work backwards starting at 50 Gold. if its value is 49, you have a 2% chance.
|
||||
float C = (1f - ((float)keyItemInInventory.item.Weight / 100f)); // Weight - the weight will work backwards at 50 LBS. if it is 49 LBS, you have a 2% chance
|
||||
|
||||
float ChanceForSuccess = ((A+B+C) / 3); // add the percenct, divide by 3 to get average. - Done.
|
||||
|
||||
// lets base it off chance.
|
||||
|
||||
// Could use Vector3.Dot to make less likely to succeed when infront of the AI
|
||||
float RandomChance = (Random.value);
|
||||
Debug.Log("Item: "+keyItemInInventory.item.ItemName+"; A: "+A+"; B: "+B+"; C: "+C+"; ChanceForSuccess:"+ChanceForSuccess+"; RandomChance: "+RandomChance+";");
|
||||
|
||||
if (chanceForFailure > Random.value)
|
||||
{
|
||||
if (ChanceForSuccess < RandomChance) { // random selects a percent between 0% and 100%, and sees if yours is greater, if so, you have success.
|
||||
// Failed chance check
|
||||
RckAI ai = LootingInventoryUI.instance.curLootingPoint.GetComponent<RckAI>();
|
||||
ai.TryEngageWithPlayer(); // Engage with player
|
||||
ai.TryEngageWithPlayer(); // Engage with player - Lets get faction instead of every fucker in the area.
|
||||
LootingInventoryUI.instance.CloseUI();
|
||||
return;
|
||||
} else { // Reward Player
|
||||
EntityAttributes.PlayerAttributes.attributes.DexterityPoints += 1;
|
||||
A = (float)EntityAttributes.PlayerAttributes.attributes.DexterityPoints;
|
||||
B = (float)EntityAttributes.PlayerAttributes.attributes.Dexterity;
|
||||
while (A >= (B*3)) {
|
||||
EntityAttributes.PlayerAttributes.attributes.Dexterity += 1;
|
||||
float D = (A-(B*3f));
|
||||
EntityAttributes.PlayerAttributes.attributes.DexterityPoints = (int)D;
|
||||
A = (float)EntityAttributes.PlayerAttributes.attributes.DexterityPoints;
|
||||
B = (float)EntityAttributes.PlayerAttributes.attributes.Dexterity;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Some palce in the codebase seems to be calling this method after the CloseUI randomly, not sure why or where yet
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 03281a2cabdf57d48a759c4be7e4a03d
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,8 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 42e5ea2c0e1985e4b903cc2d239cfd7f
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
After Width: | Height: | Size: 65 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 9.8 KiB |
After Width: | Height: | Size: 91 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 91 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 12 KiB |
|
@ -1,5 +1,65 @@
|
|||
sceneSetups:
|
||||
- path: Assets/RPG Creation Kit/Demos/MainMenu/_MainMenu_.unity
|
||||
- path: Assets/Scenes/Exterior/Tellus (0,0)/Tellus (0,0).unity
|
||||
isLoaded: 1
|
||||
isActive: 1
|
||||
isSubScene: 0
|
||||
- path: Assets/Scenes/Exterior/Tellus (0,-1)/Tellus (0,-1).unity
|
||||
isLoaded: 1
|
||||
isActive: 0
|
||||
isSubScene: 0
|
||||
- path: Assets/Scenes/Exterior/Tellus (0,-2)/Tellus (0,-2).unity
|
||||
isLoaded: 1
|
||||
isActive: 0
|
||||
isSubScene: 0
|
||||
- path: Assets/Scenes/Exterior/Tellus (0,-3)/Tellus (0,-3).unity
|
||||
isLoaded: 1
|
||||
isActive: 0
|
||||
isSubScene: 0
|
||||
- path: Assets/Scenes/Exterior/Tellus (1,0)/Tellus (1,0).unity
|
||||
isLoaded: 1
|
||||
isActive: 0
|
||||
isSubScene: 0
|
||||
- path: Assets/Scenes/Exterior/Tellus (1,-1)/Tellus (1,-1).unity
|
||||
isLoaded: 1
|
||||
isActive: 0
|
||||
isSubScene: 0
|
||||
- path: Assets/Scenes/Exterior/Tellus (1,-2)/Tellus (1,-2).unity
|
||||
isLoaded: 1
|
||||
isActive: 0
|
||||
isSubScene: 0
|
||||
- path: Assets/Scenes/Exterior/Tellus (1,-3)/Tellus (1,-3).unity
|
||||
isLoaded: 1
|
||||
isActive: 0
|
||||
isSubScene: 0
|
||||
- path: Assets/Scenes/Exterior/Tellus (2,0)/Tellus (2,0).unity
|
||||
isLoaded: 1
|
||||
isActive: 0
|
||||
isSubScene: 0
|
||||
- path: Assets/Scenes/Exterior/Tellus (2,-1)/Tellus (2,-1).unity
|
||||
isLoaded: 1
|
||||
isActive: 0
|
||||
isSubScene: 0
|
||||
- path: Assets/Scenes/Exterior/Tellus (2,-2)/Tellus (2,-2).unity
|
||||
isLoaded: 1
|
||||
isActive: 0
|
||||
isSubScene: 0
|
||||
- path: Assets/Scenes/Exterior/Tellus (2,-3)/Tellus (2,-3).unity
|
||||
isLoaded: 1
|
||||
isActive: 0
|
||||
isSubScene: 0
|
||||
- path: Assets/Scenes/Exterior/Tellus (3,0)/Tellus (3,0).unity
|
||||
isLoaded: 1
|
||||
isActive: 0
|
||||
isSubScene: 0
|
||||
- path: Assets/Scenes/Exterior/Tellus (3,-1)/Tellus (3,-1).unity
|
||||
isLoaded: 1
|
||||
isActive: 0
|
||||
isSubScene: 0
|
||||
- path: Assets/Scenes/Exterior/Tellus (3,-2)/Tellus (3,-2).unity
|
||||
isLoaded: 1
|
||||
isActive: 0
|
||||
isSubScene: 0
|
||||
- path: Assets/Scenes/Exterior/Tellus (3,-3)/Tellus (3,-3).unity
|
||||
isLoaded: 1
|
||||
isActive: 0
|
||||
isSubScene: 0
|
||||
|
|