Jump to content
Sign in to follow this  
Alias001

Can someone please help me fix my stupid addaction?

Recommended Posts

I'm working on a mission where the players have to steal some info from a computer in an enemy base and I want to have the computer itself be interactive. I've made MOST of a successful addaction that almost does what I want but my lack of experience and sleep is really starting to tell.

The computer is called Intellappy, in a trigger that fires (and definitely works) at the start of the mission I've got the following code:

intellappy addAction ["<t color=""#F6FF00""> Retrieve Intel",{PLAYER playmove "AinvPercMstpSnonWnonDnon_Putdown_AmovPercMstpSnonWnonDnon"; a disableAI "ANIM"; intelgathered = true;}, [], -1, false, true, "", "intellappy distance _target < 1.5"];

That works beautifully, you walk up to the computer, the addaction shows up in pretty yellow, you select it, it plays the picking stuff up animation and ticks off the intelgathered variable. The problem I'm having is that I only want it to be used once to remove any chance of confusing people if the option is still there. I thought in the trigger condition I'd just be able to say "not intelgathered", "not(intelgathered)", "!intelgathered" or "intelgathered = false" but those just broke the addaction entirely.

I thought I'd come at it from the other angle and tried making a new variable called intelneeded and had the addaction trigger conditional on that and it NEARLY worked, I made a new trigger to automatically fire at mission start to set intelneeded to true, I set the addaction trigger to repeatedly check for the condition of intelneeded and inside the addaction I changed from "intelgathered = true" to "intelneeded = false". I put in a hint to verify that the addaction was definitely doing something and that worked okay but for some reason it's just not working right. I know there's a simple thing I've overlooked somewhere but its a bit after midnight and my brain isn't quite working right anymore. Does Arma do testing for false conditions in some weird way that might be tripping me up?

Also, how on earth do you get the name of the unit that performs an action? I just can't get the right search terms for it, I'd hate to have one player use the addaction and another player get the animation, sure it'd be funny but only the first few times and even then only if its not happening to me. I assumed it was the _target part of the addaction but that at least didn't seem to work when playing the animation. I have a feeling that's because the animation command is inside the little code block for the addaction and doesn't know what _target is. How would I pass this to the addaction?

I should add that since its so staggeringly basic, I'm trying to avoid needing a script for it

Share this post


Link to post
Share on other sites

init.sqf

intelGathered = false;

actionID = intellappy addAction ["<t color=""#F6FF00""> Retrieve Intel",{PLAYER playmove "AinvPercMstpSnonWnonDnon_Putdown_AmovPercMstpSnonWnonDnon"; a disableAI "ANIM"; intelGathered = true;[color="#FF0000"]publicVariable "intelGathered";[/color]}, [], -1, false, true, "", "intellappy distance _target < 1.5 && !intelGathered"];

You should also think about writing a script instead of running the code directly in the addaction.

actionID = intellappy addAction ["<t color=""#F6FF00""> Retrieve Intel",[color="#0000FF"]"laptop.sqf"[/color], [], -1, false, true, "", "intellappy distance _target < 1.5" && !intelgathered"];

laptop.sqf

_lapTop = _this select 0 //object the addaction is attached to
_caller = _this select 1 // person whom used the action
_Id = _this select 2 // name of the action 

_caller playmove "AinvPercMstpSnonWnonDnon_Putdown_AmovPercMstpSnonWnonDnon"; 
a disableAI "ANIM";
[color="#FF0000"]intelgathered = true;
publicVariable "intelgathered";[/color]
_lapTop removeAction _Id; // not nessecary in this case since were hiding the action by condition

---------- Post added at 13:59 ---------- Previous post was at 13:37 ----------

updated - recheck the solution if you already hadn't.

Edited by Pac Man

Share this post


Link to post
Share on other sites

Okay thanks for the help, I've decided I might as well go for the scripting route, I was only really avoiding it because I understand it even less than regular arma coding but I suppose I should learn if I want to be even halfway good at this whole mission making game. I've got the intelgathered = false & actionID = intellappy addAction...etc in the init.sqf, created the laptop.sqf and the addaction appears on the laptop itself but still doesn't seem to function.

I put a hint in the script to see if it was firing and it doesn't show up, I assume hints should since they're a handy debugging tool. I decided to change the action from playing the animation to killing the player just because I know that command off by heart (which probably says a lot about me) but I didn't die when using the action which would imply to me that the script isn't working at all.

Aha, I just had an idea to put the hint at the first line of the script (instead of just after the _laptop _caller _id part) and then it DID show up, that would mean the script is falling over somewhere in the first 3 lines wouldn't it? If I'm reading it right, _laptop would be a variable that gets the object name of whatever the addaction is pointing to, similarly with _caller, is that correct? Based on my relatively limited programming experience I'd guess that those variables aren't being populated correctly, in the actionID part, I removed what looked like an extraneous " after the 1.5, was there perhaps one missing rather than one too many?

HOLY CRAP! I just noticed the lack of semicolons after the first 3 lines and thought it was the last piece of the puzzle but sadly not, the hint now works after the first 3 lines so it's not bombing out but its still not playing the animation on the player. Then just to test if it was at least setting the variable, I set up a trigger to fire with a hint if it did and that worked, then the rest of the script seemed to work exactly as I want.

No idea why but I'll take it, thank you, you're a Pac Prince among Pac Men!

Edited by Alias001

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  

×