cain2001 0 Posted November 6, 2004 Im working on a map where i need to dected when a players score gets to 20 and 30. So far i tried this line but i havnt got it to work. (I want to dected the score on human players) <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">?(Player score =30): hint "..." Comreff says Quote[/b] ]Description: Â Â MP: Check unit score. Example: Â Â score unitOne Also, is it possible to delete every object 50feet about the ground? I place poles in the air and if anyobject gets close to them they will get deleted. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">#start ?(_this select 0 distance pole1<50): Â deletevehicle _this select 0 ?(_this select 0 distance pole2<50): Â deletevehicle _this select 0 ?(_this select 0 distance pole3<50): Â deletevehicle _this select 0 goto "start" Share this post Link to post Share on other sites
Blanco 0 Posted November 6, 2004 if the Comref says <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> Â score unitOne why don't you use it that way? <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">?(score player >= 30) : hint "..." ...and you better use >= instead of == Share this post Link to post Share on other sites
cain2001 0 Posted November 6, 2004 hmm i tried that but i still dosnt work, it gives me an error that i cant use player. I tried to use this select 0 = _man ?(score _man >= 30) : hint "..." I tried 20 diffrent things know and i know its some simple thing. Share this post Link to post Share on other sites
gandalf the white 0 Posted November 6, 2004 break apart the "serial killer" mission, see the scripts that unlock vehicles as the killer kills more . Share this post Link to post Share on other sites
General Barron 0 Posted November 8, 2004 What is the error exactly? It should work, unless you need parenthesis: ? (score player) >= 30 : hint "..." I usually use parenthesis around every single command/operation, because I don't really know the "order of operations" for OFP commands. Share this post Link to post Share on other sites
Blanco 0 Posted November 8, 2004 Maybe you need the rating command? Share this post Link to post Share on other sites
cain2001 0 Posted November 8, 2004 this is strange, i tried using a event handler on an enemy ai soldier. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">This addEventHandler ["Killed",{[_this select 1] exec "acp\checkscore.sqs"}]; checkscore.sqs <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">Hint format ["%1 Your score is %2",Name player,Score player] ~1 ? (score _player) >= 30: Hint format ["%1 you reached 30 kills",name player] It gives me a "unknown operator player" error When i tried to just use <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">Hint format ["Your name is %",name player] i can see my name when i killed the ai, but as soon i put in the score player it dosnt work. I made a little own kills count script, but last time i tried it was far from working <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> ?(_kills) > 0 : goto "Start" _kills=0 #Start _kills=_kills+1 Hint format ["%1 You have %2 kills",name player, _kills player] ? (_kills >=30 : Hint format ["%1 reached 30 kills",name player] ? (_kills >=40 : Hint format ["%1 reached 40 kills",name player] Exit So the scritp is activated by an eventhandler "killed" on each player. It will run every time u kill someone and automatically add 1 _kill. its pretty stupid that the score player dosnt work. Share this post Link to post Share on other sites
General Barron 0 Posted November 8, 2004 <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">? (score _player) >= 30 There is your problem. You never define the variable _player, so I'll bet the error is really "unknown operator _player". The line should be: ? (score player) >= 30: Hint format ["%1 you reached 30 kills",name player] As for your second script, there is lots of stuff wrong , unless I'm misunderstanding you. First off, if it runs off a "killed" EH on each PLAYER, then the script will only be run when the PLAYER is killed. Instead it should be run from a killed EH on each ENEMY. Secondly, the script doesn't DO anything, as it stands. The problem is that you are using LOCAL variables instead of GLOBAL ones. The result is that _kills will always be undefined at the first line, so it will then be set to 0 on the second line. Then at the very end, the script exits, and _kills is just thrown in the garbage. Removing the underscore should solve the problem, but this is where my lack of knowledge in MP editing kicks in, so I'm not 100% sure about that... Share this post Link to post Share on other sites
cain2001 0 Posted November 9, 2004 ohh but it still no diffrence when i use player. I guess somthing is wrong with my ofp. because it says <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">Description: MP: Check unit score. Example: score unitOne I tried to use _ this select 1 = _man and _ this select 0 = _man and then ? (score _man) >= 30: Hint format ["%1 you reached 30 kills",name _man] lol i suck :P hope anyone can figure this out Share this post Link to post Share on other sites
TeRp 1 Posted November 9, 2004 give the player a name (e.g. plr1). use score plr1 then............. Share this post Link to post Share on other sites
General Barron 0 Posted November 9, 2004 First off, there may be some... complications with using the "player" command in MP, since it will return a different value depending on which computer the command is run on, or if it is on the server... and I don't know which computer runs the EH, so that might be the problem. But with that aside, there are still some errors here: Quote[/b] ]I tried to use_ this select 1 = _man and _ this select 0 = _man First off, I hope that was a typo, and you really meant "_this", with no space between the underscore and the "t". Next, what you are doing there is you are trying to take whatever is in the variable _man, and put it into the variable (_this select 0). You should be doing the reverse: taking the value out of the _this array and putting it into the _man variable. So it really should look like this: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_man = _this select 0 Remember that assignment statements read left to right. If you don't get that, meaning it wasn't just a dumb mistake on your part, then you better go back and re-read your favorite scripting tut. I'm not sure I can help you more, since (a) my MP knowledge is almost nothing, and (b) I would need to know exactly WHAT the error message says, and exactly WHERE the |#| sign is located. Share this post Link to post Share on other sites
cain2001 0 Posted November 10, 2004 i tried using names but nothing worked so far. It seems that score player and _man cant be read somehow. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">this addeventhandler ["Hit",{hint format ["%1",score]}] gives "NOID empty" , but i cant add any name or _this select x to it. I even tried to put score p2 in a trigger but it says "type number, expect nothing" well maybe i should just forget about this, or if i could make my own counting kills scrip. Share this post Link to post Share on other sites
cain2001 0 Posted November 13, 2004 before i throw this ideas away i just want to check if anyone have any last thing that might work. Question is if its possible to make any own "counting kills" script. Thanks Share this post Link to post Share on other sites
General Barron 0 Posted November 13, 2004 Ok, I think I have a hunch here. Do you have a global variable anywhere in your mission called "score"? If so, that is what is messing up the "score" command. I ran into this problem with an ECP cutscene after I added in a script to the ECP. After pulling out my hair for hours, I finally noticed there was a guy named "leader", which was messing up the script that used the "leader" command. I'm asking this because of your EH here: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">this addeventhandler ["Hit",{hint format ["%1",score]}] That EH makes no sense, because you have no arguments next to the score command. Unless of course "score" is a variable, which would make sense. Quote[/b] ]Question is if its possible to make any own "counting kills" script. Yes, of course it is possible. Share this post Link to post Share on other sites
cain2001 0 Posted November 16, 2004 I still dont get it Quote[/b] ]Description: MP: Check unit score. Example: score unitOne I could exec a "checkscore.sqs" from the init in init i would just have to use, #start ? (score player) > 1: Hint format ["Your score is %1",score player] ~60 goto "start" but why istn it working? score unitOne dosnt seem to work with 1.96 Share this post Link to post Share on other sites
RED 0 Posted November 16, 2004 I just tested it and the score command worked fine for me: Hint format ["Your score is %1",score unitname] RED Share this post Link to post Share on other sites
General Barron 0 Posted November 17, 2004 Are you sure you aren't using "score" as a global variable anywhere in your mission? Try doing exactly what Red just did, only in a brand new mission in your editor. Share this post Link to post Share on other sites
cain2001 0 Posted November 17, 2004 Ahhh sweet GB and Red, the problem was with this item <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> class Item18 { position[]={9826.126953,28.377281,1181.887085}; a=0.000000; b=0.000000; activationBy="ALPHA"; repeating=1; age="UNKNOWN"; text="Score"; name="Score"; expActiv="Showscore=true; PublicVariable ""ShowScore"""; class Effects Ahh man im such a noob, but i guess thats the way to learn. Hopefully my little testing pack should work now! but if not, check this thread soon ;) Thanks again guys. EDIT: One more thing, is it possible to make a doubble kill script? A script that counts if u killed two players within 3 sec. Share this post Link to post Share on other sites
RED 0 Posted November 17, 2004 Create a trigger that covers the Island, activated by anybody with this in its onactivation field: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">"_x addEventHandler [{killed},{_this exec {count.sqs}}]" foreach thislist Count.sqs: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _killed = _this select 0 _killer = _this select 1 _TimeOfKill = time ?_killer != player: exit KillArray = KillArray + [[_killed,_killer,_TimeOfKill]] ; - Check for double kill ?(count KillArray) == 1: exit _id = (count KillArray) - 1 _pID = _id - 1 ?(((KillArray select _ID) select 2) - ((KillArray select _PID) select 2)) <= DoubleKillTime: hint "Double Kill!" Then make two values in your init.sqs: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> ; Array to hold dead men KillArray = [] ; Time allowed between kills for double kill DoubleKillTime = 3 RED Share this post Link to post Share on other sites
cain2001 0 Posted November 17, 2004 Sweet, it works perfectly! Many thanks! One question, which value is it that decides how many kills should be allowed? (Im going for a multi kill = 5 kills i think) Your scripting looks like pure greek to me. But i added a <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">; Time allowed between kills for multi kill MultiKillTime = 10 in the init and made a cont2.sqs. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">; - Thanks to RED for this script _killed = _this select 0 _killer = _this select 1 _TimeOfKill = time ?_killer != player: exit KillArray = KillArray + [[_killed,_killer,_TimeOfKill]] ; - Check for multi kill ?(count KillArray) == 1: exit _id = (count KillArray) - 1 _pID = _id - 1 ?(((KillArray select _ID) select 2) - ((KillArray select _PID) select 2)) <= MultiKillTime: multikill = _killer;publicvariable "multikill" Thanks in advance. Share this post Link to post Share on other sites
RED 0 Posted November 17, 2004 Multi kill is a bit harder, if you want both 'Double kill' and multi kill, this is a bit of sloppy way of doing it: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _killed = _this select 0 _killer = _this select 1 _TimeOfKill = time ?_killer != player: exit KillArray = KillArray + [[_killed,_killer,_TimeOfKill]] ; - Check for double kill ?(count KillArray) == 1: exit _id = (count KillArray) - 1 _pID = _id - 1 ?(((KillArray select _ID) select 2) - ((KillArray select _PID) select 2)) <= MultiKillTime: multikill = "Double kill";publicvariable "multikill" ;Check for multikill ?(count KillArray) < 5: exit _IDM = _ID - 4 ?(((KillArray select _ID) select 2) - ((KillArray select _PID) select 2)) <= MultiKillTime: multikill = "Multi kill";publicvariable "multikill" exit Not tested. RED Share this post Link to post Share on other sites
cain2001 0 Posted November 18, 2004 didnt get it to work, but you done more then enough already. Atm im just out of ideas. I have the sounds -10ultrakill.ogg -15killing_spree.ogg -firstblood.ogg -humiliation.ogg So i dunno if humiliation is if u get TKed. Firstblood = first kill. Ultrakill if u get 10 kills without dieing. killing spee if u get 15 without dieing. Are these things good to use or should i focus on other "cool" functions insteaD? Edit: If you also know a way to combat cheats execpt the ones i already got Quote[/b] ]Player speed: If a player moves faster than the set paramaters a warning message is given off.Player damage: If weapons cause more damage than they should be doing another message is given off. Player viewdistance: If a player kills someone outside of the map view/fog distance a message is given off. Please leave a suggestion. I was thinking about somthing that checks how many bullets have been fired with eh. Like 40 bullets in less than 10 sec is inpossible because it takes 5 to just reload and 10s to fire 30 bullets with full auto Share this post Link to post Share on other sites
RED 0 Posted November 18, 2004 Just tested the MultiKill script, this one will work: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _killed = _this select 0 _killer = _this select 1 _TimeOfKill = time ?_killer != player: exit KillArray = KillArray + [[_killed,_killer,_TimeOfKill]] ; - Check for double kill ?(count KillArray) == 1: exit _id = (count KillArray) - 1 _pID = _id - 1 ?(((KillArray select _ID) select 2) - ((KillArray select _PID) select 2)) <= MultiKillTime: hint "Double Kill" ;Check for multikill ?(count KillArray) < 5: exit _IDM = _ID - 4 ?(((KillArray select _ID) select 2) - ((KillArray select _IDM) select 2)) <= MultiKillTime: hint "Multi Kill" exit I made a mistake which stopped it working correctly. As for cool features, I am not sure what you are trying to acomplish in your mission so I couldn't say :P RED Share this post Link to post Share on other sites
cain2001 0 Posted November 18, 2004 Ahh man u rock! It works perfectly! As for my little project i call it ACP (Anti Cheat Project). Read my sign = im banned from most server coz they think i cheat. So decided to get some people (like u) to help me out with my ideas to prevent stuff like, speed cheat, fog cheat ect. Also added stuff like "Headshot" when u get a headshot and these double/multi kills because i think it would make people like the maps even more. But this is just the beginning. My final goal is to script in the map stuff like, Bulletsfired/Bullets hit = % accrucy. How many headshots made of total kills. Total movement. And every other script that can compare the good players and the not so good ones. Just because u have 60 kills dosnt prove your the best. I want to find ways to find out who the true player is instead of the ones just going for kills and never flags. But this might be more possible in OFP2 // A thankfull cain ty Share this post Link to post Share on other sites