Jump to content

Placing C-4 in a map


RavenousNC
 Share

Recommended Posts

I’ve been asked about the placing of C-4 and how I got it to work. I’ll try my best to explain it, but some may find this repetitive since it was covered by Wolfsong at one point. It was his instruction that got me started. From there it was a lot of trial and error. But as you can see by The Island 2, it is possible.

The C-4 prop elements are named c4_aa1, c4_aa2, c4_aa3, c4_gasstation and a couple of others. The key to these are the text after the underscore. (c4_aa2)

So when I placed a C-4 prop I gave it the same name just keep things simple. Here is how it would look in the world file.

<unit name="c4_aa2" unit_id="191" name_id="c4_aa2" cover_off="false">
It’s nothing fancy here, but a real example from The Island 2. Also placed on the map are the vehicles and cisterns I add for bigger explosions. I place the cisterns right under the vehicles. The concussion of the blast sets these off causing a bigger and better explosion that should throw the vehicles high or out of the way... most of the time. You need to set these so people can not blow them up. To do this I place code like this in the first event named “start_gameâ€.
<event name="start_game">

	<element type="SetIndestructable" name_id="castle_cist" start_time="1"/>

	<element type="SetIndestructable" name_id="center_cist1" start_time="2"/>

	<element type="SetIndestructable" name_id="center_cist2" start_time="3"/>

	<element type="SetIndestructable" name_id="bridge1_cist1" start_time="4"/>

	<element type="SetIndestructable" name_id="bridge1_cist2" start_time="5"/>

	<element type="SetIndestructable" name_id="bridge2_cist1" start_time="6"/>

	<element type="SetIndestructable" name_id="bridge2_cist2" start_time="7"/>


	<element type="SetIndestructable" name_id="castle_v" start_time="1"/>

	<element type="SetIndestructable" name_id="center_v1" start_time="2"/>

	<element type="SetIndestructable" name_id="center_v2" start_time="3"/>

	<element type="SetIndestructable" name_id="bridge1_pan1" start_time="4"/>

	<element type="SetIndestructable" name_id="bridge1_pan2" start_time="5"/>

	<element type="SetIndestructable" name_id="bridge2_pan1" start_time="6"/>

	<element type="SetIndestructable" name_id="bridge2_pan2" start_time="7"/>
Now these things can not be destroyed until an event that sets them back is called. First I enabled the C-4 using this element tag
<event name="area6">			

<element type="EnableUnit" name_id="c4_aa2" start_time="3.0"/>
The name_id is the name I gave the C-4 when I placed it. Again, here’s an example of both. World File
<unit name="c4_aa2" unit_id="191" name_id="c4_aa2" cover_off="false">
the island 2.xml
<element type="EnableUnit" name_id="c4_aa2" start_time="3.0"/>
Now that the C-4 is enabled the orange placeholder will be present on the map. All that is left is to go up to the placeholder and press X when the screen prompts. It takes 14 seconds for the C-4 to blowup. During this time is when I set all the items for that back to normal using SetSlot and setting them to 16 so they can be destroyed.
<event name="aa2_trigger">

	<element type="SetSlot" name_id="bridge2_pan1" slot="16" start_time="13.0"/>

	<element type="SetSlot" name_id="bridge2_pan2" slot="16" start_time="13.0"/>

	<element type="SetSlot" name_id="bridge2_cist1" slot="16" start_time="13.0"/>

	<element type="SetSlot" name_id="bridge2_cist2" slot="16" start_time="13.0"/>

	<element type="DisableUnit" name_id="c4_aa2" start_time="16.0"/>

</event>
OK, now I’ll explain this per tag. Remember how I said the key to these are the text after the underscore? (c4_aa2) This must be named as such
<event name="aa2_trigger">
Now this can be very confusing because up to this point you never made the event like you normally would like so
<user name="bombArea1" type="once">

	<trigger type="UnitInArea" area="bombArea"/>

	<event name="bombArea"/>

</user>
That’s because once you have enabled the prop the game creates this event for you, but only if you use the naming convention it demands that you use. The last portion of the prop name after the underscore (aa2) and “_triggerâ€, thus you have aa2_trigger. (<event name=aa2_trigger">) This will allow the placement of the C-4 in the orange placeholder. Remember also that I said that after placing the C-4 that it takes 14 seconds for it to blow up. Knowing this I set the element tags that use SetSlot to allow destruction of each item in 13 seconds from when the user pressed X. One second before the C-4 blows the vehicle and cisterns are ready to become part of the fireworks. The last item in the list is to disable the placeholder. Doing this makes it go away, although I have seen it go away before without using it. Nonetheless, I suggest using it just to be safe. That’s all there is to it. It might make even more sense now if you looked at the mission file from The Island 2. Here are the parts from the code. I hope this has helped. Rav :zorro:World
<unit name="c4_aa2" unit_id="191" name_id="c4_aa2" cover_off="false">

	<position pos_x="-3678" pos_y="8490" pos_z="0"/>

	<rotation yaw="0" pitch="0" roll="90.002617"/>

</unit>
the island 2.xml
<event name="start_game">

	<element type="SetIndestructable" name_id="castle_cist" start_time="1"/>

	<element type="SetIndestructable" name_id="center_cist1" start_time="2"/>

	<element type="SetIndestructable" name_id="center_cist2" start_time="3"/>

	<element type="SetIndestructable" name_id="bridge1_cist1" start_time="4"/>

	<element type="SetIndestructable" name_id="bridge1_cist2" start_time="5"/>

	<element type="SetIndestructable" name_id="bridge2_cist1" start_time="6"/>

	<element type="SetIndestructable" name_id="bridge2_cist2" start_time="7"/>


	<element type="SetIndestructable" name_id="castle_v" start_time="1"/>

	<element type="SetIndestructable" name_id="center_v1" start_time="2"/>

	<element type="SetIndestructable" name_id="center_v2" start_time="3"/>

	<element type="SetIndestructable" name_id="bridge1_pan1" start_time="4"/>

	<element type="SetIndestructable" name_id="bridge1_pan2" start_time="5"/>

	<element type="SetIndestructable" name_id="bridge2_pan1" start_time="6"/>

	<element type="SetIndestructable" name_id="bridge2_pan2" start_time="7"/>

……………

</event>



<event name="area6">			

	<element type="EnableUnit" name_id="c4_aa2" start_time="3.0"/>

………….

</event>



<event name="aa2_trigger">

	<element type="SetSlot" name_id="bridge2_pan1" slot="16" start_time="13.0"/>

	<element type="SetSlot" name_id="bridge2_pan2" slot="16" start_time="13.0"/>

	<element type="SetSlot" name_id="bridge2_cist1" slot="16" start_time="13.0"/>

	<element type="SetSlot" name_id="bridge2_cist2" slot="16" start_time="13.0"/>

	<element type="DisableUnit" name_id="c4_aa2" start_time="16.0"/>

</event>

Edited by RavenousNC
Link to comment
Share on other sites

Thank you!!!

I tried on the first map I did to enable the C4, but it would only work on a non-dedicated server. It wanted to crash on a dedicated one. I thought I had done it the way you describe, but I probably overlooked something. I am at work now, but will definitely give it a shot when I get home.

Thanks again, Rav! It is greatly appreciated.

MeanOldMan

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...