legion7698 0 Posted April 15, 2010 (edited) Hey All, I seem to have anouther problem with my breaching door addon (see my last thread). I'm pretty sure I have the correct lines in the model config as I copied it from a previous piece of work that actually worked. So my problem must be with the script itself. So the result I'm after is when the player goes near the door, they get the option to breach it. This is only aloud to be done if the player has a breaching charge in thier inventory, which is the issue that was resolved in my last thread. My problem is that despite my best tries, no action is appearing in the action menu when I get near the door and more than likely if it did, there would be a problem with the rest of my script anyway. So here is what I have in my script so far (please dont laugh, I have no clue as to what I put in these things, more just copy and paste what seem would appear to possible work) Breachinit.sqs _BD = _this select 0 _unit = nearestObject["BD","Player"] ; this bit I know works ?"RC_Breach" in magazines _unit: goto "BREACH" goto "END" #BREACH ;This is to test to see if its actually calling properly, after this is done I shall replace the sidechat bit with some effects that will make it look like I've blown it up _unit sidechat "testing" _unit removemagazine "RC_Breach" #END exit Also just in case it is the line that I am putting in my config (which I'm pretty sure is working) class eventhandlers { init=" [_this Select 0] exec {\RC_BD\Breachinit.sqs}"; }; Thanks in advance for any help rendered. Regards, LEGION7698. Edited April 15, 2010 by LEGION7698 Share this post Link to post Share on other sites
poweruser 10 Posted April 15, 2010 As you say yourself, that you have no clue on what you put in the script, you will be better off starting over with the following approach: For the useraction, I'd suggest that you define it in the objects config Reference: http://community.bistudio.com/wiki/UserActions class YourBreachDoorObject: someClass { // your config class Useractions { class breach_action { position = "view"; // change if needed displayName = "Breach me"; radius = 5; condition = "(""RC_Breach"" in (magazines player)) && (player distance this) < 5"; statement = "player sidechat ""testing"";"; // execute a script here, that does the breaching }; }; }; (adjust the class names of course, to match your config) Without (player distance this) < 5 the action to breach would apprear in the AI's action menu (FX - 6) once one of the player's AIs is near to it. And afaik its not possible to find out who used the action (what player or AI), just on what client. Then you need some mechanism to remember that the door has been breached, otherwise the action would still show up after using it. Define a custom animation (translation, rotation, doesnt matter) on your object (for example: "alreadyBreached"). Reference: http://community.bistudio.com/wiki/Animations http://community.bistudio.com/wiki/Model_Config And animate it to phase 1 when breaching it, with : this animate ["alreadyBreached", 1]; The additional check in the useraction condition: (this animationPhase "alreadyBreached" < 0.5) When the custom animation is correctly defined, the animation will be played on all clients, meaning that your addon will be mp-compatible. To undo the breaching during the game, execute this on your object: this animate ["alreadyBreached", 0]; Then the action will show up again, assuming that the other conditions are met aswell. Share this post Link to post Share on other sites
legion7698 0 Posted April 15, 2010 Hey Dengibtsschon, That apeared to do the trick, cheers for the help. Regards, LEGION7698. Share this post Link to post Share on other sites