Pandut wrote: ↑Thu Oct 27, 2022 10:21 pm
This checks for a specific player class and then does nothing because
{} on its own is an empty statement.
You need to either move the
CheckInventory part inside the curly braces:
Code: Select all
if (PlayerClass(4))
{
if (CheckInventory("ManaPool") < 200)
{
GiveInventory("ManaPool", 1);
}
}
or use the
&& operator to combine the checks:
Code: Select all
if (PlayerClass(4) && CheckInventory("ManaPool") < 200)
{
GiveInventory("ManaPool", 1);
}
The two code snippets above are
almost equivalent: they will function exactly the same, but in the latter case,
CheckInventory will be called regardless of the return value of
PlayerClass because ACS does not have short-circuit evaluation.
Note that if you have only a single statement (e.g. function call) inside the
{}'s, then you do not need them. E.g. this will work fine too:
Code: Select all
if (PlayerClass(4) && CheckInventory("ManaPool") < 200)
GiveInventory("ManaPool", 1);
(I much prefer to use
{}'s everywhere for consistency, though.)
You can use such constructs in both of your scripts, with different player classes/inventory amounts etc.