Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added DMS_fnc_TargetsKilledPercent function, to check % of alive bots #81

Open
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

Ravenger2709
Copy link

@Ravenger2709 Ravenger2709 commented Sep 17, 2024

Added DMS_fnc_TargetsKilledPercent function, to check alive bots and if count >= value in DMS_AI_KillPercent - go nect to playerNear condition and finish mission

Changed bandit.sqf mission to demonstrate function working.

Change DMS_fnc_MissionSuccessState function to work with new condition.

…if count <= value in DMS_AI_KillPercent - go nect to playerNear condition and finish mission

Changed bandit.sqf mission to demonstrate function working.

Change DMS_fnc_MissionSuccessState function to work with new condition.
@Ravenger2709
Copy link
Author

Fixed, tested with DMS_AI_KillPercent = 50
Work properly now

Copy link
Collaborator

@eraser1 eraser1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using a global variable to record the initial count only works if there is a single mission, or the same number of initial AI for each mission.

I'm not sure there's an easy way to resolve this without modifying the mission itself. I think it would be easiest to have the threshold calculated by the mission, and then pass the threshold as an additional parameter to fn_TargetsKilledPeecent.

@Ravenger2709
Copy link
Author

Ravenger2709 commented Sep 17, 2024

I have an error

19:24:48 Error in expression <pletionArgs];
throw "ERROR";
};
};

if (_success && {_absoluteWinCondition}) the>
19:24:48 Error position: <_success && {_absoluteWinCondition}) the>
19:24:48 Error Undefined variable in expression: _success
19:24:48 File x\addons\dms\scripts\fn_MissionSuccessState.sqf..., line 77
19:24:48 Error in expression <on = _x param [2, false, [true]];

if (!_success && {!_absoluteWinCondition}) th>
19:24:48 Error position: <_success && {!_absoluteWinCondition}) th>
19:24:48 Error Undefined variable in expression: _success
19:24:48 File x\addons\dms\scripts\fn_MissionSuccessState.sqf..., line 40
19:24:48 Error in expression <t);
};

case "playernear":
{
_success = _success && (_completionArgs call DMS_fn>
19:24:48 Error position: <_success && (_completionArgs call DMS_fn>
19:24:48 Error Undefined variable in expression: _success
19:24:48 File x\addons\dms\scripts\fn_MissionSuccessState.sqf..., line 64
19:24:48 Error in expression <pletionArgs];
throw "ERROR";
};
};

if (_success && {_absoluteWinCondition}) the>
19:24:48 Error position: <_success && {_absoluteWinCondition}) the>
19:24:48 Error Undefined variable in expression: _success
19:24:48 File x\addons\dms\scripts\fn_MissionSuccessState.sqf..., line 77
19:24:48 Error in expression <S_fnc_DebugLog;
};
};
} forEach _this;

_success;
}>
19:24:48 Error position: <_success;
}>
19:24:48 Error Undefined variable in expression: _success
19:24:48 File x\addons\dms\scripts\fn_MissionSuccessState.sqf..., line 92

But have no idea how to fix it now. Do u know da way?

@Ravenger2709
Copy link
Author

Ravenger2709 commented Sep 18, 2024

I found the decision, need more time to test

@Ravenger2709
Copy link
Author

Ravenger2709 commented Sep 18, 2024

Have some issue with Initial unit count and Total living units

This result then mission starts.

Bots count in mission

_AICount = (5 + (round (random 4)));

12:28:56 "DMS DEBUG :: Kill percent value: 50"
12:28:56 "DMS DEBUG :: Initial unit count: 6"
12:28:56 "DMS DEBUG :: Units threshold (killed units): 3"
12:28:56 "DMS DEBUG :: Total living units: 10"
12:28:56 "DMS DEBUG :: Total killed units: 0"
12:28:56 "DMS DEBUG :: Kill percent condition not met"

After killing 3 bots

12:29:56 "DMS DEBUG :: Kill percent value: 50"
12:29:56 "DMS DEBUG :: Initial unit count: 6"
12:29:56 "DMS DEBUG :: Units threshold (killed units): 3"
12:29:56 "DMS DEBUG :: Total living units: 7"
12:29:56 "DMS DEBUG :: Total killed units: 0"
12:29:56 "DMS DEBUG :: Kill percent condition not met"

Now Total living units = Initial unit count
Killing 3 more bots...

Result

12:30:56 "DMS DEBUG :: Kill percent value: 50"
12:30:56 "DMS DEBUG :: Initial unit count: 6"
12:30:56 "DMS DEBUG :: Units threshold (killed units): 3"
12:30:56 "DMS DEBUG :: Total living units: 4"
12:30:56 "DMS DEBUG :: Total killed units: 2"
12:30:56 "DMS DEBUG :: Kill percent condition not met"

Killing one more

12:32:11 "DMS DEBUG :: Kill percent value: 50"
12:32:11 "DMS DEBUG :: Initial unit count: 6"
12:32:11 "DMS DEBUG :: Units threshold (killed units): 3"
12:32:11 "DMS DEBUG :: Total living units: 3"
12:32:11 "DMS DEBUG :: Total killed units: 3"
12:32:11 "DMS DEBUG :: Kill percent condition met"

It`s work almost fine, but i think that need some fix here

If i use _AICount = 5 ; instead _AICount = (5 + (round (random 4))); Total living units > Initial unit count too.

What do you think about this?

@Ravenger2709
Copy link
Author

Ravenger2709 commented Sep 18, 2024

Solved

@Ravenger2709
Copy link
Author

Hey! How are you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants