combat-agent 0 Posted December 31, 2005 Is there a way to detect who activated a Useraction? heres the basic format of my action. The unit that activated the action and a couple other variables need to be passed to the script. I know it is easy to detect who activated a addaction action, so hopefully this is the same. class makeithappen { displayName="This is what need to happen"; position="pos driver"; radius=2.500000; condition="this == that && alot of other stuff"; statement="[this,UNITWHOACTIVATEDTHEACTION,""OTHERSTUFF""] exec ""myfriggenscipt.sqs"";"; }; thanks in advance CA Share this post Link to post Share on other sites
UNN 0 Posted December 31, 2005 Your not giving much away there Apart from the fact there is a drivers position involved, somewhere along the line. If anyone can activate it, then it could be tricky. If it's just the driver. Then it's easy. Share this post Link to post Share on other sites
AliMag 0 Posted December 31, 2005 The script that is called by the event, in your case 'myfriggenscipt.sqs', receives a few parameters (_this). The first one is the object/vehicle who owns the useraction and the second one is the unit who triggered it. (the third one is the action id in case you need to remove it) So (_this select 0) = owner of the action and (_this select 1) = the unit who triggered it. I hope this is what you were asking for Cheers Share this post Link to post Share on other sites
combat-agent 0 Posted December 31, 2005 Quote[/b] ]The first one is the object/vehicle who owns the useraction and the second one is the unit who triggered it. (the third one is the action id in case you need to remove it)So (_this select 0) = owner of the action and (_this select 1) = the unit who triggered it. Have you tested that? I have done a little test, and it did not work. class UserActions { class TEST { displayName="TEST"; position="barrel_rec"; radius=2.500000; condition="alive this"; statement="[] exec ""\usconfig\SCRIPTS\test.sqs"" "; }; }; Test.sqs _1 = _this select 0 _2 = _this select 1 _3 = _this select 2 hint format["%1, %2, %3", _1,_2,_3] exit on action hint said "scalar bool array string 0xfcffffef, scalar bool array sting 0xfcffffef, scalar bool array string oxfcffffef" I hope im just doing something wrong and detecting who did activate the trigger is easy. Now ive done this with addaction and works like a charm, but i would rather not go that route. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">Apart from the fact there is a drivers position involved, somewhere along the line. If anyone can activate it, then it could be tricky. If it's just the driver. Then it's easy. Actually that point is just where the useraction should be given from, i think its a plane or a point on a model. If not, anyone was able to activate it either way. Share this post Link to post Share on other sites
Student Pilot 0 Posted December 31, 2005 Quote[/b] ]statement="[] exec ""\usconfig\SCRIPTS\test.sqs"" "; Should be: Quote[/b] ]statement="_this exec ""\usconfig\SCRIPTS\test.sqs"" "; -Pilot Share this post Link to post Share on other sites
UNN 0 Posted December 31, 2005 Quote[/b] ]The first one is the object/vehicle who owns the useraction and the second one is the unit who triggered it. (the third one is the action id in case you need to remove it) That only works with User Actions created with the scripted, AddUserAction command. Then, you cant adjust things like radius or condition. For config user actions, you only get one parameter. The thing the action was attached to. So if it was just for the driver, and the action was attached to a vehicle. You could get the driver easily using the scripts commands. If it can be activated by anyone, including the driver. It gets a bit harder. You might have to resort to a nearestObject. Quote[/b] ]Actually that point is just where the useraction should be given from, i think its a plane or a point on a model. If not, anyone was able to activate it either way. Ok, I was not sure if you wanted the action available to anyone. Or just available to someone like the gunner or driver? Share this post Link to post Share on other sites
combat-agent 0 Posted December 31, 2005 Quote[/b] ]Ok, I was not sure if you wanted the action available to anyone. Or just available to someone like the gunner or driver? I would like it available to everyone, this situation in particular is to take a weapon off a tripod. Which it would be good if this was available to everyone, just incase you decide you want to add an extra machine gun from the static mg you just taken out. I guess i wouldnt be too hurt if it was just the person who put the mg on the tripod, but if their are multiple mg teams, the appropiate unit varible will need to passed. Quote[/b] ]statement="_this exec ""\usconfig\SCRIPTS\test.sqs"" "; says theres a local variable in global space which it was refering to the _this Thanks for the input Share this post Link to post Share on other sites
UNN 0 Posted January 1, 2006 In that case I would use the AddUserAction command from a script instead. It can still be attached from an addon. Although the action radius is set at about, 25m(?) But at least you can easily identify who activated it. Then make them walk to the MG if it's the AI. Or give a warning mesage, saying they should move close, if it's a player and your bothered about the radius. Share this post Link to post Share on other sites
combat-agent 0 Posted January 1, 2006 Quote[/b] ]In that case I would use the AddUserAction command from a script instead. It can still be attached from an addon. Although the action radius is set at about, 25m(?) Im just going to something like that. I think Im stressing to much over lag. There wont be to many mgs on the map so it wont be a problem. CA Share this post Link to post Share on other sites