Jump to content

Photo
- - - - -

Rope attachment scripting basics


  • Please log in to reply
36 replies to this topic

#1 MadDogX

MadDogX

    Mindless F@nb0!

  • Moderators
  • 9049 posts

Posted 26 October 2011 - 06:46 PM

Hello,

I've been looking into creating some simple missions using the new rope attachment feature, but I found the state of the TakOH script command list on the community wiki to be rather lacking in real information.

Therefore I've started to gather some basic info about the rope scripting commands and am adding all info to the wiki. In addition, I am updating this post with explanations and usage examples for all rope-relevant commands. :)

______________________________________

ropeCreate

To create a simple rope between two objects, use the ropeCreate command:

Description:
Spoiler

Simple usage example:
Spoiler

______________________________________

ropeSetCargoMass

After creating a basic rope, the cargo object doesn't seem to weigh down the helicopter at all. In order to do this, you need to add weight to it yourself using the ropeSetCargoMass command:

Description:
Spoiler

Simple usage example:
Spoiler

______________________________________

ropeDetach

Use this to detach a rope from a cargo object while leaving the rope dangling from the helicopter. (Presumably allowing it to be re-used later.)

Description:
Spoiler

Simple usage example:
Spoiler

______________________________________

ropeDestroy

Unlike the detach command, this command will destroy the rope completely.

Description:
Spoiler

Simple usage example:
Spoiler



And here are the RopeAttachTo and RopeCut commands, supplied by Blakeace. :)

Here is how I believe objects can be atached to ropes.

RopeAttachto

To attach created rope to an object, use the ropeAttachto command:

Description:

Spoiler

Simple usage example:
Spoiler


Below place in an initialization field of a helicopter place an object nearby named mycargo.
Will create a rope which will unroll out of the helicopter, then after ten seconds will attach to the object mycargo.
Spoiler

Spoiler




RopeCut

To cut a rope, use the ropeCut command:

Description:
Spoiler

Simple usage example:
Spoiler


Note these are just the aspects I have gotten to work. Other syntax options may be possible.

.

Edited by MadDogX, 07 November 2011 - 07:04 PM.


Gigabyte Z97-HD3 Motherboard | Intel Core i5 4690k @ 4.5GHz | NVidia GTX 970
16GB G-Skill Ripjaws 2133MHz RAM | Kingston HyperX SSD | be Quiet! 750W PSU

#2 soldier2390

soldier2390

    First Sergeant

  • Members
  • 916 posts

Posted 26 October 2011 - 09:36 PM

Nice, and thanks! but can you upload a demo mission?
"Respect is the key to life... with out it we have nothing!"

Computer Specs:
=============
Dell Studio XPS 8000
Windows 7 Home Premium, 64-bit
Intel® Core™ i7 CPU - 860 @2.80GHz 2.79 GHz
Nvidia Geforce GTX 460
DirectX® Version 11.0

#3 .kju -PvPscene-

.kju -PvPscene-

    Brigadier General

  • Members
  • 12275 posts

Posted 27 October 2011 - 05:11 AM

nil = ropeSetCargoMass [RopeObject, CargoObject, Mass] 


Nooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
nooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo

http://dev-heaven.ne.../wiki/Nil_Check

Correct:

nul = ropeSetCargoMass [RopeObject, CargoObject, Mass]
_nul = ropeSetCargoMass [RopeObject, CargoObject, Mass]
0 = ropeSetCargoMass [RopeObject, CargoObject, Mass]



Current active projects: None :(

Maintained/assisted projects: IFA3, Blitzkrieg


Help: Got a crash? Report it! What is the RPT log file?


#4 MadDogX

MadDogX

    Mindless F@nb0!

  • Moderators
  • 9049 posts

Posted 27 October 2011 - 05:33 AM

*big no*

http://dev-heaven.ne.../wiki/Nil_Check

I can't access dev-heaven at the moment (filter), but I'm guessing "nil = ..." is wrong for some reason. Corrected. :)


Nice, and thanks! but can you upload a demo mission?

I plan to. At the moment I'm just collecting notes and waiting for kju to correct my shit. ;)


Btw. I did some more experiments last night:

  • Attaching multiple ropes between the same chopper and cargo object doesn't seem to work properly. I tried with two, but only one of them was attached to the cargo, the other just dangled around uselessly. Would have been cool to have one rope attached to each corner of a crate, for example.

  • Chaining ropes from a chopper to multiple cargo objects (Heli ---> cargo ---> cargo) doesn't seem to work either.

Edited by MadDogX, 27 October 2011 - 06:35 AM.


Gigabyte Z97-HD3 Motherboard | Intel Core i5 4690k @ 4.5GHz | NVidia GTX 970
16GB G-Skill Ripjaws 2133MHz RAM | Kingston HyperX SSD | be Quiet! 750W PSU

#5 dale0404

dale0404

    Warrant Officer

  • Members
  • 2471 posts

Posted 27 October 2011 - 06:16 AM

(For some reason this command seems to have a return value, so I had to write "0 = ..." to make it work in a trigger.)


MDX, why use a trigger? Would it not be better in a small script and call it from the object itself?
Posted Image

#6 MadDogX

MadDogX

    Mindless F@nb0!

  • Moderators
  • 9049 posts

Posted 27 October 2011 - 06:28 AM

MDX, why use a trigger? Would it not be better in a small script and call it from the object itself?

I prefer scripts over triggers aswell, but right now the intent of this thread is to show the most basic way to get ropes working, so that even a noob can understand it.

I will certainly add examples using SQF scripts later on though. :)

Gigabyte Z97-HD3 Motherboard | Intel Core i5 4690k @ 4.5GHz | NVidia GTX 970
16GB G-Skill Ripjaws 2133MHz RAM | Kingston HyperX SSD | be Quiet! 750W PSU

#7 Sickboy

Sickboy

    Colonel

  • Members
  • 9946 posts

Posted 27 October 2011 - 06:51 AM

Thanks for sharing MDX :)

Here's the quote of what's on the page linked by PvPScene:

Some missions/addons break the workings of many scripted systems, by overriding the system variable 'nil'.
Usually it is noticeable by strange errors and problems, making you chase your tail why things act 'odd'.
In CBA you get an RPT error and hintbox warning you about the fact that the nil variable is overriden.
It is important to find the nil = definition in the mission or used addons, and remove it (replace nil = with e.g dummy =).



#8 MadDogX

MadDogX

    Mindless F@nb0!

  • Moderators
  • 9049 posts

Posted 27 October 2011 - 07:14 AM

Thanks Sickboy. :)

That explains kju's dramatic response, and I've learned a new "best practice". It's been a while since I've done any real Arma scripting, so that's my excuse. :D

Gigabyte Z97-HD3 Motherboard | Intel Core i5 4690k @ 4.5GHz | NVidia GTX 970
16GB G-Skill Ripjaws 2133MHz RAM | Kingston HyperX SSD | be Quiet! 750W PSU

#9 Mr. Charles

Mr. Charles

    Sergeant Major

  • Members
  • 1837 posts

Posted 27 October 2011 - 07:52 PM

:Oo: I've seen some strange things happen over South East Asia..

Posted Image
Posted Image

#10 -DirTyDeeDs--Ziggy-

-DirTyDeeDs--Ziggy-

    Sergeant Major

  • Members
  • 1854 posts

Posted 27 October 2011 - 08:56 PM

heheheh :rolleyes:

what kinda weight did you add, if any?
Posted Image

#11 Mr. Charles

Mr. Charles

    Sergeant Major

  • Members
  • 1837 posts

Posted 27 October 2011 - 10:33 PM

200 and 300 for the other one. The ropes snap pretty fast, if you add too much.
Posted Image

#12 MadDogX

MadDogX

    Mindless F@nb0!

  • Moderators
  • 9049 posts

Posted 28 October 2011 - 05:44 AM

Yeah, I tried lifting a crate with 10.500 weight yesterday... no dice, even with the heavy civilian chopper. :D

Gigabyte Z97-HD3 Motherboard | Intel Core i5 4690k @ 4.5GHz | NVidia GTX 970
16GB G-Skill Ripjaws 2133MHz RAM | Kingston HyperX SSD | be Quiet! 750W PSU

#13 MadDogX

MadDogX

    Mindless F@nb0!

  • Moderators
  • 9049 posts

Posted 28 October 2011 - 09:54 AM

Update:

  • I've begun adding proper scripting command articles to the community wiki. (See ropeCreate and ropeSetCargoMass)
  • Added simple usage examples to the first post.


Gigabyte Z97-HD3 Motherboard | Intel Core i5 4690k @ 4.5GHz | NVidia GTX 970
16GB G-Skill Ripjaws 2133MHz RAM | Kingston HyperX SSD | be Quiet! 750W PSU

#14 Sealife

Sealife

    Banned

  • Banned
  • 1362 posts

Posted 28 October 2011 - 03:53 PM

Out of curiosity ,are the parameters variedvenough to try on a vehicle ,specifically small rope to tow something ,I was thinking articulating vehicles specifically ?

#15 scarp

scarp

    Lance Corporal

  • Members
  • 53 posts

Posted 28 October 2011 - 04:40 PM

Cool, but Maddog, how do you release the cargo again? Do yo need to set up triggers for that as well? If so, could you give an example (using your previous example as basis)?

As mentioned earlier in this thread, calling scripts from objects themselves, would that mean that you could i.e place out different objects in different locations and that all players in a MP session could lift and drop the cargo wherevertheysoplease (restricted only by cargo mass vs helicopter performance)?

#16 MadDogX

MadDogX

    Mindless F@nb0!

  • Moderators
  • 9049 posts

Posted 28 October 2011 - 06:45 PM

Out of curiosity ,are the parameters variedvenough to try on a vehicle ,specifically small rope to tow something ,I was thinking articulating vehicles specifically ?

I've done some testing with an SUV, trying to tow another vehicle, but it currently doesn't seem to work very well. Perhaps the attachment positions need to be tweaked or something, but at the moment it seems like attached objects will prefer to fall sideways instead of turning in the direction of the towing vehicle. However I am fairly sure that my rope attachment positions were less than ideal.

Cool, but Maddog, how do you release the cargo again? Do yo need to set up triggers for that as well? If so, could you give an example (using your previous example as basis)?

Done. See first post. :)

It isn't absolutely necessary to use triggers btw. I'm only using them in the examples because it is the easiest way for newcomers to understand the commands. Anyone who has learned how to write and use scripts should be able to use these commands inside them.

As mentioned earlier in this thread, calling scripts from objects themselves, would that mean that you could i.e place out different objects in different locations and that all players in a MP session could lift and drop the cargo wherevertheysoplease (restricted only by cargo mass vs helicopter performance)?

Certainly - pretty much any conceivable scenario should be possible. You could have any number of transportable objects lying around in a map, waiting to be transported somewhere else.

Edited by MadDogX, 28 October 2011 - 07:08 PM.


Gigabyte Z97-HD3 Motherboard | Intel Core i5 4690k @ 4.5GHz | NVidia GTX 970
16GB G-Skill Ripjaws 2133MHz RAM | Kingston HyperX SSD | be Quiet! 750W PSU

#17 scarp

scarp

    Lance Corporal

  • Members
  • 53 posts

Posted 28 October 2011 - 09:13 PM

Thanks Maddog, works perfectly. Now I just need to investimegate how this thing with the objects calling scripts themselves and how it works :)

#18 jcgam

jcgam

    Lance Corporal

  • Members
  • 56 posts

Posted 31 October 2011 - 04:50 AM

Great information thanks! Is it possible to use a joystick button to release the cargo?

---------- Post added at 09:50 PM ---------- Previous post was at 08:33 PM ----------

I need to use the inputAction command I think. As a test I added this script to initialization for the helicopter:

while{true}do{ if(inputAction "fire" != 0)then{hint "text"}; };

I'm planning to replace the hint with a ropeDetach command. In the chopper I press fire but I don't get any text. What am I doing wrong?

Edited by jcgam, 31 October 2011 - 03:51 AM.


#19 Moricky

Moricky

    Karel Mořický

  • BI Developer
  • 817 posts

Posted 31 October 2011 - 07:36 AM

You might also be interested in Custom Waypoints:

Posted Image

#20 Manzilla

Manzilla

    First Lieutenant

  • Members
  • 5142 posts

Posted 31 October 2011 - 02:25 PM

MadDogX,

Thank you for looking into this. Damn am I glad guys like you, SickBoy, Memphisbelle, etc. picked up this game. Good to have that support.
:coop: :yay::yay::yay: (God damn bananas..... again)

Join the most rootin', tootin'est crew on these here forums! That's right folks we're darn tootin'.

Mike Tyson's ode to Manzilla's SP playing style:

My style is impetuous. My defense is impregnable and I'm just ferocious.... I want your heart, I want to eat his children! Praise be to Allah!



1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users