cain2001 0 Posted July 20, 2004 Im making a map where I want 1000 points for killing a soldier and 10000 for killing a tank. I put in this in the init file on both. this addeventhandler ["Hit",{[_this select 1] exec "Hit.sqs"}] this addeventhandler ["Hit",{[_this select 1] exec "Hit3.sqs"}] hit.sqs = soldiers sqs file hit3.sqs = tanks sqs file hit.sqs ?!(player==_this select 0):exit Hint "test2" player addScore 1000 exit hit3.sqs ?!(player==_this select 0):exit Hint "test2" player addScore 10000 exit On my own server i can get it to work. (MP) But when i upload it to a dedicated. I only recive the 1000 points for the soldier i killed. It wont give me any points for the tank getting killed. (tank=bmp in this case) I have a game logic named Server. I tried to use this command on the tank. But it stop working both on dedi server and mine. this addeventhandler ["Hit",{server call{[_this select 1] exec "Hit3.sqs"}}] Plz help me Cain Share this post Link to post Share on other sites
BraTTy 0 Posted July 20, 2004 Quote from Comref: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> MP notes: "Killed" and "Hit" event handlers are executed where given unit is local. All other event handlers are executed on all computers. Events added by addEventHandler may be different on each computer Share this post Link to post Share on other sites
cain2001 0 Posted July 20, 2004 Hmm, So these scrips are local? hmm i dont get it. But why does the Hit work on Soldiers but not on tanks and other vehicles? if i works on soldiers it should work on other things too. Share this post Link to post Share on other sites
Wadmann 0 Posted July 20, 2004 Hello cain2001! Â Â As per snYpir's OFPEC Guide: Multiplayer Editing available here, this is what he had to say about eventhandlers: Quote[/b] ]snYpir's MP editing rule 7: Be prepared for a great deal of pain if you start handling events (especially player-activated ones such as map clicks) in multiplayer. Remember that map clicks are local, and as such the server will need to be notified (via publicvariable of course) that a map click has occurred, and the position of the click. Read this tutorial and you may find a way to get it to work. That is about all the help that I can be, if I was any help at all! Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Wadmann Share this post Link to post Share on other sites
RED 0 Posted July 21, 2004 Hmm, So these scrips are local? hmm i dont get it.But why does the Hit work on Soldiers but not on tanks and other vehicles? if i works on soldiers it should work on other things too. From what I remember, hit only works when vehicles get hit by explosive rounds. RED Share this post Link to post Share on other sites
suma 8 Posted July 21, 2004 If you want to test kills, why using event "hit", and not "Killed" instead? Share this post Link to post Share on other sites
cain2001 0 Posted July 21, 2004 I tried Killed and it works better, but I still cant getthe script to work on the Dedic server. SnYpirs thing didt direct help me with anything. Share this post Link to post Share on other sites
RED 0 Posted July 21, 2004 You will need to set a public variable on the local computer that the server will be waiting for, then execute scripts that way. A quick example of this would be: this addeventhandler ["Killed",{[_this select 1] exec "Hit.sqs"}] hit.sqs: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> Startscriptset1 = true publicvariable "Startscriptset1" Then have a script running on the server (could be ran from your init.sqs file) <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> ?!(local server): exit @Startscriptset1 ..... This could obviously be greatly expanded on, it is just a quick example. RED Share this post Link to post Share on other sites
cain2001 0 Posted July 23, 2004 You will need to set a public variable on the local computer that the server will be waiting for, then execute scripts that way.A quick example of this would be: this addeventhandler ["Killed",{[_this select 1] exec "Hit.sqs"}] hit.sqs: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> Startscriptset1 = true publicvariable "Startscriptset1" Then have a script running on the server (could be ran from your init.sqs file) <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> ?!(local server): exit @Startscriptset1 ..... This could obviously be greatly expanded on, it is just a quick example. RED Did get that script u wrote to work . Anway a m8 told me to put this in the init field. this addeventhandler Quote[/b] ]this addeventhandler ["Killed",{format [{Server call %1},(_this select 1) addscore 10000]}]'it works perfect on my server but on dedi it stops working. Logic thing with the server name is still on. I dont see why it shouldt work? It so 100% clear! Share this post Link to post Share on other sites
swatdog 0 Posted May 2, 2005 Just a tip on "hit" EH: Hit doesn't work well on tanks or armored vehicles because the projectile fired at it must inflict ATLEAST 5% damage. So a single bullet from an M16 will not inflict enough damage for this event to activate. Now an M203 round might set it off (haven't tried it) and maybe a 30mm would also, a round from an M82 sniper rifle with an explosive round will set it off also. If you're wanting something to happen when a tank dies (like setting a score) then I would just use the "killed" EH instead like Suma suggested. I can't really comment on eventHandlers in MP because I don't have any experience in using them in MP. Please post here if you've found anything out that would be useful. Share this post Link to post Share on other sites