Forum Jump :

Author Message


Posts: 7
Rank:


Level: Member

Country: hu
Location: Szeged
Occupation: student
Age: 28
In-game name:

 
#1 Posted at 2011-02-19 23:32        
     
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:

action.sqs
_newact1 = player addAction ["Attach T-90","attach.sqs"];


attach.sqs
_rope = "eslinga" createVehicle [0,0,0];
_rope attachTo [chopper, [0,1,-4]];

_tank = "t90" createVehicle [0,0,0];
_tank attachTo [_rope,[0,1,-2.3]];
player removeAction 0
player exec "action2.sqs";


action2.sqs
_newact2 = player addAction ["Detach T-90","detach.sqs"]


detach.sqs
detach _tank;
detach _rope;
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.

Thanks in advance


Author Message

palyarmerc  

I live inside the editor


Posts: 753
Rank:


Level: Member

Country: uk
Location:
Occupation: *Retired from ArmA*
Age:
In-game name: Paly

 
#2 Posted at 2011-02-20 11:41        
     
Remember forum titles should reflect content 'attach rope script problem' would have been better

Instead of detach, just deleteVehicle _rope
Instead of removeaction 0 it really should be removeaction _newact2

Otherwise, that's pretty much how I'd have scripted it (or grabbed a better working script from a fast-rope script) 8-)

....that's all folks....!

Advertisement


Author Message


Posts: 7
Rank:


Level: Member

Country: hu
Location: Szeged
Occupation: student
Age: 28
In-game name:

 
#3 Posted at 2011-02-20 13:47        
     
Thanks for replying.

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.

Thanks again and in advance.


Author Message

palyarmerc  

I live inside the editor


Posts: 753
Rank:


Level: Member

Country: uk
Location:
Occupation: *Retired from ArmA*
Age:
In-game name: Paly

 
#4 Posted at 2011-02-21 16:20        
     
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

....that's all folks....!

Author Message


Posts: 7
Rank:


Level: Member

Country: hu
Location: Szeged
Occupation: student
Age: 28
In-game name:

 
#5 Posted at 2011-02-25 15:09        
     
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?

Thanks again