Jump to content
Sign in to follow this  
igneous01

not kbwasSaid is not working?

Recommended Posts

So i have this really basic script that checks distance between two cars, if carA gets too close, the passenger will say something to warn you using kbtell. if carA gets too far from B, then the passenger will again say something to warn you your going to lose him.

However the problem im having is that the line the passenger says is getting spammed everytime through the while loop. this is my script and the condition im using:

private ["_follower", "_target", "_dist", "_targetknows", "_distmin", "_distmax"];
_follower = _this select 0;
_target = _this select 1;
_distmin = _this select 2;
_distmax = _this select 3;
_dist = _follower distance _target;
pavel kbAddTopic ["Tail", "kb\conversations.bikb", ""];

while {(_dist < _distmax) && (_dist > _distmin)} do {
_dist = _follower distance _target;
_targetknows = _target knowsabout _follower;
if (_dist < 80 && !(pavel kbWasSaid [_follower, "Tail", "Pavel_TooClose", 25])) then {
	pavel	kbTell [_follower, "Tail", "Pavel_TooClose"];
};
if (_dist > 250 && !(pavel kbWasSaid [_follower, "Tail", "Pavel_TooFar", 25])) then {
	pavel	kbTell [_follower, "Tail", "Pavel_TooFar"];
};
//hintsilent format ["Distance: %1m, Knowsabout: %2", _dist, _targetknows];
sleep 0.5;
};

obj1 settaskstate "FAILED";
nul = [objNull, ObjNull, obj1, "FAILED"] execVM "CA\Modules\MP\data\scriptCommands\taskHint.sqf";
Following = false;
_target doMove (getmarkerpos "getaway");
_target setspeedmode "FULL";
sleep 5; 
endmission "LOSER";

I have set the max age in kbwassaid to 25 seconds, yet every second Pavel keeps saying your going to fast?? Is it because there is no audio file with my conversation, or something else im missing?

Share this post


Link to post
Share on other sites

not knowing too much about the kbWasSaid, but isnt your logic switched here?

shouldnt you use condition without !

before it says that if the said part is not completed, say it again???

now it says if only its done saying..

if (_dist < 80 && (pavel kbWasSaid [_follower, "Tail", "Pavel_TooClose", 25])) then {

Share this post


Link to post
Share on other sites

no, as that checks to see if it was said within the last 25 seconds, so it will return true everytime. What I want is for if condition to be true if the distance and pavel has not said anything in the last 25 seconds. So its not spamming text at the bottom

Share this post


Link to post
Share on other sites

ok, i see in your script you have extra spaces?

pavel	kbTell

is that just from copy paste, or actually in script? if in script im guessing thats not good.

sorry i cant help more with script, the distance parts look ok.

maybe an issue with what follower is? vehicle follower etc...

Share this post


Link to post
Share on other sites

the space is from the copy paste, the lines are all said and everything works fine, but !kbwasSaid is returning true even tho a line was said 2 seconds ago. Im thinking the last parameter is either not working as intended, or is a random selection from 0 seconds to max age?

anyone else might know a little more about this?

Share this post


Link to post
Share on other sites

a) use diag_log logging to understand what is happening

b) your logic using kbwasSaid seems faulty. it is to be used with waitUntil

it will become true once the text was fully spoken and remain true

so you probably have to remove it from kbtell and readd it to use it again and again

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×