You are not logged in.    Login    New User    Forum Home    Search

Location:
JBPLAY  \  Meteor 2  \  User Files  \  C4 Library

Back to Threads

Viewing Thread: C4 Library

 

arezey

Joined: 16 June 2005
Posts: 1599
30 August 2006 14:54 (UK time)

This is a small library for using C4, planting C4 and, most important, detonating C4 :D

To install this lib, copy the C4.lib file to your mod (or base) folder. Then, make sure you have the following files reachable by M2:
effects/lilboom01_07.pcx
hud/C4.pcx
buttons/help.pcx

lilboom01_07.pcx and C4.pcx can be found from the M2 base folder and the help.pcx comes with this.

Then, open the lib up with Notepad, Notepad2, Crimson Editor or any text editor and check the two variables. The item name is set to "C4" by default and the explosives object is "C4.ob" by default.

Then add the following line:
#include "MODFOLDER\C4.lib"

Then initialize it with the C4_Initialize() function. This function makes everything ready for you, so it's just plug, turn on and play! The file doesn't do it instantly, so you can use the library, for example when triggering a button.

Everything needed is attached into a zip file.
If you have any quesions, post away!

You need to login to create posts in this thread.

me_mantis

Joined: 26 September 2003
Posts: 1152
03 September 2006 16:57 (UK time)

Could you include an example map with this?

It looks interesting, but I'd like to see where it differs from my C4 script.

Does it work in mp?

You need to login to create posts in this thread.

arezey

Joined: 16 June 2005
Posts: 1599
03 September 2006 17:29 (UK time)

mp I don't know... I've never got a chance to try!

Well I can include a map if you want to :)

You need to login to create posts in this thread.

-eKo-

Joined: 02 September 2006
Posts: 3
04 September 2006 22:55 (UK time)

I'm confused. Where do I add the #include MODFOLDER\C4.lib part? Also the C4_Initialize().

You need to login to create posts in this thread.

mike323
Joined: 23 January 2005
Posts: 745
04 September 2006 23:24 (UK time)

#include ... goes on the top of any script.

C4_Initialize goes in the OnMapStart (I think).

You need to login to create posts in this thread.

arezey

Joined: 16 June 2005
Posts: 1599
05 September 2006 06:19 (UK time)

OK...

I found a critical bug in my script; I was also doing a function call outside a function, and I fixed it.
DO NOT USE THE SCRIPT ABOVE!!!!!

So:

#include "MODBASE\C4.lib"
goes just under #include meteor2

And yes, C4Toolbar_Initialize(); goes into OnMapStart(), if you want to activate it when the map starts. Really, you can create the toolbar for example when you click a switch, just get the C4Toolbar_Initialize(); function there.

I include here an example map so that you will see what is should look like.

You need to login to create posts in this thread.

-eKo-

Joined: 02 September 2006
Posts: 3
06 September 2006 17:35 (UK time)

I tried the example map, but when i go to plant it crashes Meteor. Although i dont think its just this, it crashes a few times in other situations too...

You need to login to create posts in this thread.

me_mantis

Joined: 26 September 2003
Posts: 1152
06 September 2006 18:51 (UK time)

I'm not sure that this will work in MP, because if some1 drops another C4, and another person detonates it, it would kill the person who dropped it.

I tried to work around this with my fusion Bomb stuff, but the only way to really keep players from detonating anyone elses c4 would be give them a number of a powerup that is equal to the ID of the C4 they last dropped. When they click detonate, it will explode that C4, and any C4 that were with it, and take away the powerup.

I might modify my RTSS scripting so you can detonate C4 remotely, when the next m2/3 patch comes out.

You need to login to create posts in this thread.

Erik

Joined: 16 August 2006
Posts: 424
15 September 2006 14:33 (UK time)

I can see that i have a "c4 item on the right side" but how do i use it?

You need to login to create posts in this thread.

arezey

Joined: 16 June 2005
Posts: 1599
15 September 2006 19:24 (UK time)

I figured out the crashing thing... it was those global variables again :(

Sadly in order to work with a mod, you need to have a C4 item and a C4.ob C4 file.

Well, it works now :)

SO: you just click on the C4 icon and it spawns a C4 object. Click on the detonate button and it detonates the C4 remotely. Note that it detonates only the last C4 planted, planting history is not saved (only the last). So if you plant a C4 and another somewhere else, the C4 first dropped doesn't get detonated. The help icon tells how many C4s you've got, good for mods that don't display the C4 amount :)

Edited: 15 September 2006 19:28


You need to login to create posts in this thread.



Forums system (C) 1999-2023 by James Bunting.

Terms of Use