Hi there, guys. I know that my scripting knowledge is right below anything you can name, that's why I started a little practice, running into problems all the time. I understand that everything I try to do could be done much more easily, still, please don't laugh.
So, I made 4 external scripts (yeah, I'm that dumb) which go like this:
_newact1 = player addAction ["Attach T-90","attach.sqs"];
_tank = "t90" createVehicle [0,0,0];
_tank attachTo [_rope,[0,1,-2.3]];
player removeAction 0
player exec "action2.sqs";
_newact2 = player addAction ["Detach T-90","detach.sqs"]
player removeAction 1
So much for the writing part.
Now the list of problems:
- I guess, the detach order doesn't work because the _tank and the _rope variables are unknown to it. Or does the script recognise objects from other scripts? Also, I am not sure about the order (detach object) itself. Is it correct that way?
- First time I tried to get the 'if' involved, like: if action fired then removeAction _newact1 and so on for the detachment. Instead of this, I put the removeAction into the script it executed. Still, it would be nice to learn how to use the 'if'.
- Also, I'm not really sure how it is working, but I reffered to the action's index (or whatever it is called) not its variable when I removed it. This solution (which I managed to copy out from a forum) was the only one working, though I'm not sure what the numbers 0 and 1 mean there.
All in all, I was proud to create a new action I could execute in the game and the T-90 looked great under a flying AH-6.
By the way, I must say thanks to the creators of the RAV_lifter addon. Their script served as a good base to learn a few things by myself and I'm still unable to figure out how to create a brand new interface in-game, like the one they put in.
But honestly, the rope came in handy.
Still, my problems remain the same and I would be grateful if anyone could help me out with solutions. As you can see, I am no expert, so go easy on me.
Deleting the rope would be fine, but I would like to keep the tank. Or should I delete it and make another one appear where it should be dropped?
Also, removeAction _newact2 didn't work for me. Don't really know why. Come to think of it, I have guess. What if it's not working because of what I mentioned earlier, the script not recognising variables from other scripts. It would be great if anyone could answer this one.
sure, just don't make it a _local variable
so, use newact2 = player addAction ["Attach T-90","attach.sqs"]; (no underscore)
deleting the rope deletes the vehicle? hmmm, curious - nut it out, it's worth it, you'll learn more that way
You have to scroll my signature, but there is a link to ARMA2 scripting reference, where you will find detach
OK, thanks for the ideas. Nearly everything seems to be work nicely.
Still, there's one last issue I can't figure out. Why can't I see the two actions when I'm in the chopper itself. Once I get out, the first action appears, but until then, nothing. Any ideas why?
Copyright (c) 2006 - 2020 Armaholic.com All Rights Reserved.
Armed Assault, ArmA: Combat Operations, ArmA: Queen's Gambit, Arma 2, Arma 2: Operation Arrowhead, Arma 2: Combined Operations, Arma 2: British Armed Forces, Arma 2: Private Military Company, Arma 2: Army of the Czech Republic, Arma 2: Reinforcements, Arma 2: Firing Range and Arma 3 are trademarks or registered trademarks of Bohemia Interactive a.s.