Whenever the player picks up a weapon, inventory item, or piece of armor, it adds a set amount of an inventory item - WeaponBulk. A 10mm pistol adds 12 units. The hard limit is 1200 WeaponBulk units, and after that the player can carry no more. This aspect functions perfectly adequately.
What I'm needing is a separate ACS script which decreases the player's speed based on how much of that WeaponBulk item they have. I've taken some previous scripts used in my mod and attempted to reverse engineer something together, but haven't been super lucky just yet.
Code: Select all
Script "InventorySpeedSystem" ENTER
{
While(true)
{
Delay(1);
If(CheckActorInventory(0,"WeaponBulk">149)){SetActorProperty(0, APROP_SPEED, 0.75);}
If(CheckActorInventory(0,"WeaponBulk">299)){SetActorProperty(0, APROP_SPEED, 0.7);}
If(CheckActorInventory(0,"WeaponBulk">399)){SetActorProperty(0, APROP_SPEED, 0.55);}
If(CheckActorInventory(0,"WeaponBulk">599)){SetActorProperty(0, APROP_SPEED, 0.4);}
If(CheckActorInventory(0,"WeaponBulk">799)){SetActorProperty(0, APROP_SPEED, 0.25);}
If(CheckActorInventory(0,"WeaponBulk">999)){SetActorProperty(0, APROP_SPEED, 0.1);}
Restart;
}
}