Jump to content
Sign in to follow this  
konyo

Dropping off a tank once waypoint reached?

Recommended Posts

Hi all. Kind of new to all this scripting stuff with waypoints and etc, so im wondering can anyone help me?

What im looking for is that im making a little something for the chinook i helped Smiley make. Ive got a rope attached to the belly of the Chinook, with a tank on the bottom of that piece of rope. And im wondering how can i get the player in the tank to de-attach him self from the rope and drive off once the waypoint has been reached? And once the tank has been dropped off. I want the chinook pilot, if possible, to drop the rope after?

Anyone know how to do this?

Thanks

konyo

Share this post


Link to post
Share on other sites

Through the power of scripting!

Without knowing exactly how the rope works, not sure we can tell you exactly, an example mission would be helpful, but assuming you're using attachTo follow up by using detach command to release the tank.

Probably use a trigger or waypoint to call a script to do all that. Or better yet if it's players, you can use an action on the helotank to begin the release process. Might build in safety checks (even on the condition of the action) to check that it's close to the ground and the helo isn't moving too fast. You'd probably add this action when it gets hooked up.

Edited by kylania

Share this post


Link to post
Share on other sites
Through the power of scripting!

Without knowing exactly how the rope works, not sure we can tell you exactly, an example mission would be helpful, but assuming you're using attachTo follow up by using detach command to release the tank.

Probably use a trigger or waypoint to call a script to do all that. Or better yet if it's players, you can use an action on the helo to begin the release process.

Ermmm.. I could send people an example mission if they like.. Its just a normal rope of norrin's from his fast rope addon. And its attached to the heli by the 'attachto' command.

What so when i get to the way point. I put a detach command on it to release it. How would i create a script for all this tho? Should i try making a 'sqf' file inside the mission file? Have no idea how they work tho lol :confused:

Share this post


Link to post
Share on other sites

Anyone know how i can work a script for the addon? Or if anyone knows to to make one?

Share this post


Link to post
Share on other sites

If you want the tank player to detach himself, add an action. (You can put this in the init field, trigger, wherever).

[i]tankName[/i] addAction ["Detach", "detach.sqf"];

detach.sqf

_tank = _this select 0;
_id = _this select 2;

detach _tank;
_tank removeAction _id;

sleep 2;

detach [i]ropeName[/i];

If you attached the rope to the chopper, and the tank to the rope, this might work (at least in my head it does). That'll give the player in the tank the action to detach from the rope, remove the action once it's used, and then 2 seconds later the chopper will detach the rope from itself.

Like kylania said it would probably be good to put some safety checks in. Also I'm not sure about what you're doing with the chopper after the tank is dropped off, if it goes straight or not. Because if you're using waypoints, he'll leave, sure, but since its up to the player he might never disconnect lol.

Two ways of doing this:

1) Set the chopper along waypoints, and allow the player to disconnect manually, but if he doesn't do it by a certain waypoint, force it (so the chopper doesnt take him back out to sea or whatever).

2) Script it so that the chopper only starts heading back toward another position once the player has detached himself.

Useful links:

http://community.bistudio.com/wiki/addAction

Share this post


Link to post
Share on other sites

Okay thanks JDog. Such good help as allways :)

Ill give it a shot soon, ill let you know how its goes.

Share this post


Link to post
Share on other sites

Sorry for double post again :j:

Ive just tryed it, and its work perject :)

But, i just have 3 more things to ask.. :bored:

1. When im in the tank, the tracks and the engine still run as if it was still on the floor? And when i press engine off, it dosnt do anything. How can i get this to stop until its been droped off?

2. And at the start, how can i get the helicopter to attach to the tank, instead of it being attached to it straight away, like a MP addon sort of thing. So the tank driver attaches to the chinook when he wants

3. Last, and not least. How do i all put this into the chinook pbo for a proper addon release, because thats what im planning

Again... Sorry to be a right pain, but this is my 1st addon im making, and i wanna make sure it works all for the release lol

Share this post


Link to post
Share on other sites

Ah upgrading the addon, I see. Yea you don't want to use waypoints and triggers if you're doing that, since those are mission-specific. I'm not entirely sure how to include added actions into it, or how scripts in the addons folder work (I guess they just start to run once the addon loads? idk if it needs an init or not). There is a addon that adds actions to the c130 so you can open its doors and the osprey so you can pack its wings, might wanna rip that open and see how the scripts are organized. I'm not home now or else I would.

But yea... easiest way is just add actions, since you're making it as an MP version and both chopper/tank will be player-controlled. Also... you can only really easily influence/add the actions to the chinook. Adding an action to the tank would require writing a script that finds the closest tank within a given distance and saves that unit into a variable you can work with, since you can't know the name of every tank this will be used on.

Like I said I don't know how to add an action to a specific class (the addon), so check how other mods have done it. I'll try to be a little more helpful later when I'm home lol.

Oh yea and for the tank treads moving issue... perhaps if you can find the animation names you can temporarily set it to a static one while its attached.

Share this post


Link to post
Share on other sites
Ah upgrading the addon, I see. Yea you don't want to use waypoints and triggers if you're doing that, since those are mission-specific. I'm not entirely sure how to include added actions into it, or how scripts in the addons folder work (I guess they just start to run once the addon loads? idk if it needs an init or not). There is a addon that adds actions to the c130 so you can open its doors and the osprey so you can pack its wings, might wanna rip that open and see how the scripts are organized. I'm not home now or else I would.

But yea... easiest way is just add actions, since you're making it as an MP version and both chopper/tank will be player-controlled. Also... you can only really easily influence/add the actions to the chinook. Adding an action to the tank would require writing a script that finds the closest tank within a given distance and saves that unit into a variable you can work with, since you can't know the name of every tank this will be used on.

Like I said I don't know how to add an action to a specific class (the addon), so check how other mods have done it. I'll try to be a little more helpful later when I'm home lol.

Oh yea and for the tank treads moving issue... perhaps if you can find the animation names you can temporarily set it to a static one while its attached.

Okay thanks, ill have to unpbo one of the BIS tank files then to find the animation names :confused:

And yeah, ive looked in the black hawk addon which was released about a weekago, and its got a folder in it called scripts, with all the sqf files in it, so ill guess ill work from there, put them in the Chinook pbo, and try writing some scripts for it lol.

Also, ive got GLT Myke's Chinook Hatch Door for my addon, but i cant open Smileys chinook in O2, because its Binarized? How can i add the hatch door another way?

Edited by konyo

Share this post


Link to post
Share on other sites

1) I think kegetys' "unRap" tool will un-binarize files.

2) Just looked through the chinook's pbo, the config.cpp defines some rope models too that you might be able to use. If you use norrin's, be sure you include that file in your addon as well, since people will need it.

3) For adding the actions... you may have already seen, but I just realized you can add them in the UserActions class of the config file, right beside LAOpenRear and CloseRear. That will work for chinook actions, anyway. Adding an action to the nearest tank will still take a script probably.

Send me what you've got so far sometime, wouldn't mind seeing how you're doing it and maybe helping some more if I get around to it.

Share this post


Link to post
Share on other sites
1) I think kegetys' "unRap" tool will un-binarize files.

2) Just looked through the chinook's pbo, the config.cpp defines some rope models too that you might be able to use. If you use norrin's, be sure you include that file in your addon as well, since people will need it.

3) For adding the actions... you may have already seen, but I just realized you can add them in the UserActions class of the config file, right beside LAOpenRear and CloseRear. That will work for chinook actions, anyway. Adding an action to the nearest tank will still take a script probably.

Send me what you've got so far sometime, wouldn't mind seeing how you're doing it and maybe helping some more if I get around to it.

Just tryed kegetys' "unRap" tool, it dosnt un-binarize .p3d files :( So ive sent a message to Smiley, and im just waiting him to send me a un-binarize .p3d :)

Okay, ill look throught the rope bit at the bottom, but i remember talking to Smiley about that, and he said he couldnt use it because it was missing some files, but ill give it a test shot anyway, see how its goes.

And yeah, im ill have to make a sqf file for that script, and link it to that user action, but struggling how to write the script at the moment :confused:

Ill send a test mission to your gmail account tomorrow, then you can see how im using the ropes :)

Share this post


Link to post
Share on other sites

Okay, ill look throught the rope bit at the bottom, but i remember talking to Smiley about that, and he said he couldnt use it because it was missing some files

Ok just pointing it out in case you didn't notice it :)

Also,not sure which you're talking about but you don't have to make a UserAction class for the tank action, that'll be done entirely through a script. When you send it to me later I can have a look see at what you've done and maybe try making a script for it, cuz I've never used isKindOf before, could use some practice.

Share this post


Link to post
Share on other sites
Ok just pointing it out in case you didn't notice it :)

Also,not sure which you're talking about but you don't have to make a UserAction class for the tank action, that'll be done entirely through a script. When you send it to me later I can have a look see at what you've done and maybe try making a script for it, cuz I've never used isKindOf before, could use some practice.

Ok np :) So i wont have to make a user action, that action will pop up in the cockpit through the script then?

Yeah thanks, if you could try having a go, that would be great :) Ill try give it a shot myself too though.

Also, just to update, ive just opened an old un-binrized .p3d file of Smileys Chinook, which was when we was building it for a re-release, and its has got the Belly Hatch door for it. But when im adding GLT's Mykes Chinook belly hatch into the config, it dosnt seem to want to open :/ So im working on trying to get that fixed at the moment, if i cant get it fixed before the scripting is ready, the hatch door will be released in a later version :(

Share this post


Link to post
Share on other sites
Ok np :) So i wont have to make a user action, that action will pop up in the cockpit through the script then?

For the tank, yea. In the config file you can only add actions to the chinook. Well, you COULD edit and add actions to all the tanks too I suppose. There are different ways of doing what you're trying to do. Best way for chopper is to add actions in the config.

For tanks, you could call up their base class and define a new UserAction class, but I think it would work best as adding it through a script.

Share this post


Link to post
Share on other sites
For the tank, yea. In the config file you can only add actions to the chinook. Well, you COULD edit and add actions to all the tanks too I suppose. There are different ways of doing what you're trying to do. Best way for chopper is to add actions in the config.

For tanks, you could call up their base class and define a new UserAction class, but I think it would work best as adding it through a script.

Yeah, ill add a couple of actions to the Chinook too so it be easier to handle, and yeah. I totally agree with you on that one, run smoother on a script. Instead of it being on the helicopter

EDIT - @JDog, ive sent you the sample mission :)

Edited by konyo

Share this post


Link to post
Share on other sites

Lol... just started up the mission. First things right off the bat...

1) LOCK the tank so stupid people like me don't eject out of it while its flying off the ground at 80kph.

2) Use deleteVehicle to get rid of the rope after you detach it... cuz at least for me its kinda just sticking around erect in front of where it detaches.

Share this post


Link to post
Share on other sites

Well good news and bad news.

Good:

I decided to do this for ya after all. Here's what I got working:

  • Chopper pilot has action to lower rope
  • When rope is out, any vehicle that's a descendant of LandVehicle gets an action "Attach to Chinook". The closest vehicle gets the action/opportunity, when right under the rope
  • Once attached, both tank crew and chopper have ability to detach. Either doing so resets the whole system nicely and rope can be lowered again

Bad:

  • For some reason the addAction that allows the tank to connect once near the rope never appears, otherwise should still work fine

If anyone else is paying attention to this thread and has any suggestions, this is the block of code in question that works in SP but is not firing in MP:

while{tankLiftEnable == 1} do{
_tank = position _chopper nearestObject "LandVehicle";
if(_tank distance _rope < 21) then{
	_attach = _tank addAction ["Attach to Chinook", "attach.sqf", _rope, 1, false, true, "", "true"];

	waitUntil{_tank distance _rope > 21 || tankLiftEnable == 0};
	_tank removeAction _attach;
};
};

Share this post


Link to post
Share on other sites
Well good news and bad news.

Good:

I decided to do this for ya after all. Here's what I got working:

  • Chopper pilot has action to lower rope
  • When rope is out, any vehicle that's a descendant of LandVehicle gets an action "Attach to Chinook". The closest vehicle gets the action/opportunity, when right under the rope
  • Once attached, both tank crew and chopper have ability to detach. Either doing so resets the whole system nicely and rope can be lowered again

Bad:

  • For some reason the addAction that allows the tank to connect once near the rope never appears, otherwise should still work fine

If anyone else is paying attention to this thread and has any suggestions, this is the block of code in question that works in SP but is not firing in MP:

while{tankLiftEnable == 1} do{
_tank = position _chopper nearestObject "LandVehicle";
if(_tank distance _rope < 21) then{
	_attach = _tank addAction ["Attach to Chinook", "attach.sqf", _rope, 1, false, true, "", "true"];

	waitUntil{_tank distance _rope > 21 || tankLiftEnable == 0};
	_tank removeAction _attach;
};
};

Thank you so much JDog. Your a big help :)

Ill go try that out now, and then it looks like it could be ready for release :)

And that code, dose it go in a sqf? or in an init box of the Chinook? :confused:

Share this post


Link to post
Share on other sites

Lol, that's just part of 1 of 4 scripts :P I'll send you a mission with it all so you can see how it works, but it won't work in MP which is what you're aiming for.

EDIT: sent

Edited by JDog

Share this post


Link to post
Share on other sites
Lol, that's just part of 1 of 4 scripts :P I'll send you a mission with it all so you can see how it works, but it won't work in MP which is what you're aiming for.

EDIT: sent

Hmmm... Ohh thats a let down.. Maybe i could add some more improvments to it in the future to get it to work in multiplayer, when i know a little bit more about modding :)

Okay thanks mate, ill go and fetch that now :)

EDIT : Just tryed the test mission :) Works great, but i couldnt get a couple of things figured out :confused:

Check your email

Edited by konyo

Share this post


Link to post
Share on other sites

Dose anyone know how to get the attach option to come up on multiplayer? :confused:

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  

×