• New Horizons on Maelstrom
    Maelstrom New Horizons


    Visit our website www.piratehorizons.com to quickly find download links for the newest versions of our New Horizons mods Beyond New Horizons and Maelstrom New Horizons!

Grenades, flamethrowers, poisondarts, whatever...

CouchcaptainCharles

COO (Chief Oddity Officer)
Storm Modder
Pirate Legend
The Special Weapon Assembling Kit

Mods often tend to grow exuberantly like creeper plants in the jungle. One must be careful not to loose the way or get entangled, and somtimes one must draw the machete and hack a straight path free <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" />

Just that happened to the "Grenade" mod that I was working on. My devious imagination came up with lots of other special weapons with unique effects, and in the end i had the program messed up with lots of "`If-else`" statements for every weapon. It worked allright, but I want my mods to be simple examples that others can work with as well. So I made a clear cut and now i am about to make a " Special Weapon Assembling Kit" that allows everybody to assemble special weapons easily by combining features from a given set.

And before I finish that I would like to ask you what features YOU would like to have.


Right now the set of optional ! features includes:

Soundeffects
You can choose which sound your weapon will make when used, e.g. a roaring boom for explosives, firecrackling for combustibles, a stealthy hiss for a throwing knife etc.

Optical effects
Choose from the already existing effects (particles) of PotC: fireballs for grenades, fire and smoke for combustibles, spray or fog for a gasbomb...

Damage on several characters
Activate this and the weapon will not only hurt the initial targetperson but also people close to the initial target. For e.g. grenades or shotguns

Damage on yourself <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" />
You will get hurt as well if you are too close to the initial target (For grenades, gasbombs...)

Throwing weapon
Weapons that you throw, like grenades or throwing knifes, can of course be used only once. They will be unequiped and deleted from the inventory after use

Stealth weapon
If you use silent weapons, like throwing knifes, from a distance your victim will not realize who started the attack. So you may not meet any counterattack

Poison
will poison the victim (like a monkeybite). For e.g. gasbombs or poisoned knifes.


Apart from those new options you can also define the usual stats like model, picture, damagestats, price etc. The different combination of these options creates unique weapons. Here are a few examples of what you CAN assemble (not all should really be implemented <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" /> ) :

A Grenade is being made by combining:
ExplosionBOOMsound, fireball, a little scorching fire on the ground, high damage, to everyone nearby, including you, thrown away.

Blunderbuss
Boomsound, moderate damage, to everyone nearby

Poisoned throwing knife
Hissing sound, light damage, thrown away, stealthy, poisoning

Gasbomb
"Spray/ Bowwave" sound and graphic effect, light damage, to everyone nearby, including you, thrown away, poisoning.

"Hitman" pistol with silencer <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" />
Plop sound, stealthy

Flamethrower <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" /> <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" />
Firesound, fire and smoke, high damage, to everyone nearby.

Lasergun <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/icon_eek.gif" style="vertical-align:middle" emoid=":shock:" border="0" alt="icon_eek.gif" /> <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/rolleyes.gif" style="vertical-align:middle" emoid=":rolleyes:" border="0" alt="rolleyes.gif" /> <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/icon_mrgreen1.gif" style="vertical-align:middle" emoid=":cheeky" border="0" alt="icon_mrgreen1.gif" />
Teleportersound, "artifact" corona effect

Well, one must be careful not to become TOO unrealistic or cheating <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" />
 
The code to execute those optional features will all be in one file, and once it's finished I'll provide elaborate documentation so that every modder should be able to work with it (After all my intention is to convince you that modding is easy and that you can do it too <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/yes.gif" style="vertical-align:middle" emoid=":yes" border="0" alt="yes.gif" /> )

Anyone who wants to assemble his own special weapon can do that rather easily: they must only clone one weapondefinition in itemsinitItems.c and write in the features and effects they want, like this:

A blunderbuss requires only two new features/attributes:

// ccc Blunderbuss
makeref(itm,Items[n]);
itm.id = "pistolbbuss";
itm.multidmg = 1; // new attribute, does multiple damage
itm.sound = "OBJECTSSHIPCHARGEcannon_fire3.wav"; // soundfile played when used

.... other stats as usual

itm.rare = 0.37;
n++;


A grenade a few more:

// ccc Grenade
makeref(itm,Items[n]);
itm.id = "pistolgrenade";
itm.multidmg = 1; // new attribute, does multiple damage
itm.selfdmg = 1; // hurts user if used too close
itm.sound = "OBJECTSSHIPCHARGEcannon_fire3.wav"; // soundfile played when used
itm.effect1 = "blast"; // graphic effect, choose particlename from resourceiniparticles
itm.effect1.time = 2; // duration of this effect
itm.effect2 = "fort_fire"; // second graphic effect
itm.effect2.time = 20; // duration of this effect
itm.throw = 1; // new attribute, weapon that you throw, so only one time use
// NK -->
itm.skiptrade = true; // you can't buy them
.... other stats as usual
itm.rare = 0.9; // appearance in chests
n++;



Well, and of course you must add a text for the weapondescription to resourceinitextsenglishItemsDescribe. But IMHO anyone who can write a post on a forum should be able to mod on that level (Hope that doesn't sound arrogant. I mean it as encouragement <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> )

If you have any proposals for additional special weapon features please post them here and I'll TRY ! to include them before Xmas <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> (But no SciFi and cheats please <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/tongue.gif" style="vertical-align:middle" emoid=":blah:" border="0" alt="tongue.gif" /> )
 
Wow, CCC, that is pretty cool!!! <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/onya.gif" style="vertical-align:middle" emoid=":onya" border="0" alt="onya.gif" /> Wish I had time to fiddle with it! <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/keith.gif" style="vertical-align:middle" emoid=":keith" border="0" alt="keith.gif" />
 
We still need rifles...

Oh, hee hee hee, how about a gun with a scope, so you zoom in like with your telescope at sea and shoot someone from the far end of the screen?

I love the poison knife and throwing knives idea; I'd attempted the first one myself, lucklessly.

By the way, are blood effects possible? I noticed there's a small graphic somewhere for a splash of blood, so I bet it was an original feature that Disney killed.
 
<img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/unsure.gif" style="vertical-align:middle" emoid=":?" border="0" alt="unsure.gif" /> Do we have to have blood? <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/sick.gif" style="vertical-align:middle" emoid=":eww" border="0" alt="sick.gif" /> <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/laugh.gif" style="vertical-align:middle" emoid="xD:" border="0" alt="laugh.gif" />

I've wondered about that, myself. I suppose you can get it to work like the particles - lights and such...
 
Blood? `Egoshooter-splatter` BLOOD? Haven't found anything like that. I can serve only with smoke and fire. And something romantic: if you knock a character down by throwing a rock at him he will actually see the stars <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/icon_mrgreen1.gif" style="vertical-align:middle" emoid=":cheeky" border="0" alt="icon_mrgreen1.gif" />
 
<img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/w00t.gif" style="vertical-align:middle" emoid=":woot" border="0" alt="w00t.gif" /> Stars, ha! Reminds me of Roger Rabbit who had trouble calling up STARS when he was clunked on the head. Singing birds, he got... And other things - but never stars... LOL! <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/laugh.gif" style="vertical-align:middle" emoid="xD:" border="0" alt="laugh.gif" />

No really, Nathan was talking about a particles emitter - particles being able to be showered upon people like water splashing...

I think the emitter would be like when a ball strikes a ship, and men and cargo go flying... All you need is a texture to show the blood, and you've got it, right? <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/onya.gif" style="vertical-align:middle" emoid=":onya" border="0" alt="onya.gif" />
 
Ooh, so you're handling this via selecting a target, rather than getting character angle/pos and calculating explosion position via trig?

Sounds most excellent! <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/icon_praise.gif" style="vertical-align:middle" emoid=":bow" border="0" alt="icon_praise.gif" />
 
Yeah, cartoony... I love pressing F12 and going up and up and up... then pressing "walk forward" as I fall.

Could it be possible, appropros a non, to make a character "goto" a location in `mid-air`? I'd like a scene for a `quest-in`-nascence where you gotta jump off a cliff and fall into the water below...

And by the way, back to weapons questions: Why can't we use our bare fists or feet?
 
Hmm.
You can teleport them there, but I don't think you can make them walk to midair.
Haven't tried putting a locator "off the edge" as it were and making them walk off.
You could get around it by walking them to the edge, and then incrementally (via a recursive LAi_QuestDelay()/questcase ChangeCharacterAddress series) pushing them over the edge.
 
<!--`QuoteBegin-NathanKell`+--><div class='quotetop'>QUOTE(NathanKell)</div><div class='quotemain'><!--QuoteEBegin-->Ooh, so you're handling this via selecting a target, rather than getting character angle/pos and calculating explosion position via trig?
[/quote]
Exactly. The target is the key of the whole mod.
To be frank, i didn't even know of another method, but maybe that could be applied to make a visualization of the throw/flight of the weapon ?
 
<!--`QuoteBegin-CatalinaThePirate`+--><div class='quotetop'>QUOTE(CatalinaThePirate)</div><div class='quotemain'><!--QuoteEBegin--><img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/w00t.gif" style="vertical-align:middle" emoid=":woot" border="0" alt="w00t.gif" /> Stars, ha!  Reminds me of Roger Rabbit who had trouble calling up STARS when he was clunked on the head.  Singing birds, he got...  And other things - but never stars...  LOL!   <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/laugh.gif" style="vertical-align:middle" emoid="xD:" border="0" alt="laugh.gif" />  
[/quote]
I actually combined the "`see-the`-stars" knockout with the "churchbell" ringing sound <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/mybad.gif" style="vertical-align:middle" emoid=":facepalm" border="0" alt="mybad.gif" /> But maybe that is a bit TOO cartooney. Well, I'll leave it in the code as an option.
 
Bwahaha, yes indeedy you could make a visualization.
Use your and Inez's idea of faking statics with characters.

For what you can do with trig in POTC, see the sidestep code in programcharacterscharacters.c for an example.

What you'd want to do is, on throwing the grenade:
1. Grab pchar position and angle. (and save pchar.pos.y as "ground height")
2. log in new character slighty in front of pchar and at shoulder height. Give that character the model of a grenade.
3. Set up a recursive postevent() which would, every 1/10th second, move the item slightly forward (based on XZ component of throw_strength) and slightly up (Y component). Each time deduct gravity from the Y velocity.
4. once the object is finally at roughly ground height (the saved Y pos from above), remove it and create a particle system at that point.
5. Loop through all characters, and find their distance from that point. if within the grenade's explosion radius, apply damage.

That's how I'd handle it.
(And how I plan to handle jumping, via a recursive postevent that deducts Vy based on gravity on each execution.)

If you still want to use the targeting interface, you just need to find the angle between pchar and the target, and the distance, and use those values to calculate throw_angle and throw_strength to feed to the postevent loop.

You could even create a 0.1 second (or so) duration particle system on the object at each step of the flight, to give that "trailing sparks" look.
 
<!--`QuoteBegin-NathanKell`+--><div class='quotetop'>QUOTE(NathanKell)</div><div class='quotemain'><!--QuoteEBegin-->You could even create a 0.1 second (or so) duration particle system on the object at each step of the flight, to give that "trailing sparks" look.[/quote] <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/w00t.gif" style="vertical-align:middle" emoid=":woot" border="0" alt="w00t.gif" /> Cool! <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/onya.gif" style="vertical-align:middle" emoid=":onya" border="0" alt="onya.gif" />

I have a friend who joined the US Army Rangers - and he's delighted that they let him "blow things up"... <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/rolleyes.gif" style="vertical-align:middle" emoid=":rolleyes:" border="0" alt="rolleyes.gif" /> <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/laugh.gif" style="vertical-align:middle" emoid="xD:" border="0" alt="laugh.gif" />

This mod sounds great! Can't wait to see this! <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/keith.gif" style="vertical-align:middle" emoid=":keith" border="0" alt="keith.gif" />
 
Instant equip keys

Alan Smithee had the idea that it would be an advantage if you could reequip "throwaway" weapons like grenades by means of a hotkey instead of being forced to sheath your sword and open the Inventory interface.

Here is the code for that. In my usual stingy and minimalistic way I used code of my fellowmodders. The keys are the "shipgun ammochange" controls "1"-"4" , cause that function is IMHO related and these keys were still unused on land. The code for processing the controls can easily be inserted into the ProcessControls function in seadogs.c, just below dchaley's controls for quicksave:

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->// dchaley -->

    switch ( ControlName )

    {

 case "DCH_Quicksave": ProcessQuicksave(); break;

 case "DCH_Quickload": ProcessQuickload(); break;

    }

// dchaley <--





// ccc special weapons, equip by hotkeys `1-4`  

    

    if(!bSeaActive)    // works only on land, at sea these are ammocontrols

    {

 switch(ControlName)

 {

 case "BI_ChargeCannonballs":    // if you press key "1"...

     Log_SetStringToLog("Cobblestone");    // ..you get a screenmessage

     EquipCharacterbyItem(PChar, "pistolrock");    // .. and a "cobblestone" becomes your distanceweapon

     break;



 case "BI_ChargeGrapes":

     Log_SetStringToLog("Stinkpot");

     EquipCharacterbyItem(PChar, "pistolstink");

     break;



 case "BI_ChargeKnippels":

     Log_SetStringToLog("Etherbottle");

     EquipCharacterbyItem(PChar, "pistolgas");

     break;



 case "BI_ChargeBombs":

     Log_SetStringToLog("Grenade");

     EquipCharacterbyItem(PChar, "pistolgrenade");

     break;

 }

    }    

// ccc end





    

    if(bSeaActive && !bAbordageStarted)

    {<!--c2--></div><!--ec2-->

That already works fine, the EquipCharacterbyItem function checks if you really possess the desired weapon, and then exchanges it with the weapon you had equipped before. The only "inconvenience" is that the weapons are being equipped UNcharged, so that you have to sheath your sword and wait till the weapon is charged. That's being caused by a "LAi_GunSetUnload" command at the end of the EquipCharacterByItem function in charactersCharacterUtilite.c :


<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->void EquipCharacterByItem(ref chref, string itemID)

{

    aref arItm;

    ....

    ....

    SetEquipedItemToCharacter(chref, groupName, itemID);

    }

    if(groupName==GUN_ITEM_TYPE && sti(chref.index)==GetMainCharacterIndex())

    {    LAi_GunSetUnload(chref);

    }

}<!--c2--></div><!--ec2-->

That nuisance can easily be disabled by putting that code between comment markers:


<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->void EquipCharacterByItem(ref chref, string itemID)

{

    aref arItm;

    ....

    ....

    SetEquipedItemToCharacter(chref, groupName, itemID);

    }

    /* ccc special weapons, so that distanceweapons are charged if equiped

    if(groupName==GUN_ITEM_TYPE && sti(chref.index)==GetMainCharacterIndex())

    {    LAi_GunSetUnload(chref);

    }

    */

}<!--c2--></div><!--ec2-->
In the soon to be published final SWAK version you will be able to toggle that "instantcharge" ability and to customize which weapon the instantequip keys equip.
 
Alan, I'm working on a package update for B12, and want to include your brace of pistols. If you are working on something that ties into it, I won't include it unless you're finished. Let me know! <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/onya.gif" style="vertical-align:middle" emoid=":onya" border="0" alt="onya.gif" />
 
The brace of pistols is a standalone, and it's fully complete far as I'm concerned (the only one of my mods about which I might say that). Only change I foresee is that I've since added to the "items9" picture series... but further weapons/items, released over time, will just replace the original image with additions, uh, added. Might even improve it a bit.

And it seems now the multiple pistol sets are a bit superfluous/outdated, if CCC found how to grab a new/different gun with a single button...
 
If we are all working on separate mods, we do need to let everyone know what we're doing so we don't duplicate each other's work - or overwrite it...

I will look at what CCC has put together today - and how I can integrate it if I can... <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/onya.gif" style="vertical-align:middle" emoid=":onya" border="0" alt="onya.gif" />
 
Build update ? <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/william.gif" style="vertical-align:middle" emoid=":will" border="0" alt="william.gif" /> <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/onya.gif" style="vertical-align:middle" emoid=":onya" border="0" alt="onya.gif" />

I can contribute a bunch of mods and fixes, though I am a bit reluctant to make promises i may be unable to fulfill. The Thief mod is just a recent example that things tend to take MMMUUUUUCCHH longer than I think.

All i make can be unzipped on top of Build12, so integration should be no problem. And if anything clashes with newer mods we can reverse the process: you make your package with your stuff first, and then I put mine on top so that conflicts would be my problem.
 
Back
Top