• 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!

Pieter's Disarm and Fist features

CouchcaptainCharles

COO (Chief Oddity Officer)
Storm Modder
Pirate Legend
Following Nathan's sound suggestion I opened a new thread for the disarmcode <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />

Pieter, your new disarm code

code:

if( CheckAttribute(weapon, "fist" ) && enemy.chr_ai.group != LAI_GROUP_PLAYER )
// PB: New weapons attribute, exclusively for your fists
{
int rank = makeint(attack.rank)
int punch = rand (rank) + rank;
// Calculates the strength of your punch; character's rank increases damage

LAi_ApplyCharacterDamage(enemy, punch);
// Applies damage to enemy

LAi_CheckKillCharacter(enemy);
// Checks if this has killed the character

if(rand(100)< punch +10) // ccc added +10
// Checks if punch knocks enemy out; character's rank increases chance
{
LAi_SetPoorTypeNoGroup(enemy); // makes initial target collapse or cover
enemy.stuntime = locTmpTime; // stores the time of this, for reawakening
enemy.stuntime.dialog.filename = enemy.dialog.filename; // saves original dialog
enemy.dialog.filename = "stunned_dialog.c" ; // assigns "stunned" dialog during stuntime
if(enemy.sex == "man") {PlaySound("OBJECTSVoicesdeadmaledead1.wav")} // groan
else{PlaySound("OBJECTSVoicesdeadfemaledead_wom2.wav")}
Log_SetStringToLog("WHACK! You knocked out your opponent!");

float u, v, w; // coordinates for effects
GetCharacterPos(enemy, &u, &v, &w); // determines position of initial target
CreateParticleSystem("stars" , u, v+1, w, 0.0, 0.0, 0.0, sti(20) );
// displays the "stars" particle effect on the victim
}
else
{
LAi_group_Attack(attack, enemy); // makes victim and associates attack you
}
}


looks correct to me. You have grasped the logic of coding quite well by now <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/onya.gif" style="vertical-align:middle" emoid=":onya" border="0" alt="onya.gif" />

One thing is IMHO not necessary in the first condition "chain":

if( CheckAttribute(weapon, "disarm" ) && LAi_IsFightMode(enemy) && !CheckAttribute(enemy,"nodisarm" ) && enemy.equip.blade!="bladeX4")


If "bladeX4" doesn't have the "disarm" attribute you can skip "&& enemy.equip.blade!="bladeX4" " completely cause "CheckAttribute(weapon, "disarm" )" will sort "bladeX4" out then.


This may not have the effect you have in mind:

if(CheckAttribute(attack,"skill.Fencing")) {disarmbonus = 20} else
{disarmbonus = 0}


"skill.Fencing" is the "Melee" skill.(Blame Akella for these confusing terms) As FAIK every (fighting) character has that, even if it is only "1", "attack" will ALWAYS have a disarmbonus of 20.
I assume that you wanted to check for the PERK(ability) "Professional Fencer", right ? That would be "perks.list.SwordplayProfessional"
So this might have the desired effect:

int disarmbonus = 0;
if(CheckAttribute(attack,"perks.list.SwordplayProfessional")) {disarmbonus = 20;}


Setting disarmbonus to 0 right away saves you the else case. if(IsCharacterPerkOn(enemy, "SwordplayProfessional")) is what Akella uses for perkchecks.

HTH
 
Thanks a lot CCC. Will be implenting this later today.

The "enemy.equip.blade!="bladeX4"" part was added so that the player will not be disarmed if you have your fists equiped instead of a sword. Since "CheckAttribute(weapon, "disarm" )" checks whether the attacking person's weapon has the disarming attribute (right? <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/unsure.gif" style="vertical-align:middle" emoid=":?" border="0" alt="unsure.gif" /> ), I thought it would be nescessary to check if the attacked (enemy) person has his/her fists equiped. (As it is now, only the player ever has his/her fists to be equiped.) Since the equip.blade checks the enemy's blade, while the CheckAttribute checks the attack's blade, it should still be nescessary, shouldn't it? Or do these checks work different from what I thought? Or am I just completely off? Could very well be, of course. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/ohmy.gif" style="vertical-align:middle" emoid=":eek:" border="0" alt="ohmy.gif" />
 
I made some new modifications of the disarm/fistfight features (available in both full and update version from the known website). I hope that somebody can check if it actually does what I want it to. I added a luck skill addition to the knockout chance (I hope) instead of CCC's +100. I would like your fists to be pretty useless in the beginning of the game, so that it would be as if you're only stroking your enemy, instead of actually hurting him/her, because you're still terribly inexperienced.

<b>BTW: Question to everyone:</b> What was the highest skill you ever reached for your character? I want to know what the max rank is you can realistically acchieve in the game to calibrate knockout chance.

Code as it is now:<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->    if( CheckAttribute(weapon, "fist" ) && enemy.chr_ai.group != LAI_GROUP_PLAYER )

    // PB: New weapons attribute, exclusively for your fists

    {

 int rank = makeint(attack.rank)

 int punch = rand (rank) + rank;

 // Calculates the strength of your punch; character's rank increases damage



 LAi_ApplyCharacterDamage(enemy, punch);

 // Applies damage to enemy



 LAi_CheckKillCharacter(enemy); // Checks if this has killed the character



 if(!LAi_IsDead(enemy)) //checks if char now dead or not

 {

     if(rand(100)< punch + sti(attack.skill.Sneak))

     // Checks if punch knocks enemy out; character's rank increases chance

     {

   LAi_SetPoorTypeNoGroup(enemy);    // makes initial target collapse or cover

   enemy.stuntime = locTmpTime;    // stores the time of this, for reawakening

   enemy.stuntime.dialog.filename = enemy.dialog.filename;    // saves original dialog

   enemy.dialog.filename = "stunned_dialog.c";    // assigns "stunned" dialog during stuntime

   if(enemy.sex == "man") {PlaySound("OBJECTSVoicesdeadmaledead1.wav")}    // groan

   else{PlaySound("OBJECTSVoicesdeadfemaledead_wom2.wav")}

   Log_SetStringToLog("WHACK! You knocked out your opponent!");



   float u, v, w;          // coordinates for effects

   GetCharacterPos(enemy, &u, &v, &w);    // determines position of initial target

   CreateParticleSystem("stars" , u, v+1, w, 0.0, 0.0, 0.0, sti(20) );

   // displays the "stars" particle effect on the victim

     }

     else

     {

   LAi_group_Attack(attack, enemy);    // makes victim and associates attack you

     }

 }

    }



    // CCC and PB: New attribute to weapons to allow for disarming opponents

    if( CheckAttribute(weapon, "disarm" ) &&  LAi_IsFightMode(enemy) && !CheckAttribute(enemy, "nodisarm" ) && enemy.equip.blade!="bladeX4")

    {

 int disarmbonus = 0;

 if(CheckAttribute(attack,"perks.list.SwordplayProfessional")) {disarmbonus = 20;}

 // if attacker has professional fencing skill, increase disarm chance with 20%



 int disarmpenalty = 0;

 if(CheckAttribute(attack,"perks.list.SwordplayProfessional")) {disarmpenalty = 10;}

 // if attacked victim has professional fencing skill, decrease disarm chance with 10%



 if(rand(100)< sti(weapon.disarm) +sti(attack.skill.Fencing)/2 + disarmbonus - disarmpenalty)

 {

     PlaySound("OBJECTSduelsword_fallen.wav");

     string enemy_blade = GetCharacterEquipByGroup(enemy,BLADE_ITEM_TYPE);

     RemoveCharacterEquip(enemy,  BLADE_ITEM_TYPE );

     GiveItem2Character(attack, enemy_blade);



     if ( enemy.chr_ai.group !=  LAI_GROUP_PLAYER && !bAbordageStarted )

     // no disarming opponents during boarding

     {

   LAi_SetCitizenTypeNoGroup(enemy);

   Log_SetStringToLog("Opponent disarmed !");

     }

     else

     {

   TakeItemFromCharacter(enemy, enemy_blade);

   if ( enemy.id != "blaze" && !bAbordageStarted ) // if NOT player

   // officers safe from being disarmed boarding; player NOT safe from being disarmed during boarding

   {

       RemoveCharacterEquip(attack, BLADE_ITEM_TYPE );      // makes enemy use your blade against your officer

       EquipCharacterByItem(attack, enemy_blade);      // and enables you to get it back by killing him/her

       Log_SetStringToLog("One of your officers was disarmed!");

       LAi_tmpl_afraid_SetAfraidCharacter(enemy, attack, true);    // makes officer flee

       LAi_SetAfraidDead(enemy);

   }

   else

   {

       RemoveCharacterEquip(attack, BLADE_ITEM_TYPE );      // makes enemy use your blade against you

       EquipCharacterByItem(attack, enemy_blade);      // and enables you to get it back by killing him/her

       EquipCharacterByItem(enemy, "bladeX4");

       Log_SetStringToLog("You were disarmed!");

   }

     }

 }

    }<!--c2--></div><!--ec2-->I'm certainly not certain if the enemy equiping the sword you were using if you are disarmed works. Hope someone can figure that out. (I don't have particularly much time, truth be told <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/unsure.gif" style="vertical-align:middle" emoid=":?" border="0" alt="unsure.gif" /> )
And I hope that someone can also check the rest of the code to see if it actually does what it must. Once it does, someone (probably me) will have to find out what characters should be made safe from disarming, because they have tobe killed before a quest continues.

BTW: Nathan Kell, do you happen to know a way to have a disarmed person be considered dead by the `quest-part` of the game, so that disarming will be enough and you don't actually need to kill him/her if you have the luck to disarm? Just wondering... <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/rolleyes.gif" style="vertical-align:middle" emoid=":rolleyes:" border="0" alt="rolleyes.gif" />
 
BTW: It's not exactly "<i>Pieter's</i> Disarm and Fist features", now, is it? More like "everybody who has been willing and able to help with it"'s Disarm and Fist features. The disarm feature was based on a concept by CCC and both CCC and Nathan Kell have already helped so much with these features, that they're at least equally theirs.
Just wanted to say that... <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/unsure.gif" style="vertical-align:middle" emoid=":?" border="0" alt="unsure.gif" />
 
For my part: sure it's yours! All I did was mention LAi_IsDead(). Heck, I wasn't even here when you wrote it.
So don't worry 'bout crediting on my behalf! <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/par-ty.gif" style="vertical-align:middle" emoid=":cheers" border="0" alt="par-ty.gif" />

In re checking if dead.
{note: this is untested and off the cuff as it were...}
What you need to do is
Whenever you disarm someone
1. run LAi_group_CheckGroupQuest(), but modify it*
2. run QuestsCheck()

*It's in LAi_groups.c. Modify it so that,
find
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->if(group == ch.chr_ai.group)<!--c2--></div><!--ec2-->
replace
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->if(group == ch.chr_ai.group && ch.is_not_disarmed)<!--c2--></div><!--ec2-->
or whatever your `is-char`-disarmed check is.

Next. In quests_check.c's ProcessCondition(),
find:
Code:
	case "NPC_Death":
return CharacterIsDead(refCharacter);
break;[/case]
Replace with:
[code]	case "NPC_Death":
return (CharacterIsDead(refCharacter) || sti(refCharacter.is_disarmed));
break;
Or whatever your disarm check is.

There's also quest check "Group_Death" but it's never used, the `set-quest`-`check-to`-group command we modified above is.



If the disarmed fellow is a guard you will also want to run LAi_GenerateFantomFromMe(chr); (just make sure that the disarmed guard is removed from the location before you run it...). That will generate a new guard from the disarmed guard (in the same character slot), just like what'd happen if the disarmed guard were killed.

There. I _think_ that's all you need.

-----------

Ooh, also. This should work for stunned characters too, with the `run-these` bit getting added to the `when-char`-`is-stunned` code, and the disarm checks becoming stunned checks.
That's if stun doesn't have a `time-limit`. If it does, they may start fighting after the quest is over.
(I've not actually played any of this yet, so I dunno how it works in practice...)

And lastly, note that the character will still be in the location, stunned or disarmed as the case may be; so you probably want to, if they're _not_ a fantom character, when you disarm or stun them add a quest check of `pchar-leaves`-`this-location`, and the questcase as remove these characters.

Or do it via postevent() with a long delay.
 
<!--`QuoteBegin-Pieter` Boelen+--><div class='quotetop'>QUOTE(Pieter Boelen)</div><div class='quotemain'><!--QuoteEBegin-->The "enemy.equip.blade!="bladeX4"" part was added so that the player will not be disarmed if you have your fists equiped instead of a sword. Since "CheckAttribute(weapon, "disarm" )" checks whether the attacking person's weapon has the disarming attribute (right? <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/unsure.gif" style="vertical-align:middle" emoid=":?" border="0" alt="unsure.gif" /> ), I thought it would be nescessary to check if the attacked (enemy) person has his/her fists equiped. (As it is now, only the player ever has his/her fists to be equiped.) Since the equip.blade checks the enemy's blade, while the CheckAttribute checks the attack's blade, it should still be nescessary, shouldn't it? Or do these checks work different from what I thought? Or am I just completely off? [/quote]
Oh no, <b>I</b> am off <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/mybad.gif" style="vertical-align:middle" emoid=":facepalm" border="0" alt="mybad.gif" /> Overlooked the fact that the bladex4 check refers to "attack". You are quite right with that. (see, you already know more than I on this <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> )

As for crediting, YOU had the idea and YOU did all the work, so YOU are the author. That we others check and try to help doesn't make us coauthors, that's just what we are here for.
It would suit me quite well if you claim this for you alone, that way you'll get all the blame <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" />
 
Hmm. Can't say I understand quite what that's supposed to mean. As for now, there is no "ch.is_disarmed"-like code. If you know of some ways to improve the code, feel free to do so. I seem to be running out of free time and into exams soon. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/sad.gif" style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" />
BTW: If you kill a disarmed person, it is said you end up getting (major) rep hits. I never noticed any rep hit for killing an unarmed person (and found that quite weird. Hero before killing all French citizens and if I remember correctly: Hero after killing all French citizens). Anyway: Any idea how that might be fixed?
 
Sorry. For ch.is_disarmed I mean simply any check that will tell you whether that ch is disarmed or not.

You can use FindCharacterItemByGroup(ch, BLADE_ITEM_TYPE) == "" for a check (FindCh...() will return "" if no blade found).

So they'd be in turn:

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->if(group == ch.chr_ai.group && GetCharacterEquipByGroup(ch, BLADE_ITEM_TYPE) != "" && FindCharacterItemByGroup(ch, BLADE_ITEM_TYPE) != "")<!--c2--></div><!--ec2-->

That checks both that they have a sword and it's equipped. I _believe_ it's impossible to have an item equipped without having the item, but I'm not certain, and it's possible to create such a situation, so that's why I have both checks.

If you want them to count as disarmed also if they have a sword but it's just not equipped, delete the <i>&& GetCharacterEquipByGroup(ch, BLADE_ITEM_TYPE) != ""</i>.

The next:
I say above
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->return (CharacterIsDead(refCharacter) || sti(refCharacter.is_disarmed));<!--c2--></div><!--ec2-->
But replace with
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->bool tmpboolreturn = CharacterIsDead(refCharacter);

if(!tmpboolreturn) tmpboolreturn = GetCharacterEquipByGroup(ch, BLADE_ITEM_TYPE) == "" && FindCharacterItemByGroup(ch, BLADE_ITEM_TYPE) == "";

return tmpboolreturn;<!--c2--></div><!--ec2-->

With the same note on duplication as above.
---
I'd also suggest you do a check to see if a newly disarmed opponent has any blades left and if so equip one rather than immediately setting them to NoGroup (only do that if they have no blade left period).
Ditto for officers.
 
<!--`QuoteBegin-Pieter` Boelen+--><div class='quotetop'>QUOTE(Pieter Boelen)</div><div class='quotemain'><!--QuoteEBegin-->
BTW: If you kill a disarmed person, it is said you end up getting (major) rep hits. I never noticed any rep hit for killing an unarmed person (and found that quite weird. Hero before killing all French citizens and if I remember correctly: Hero after killing all French citizens). Anyway: Any idea how that might be fixed?[/quote]
Pieter, maybe you had so much Rep that even your genocide couldn't reduce you below heroic <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/danse1.gif" style="vertical-align:middle" emoid=":dance" border="0" alt="danse1.gif" /> . Actually this an old problem. The code causing the dreaded reputation loss is in Loc_aiLAi_fightparameters, in the functions LAi_ApplyCharacterBladeDamage and


if(LAi_IsDead(enemy))
{
exp = exp + LAi_CalcDeadExp(attack, enemy);
if(!isSetBalde)
{
if(enemy.chr_ai.group != LAi_monsters_group) LAi_ChangeReputation(attack, -3);
}
}
if(!isSetBalde)
{
if(enemy.chr_ai.group != LAi_monsters_group) LAi_ChangeReputation(attack, -1);
exp = 0.0;
}

It deducts 1 reppoint for hitting and 3 reppt fot killing an unarmed NPC. Looks like a Disney idea to me, and as this has already caused a lot of annoyance if you JUST CAN'T HELP hitting unarmed chrs I propose that we make it tweakable:


#define REPLOSS 1 // Reputation you loose if you hit an unarmed NPC

--------------------------------

{
// ccc mar05 REPLOSS tweak added
if(enemy.chr_ai.group != LAi_monsters_group) LAi_ChangeReputation(attack, - REPLOSS*3);
}
}
if(!isSetBalde)
{
// ccc mar05 REPLOSS tweak added
if(enemy.chr_ai.group != LAi_monsters_group) LAi_ChangeReputation(attack, - REPLOSS);


After all we are all very virtious pirates, and we would never inlife hurt innocent civilians, right? <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#>/whistling.gif" style="vertical-align:middle" emoid=":wp" border="0" alt="whistling.gif" /> <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/oops3.gif" style="vertical-align:middle" emoid=":eek:ops2" border="0" alt="oops3.gif" /> <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/slap.gif" style="vertical-align:middle" emoid=":slap" border="0" alt="slap.gif" /> Allright, allright, even the most righteous president can't avoid some colateral killings now and then <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" />
 
<!--quoteo--><div class='quotetop'>QUOTE</div><div class='quotemain'><!--quotec-->I seem to be running out of free time and into exams soon.<!--QuoteEnd--></div><!--QuoteEEnd-->
Exams should take precedence, or you'll regret it later. We'll still be here when you're done with it. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/icon_wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="icon_wink.gif" />
 
Pieter you asked about blocking.
Open ProgCharCharacters.c
Scroll down until you see:
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->void SetDefaultFight(ref character)<!--c2--></div><!--ec2-->
Below that it lists the various attack animations. Set *.actions.block to some other animation if the specific character has fists equipped and you will (I think/hope) disable the animation.
 
<!--`QuoteBegin-Inez` Dias+--><div class='quotetop'>QUOTE(Inez Dias)</div><div class='quotemain'><!--QuoteEBegin-->
I seem to be running out of free time and into exams soon.
Exams should take precedence, or you'll regret it later. We'll still be here when you're done with it. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/icon_wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="icon_wink.gif" />[/quote]
For sure <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/yes.gif" style="vertical-align:middle" emoid=":yes" border="0" alt="yes.gif" />
 
An interesting thing I just found:
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->SendMessage(&chr, "lsl", MSG_CHARACTER_EX_MSG, "SetFightWOWeapon", false);<!--c2--></div><!--ec2-->

So can we set "Fight Without* Weapon" true? If so, what happens?

*I assume WO means without. But I'm gradually learning the dangers of assumptions. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/unsure.gif" style="vertical-align:middle" emoid=":?" border="0" alt="unsure.gif" />
 
BTW: If you kill a stunned guard, he's regenerated stunned. Can that be fixed somehow?
 
Aaaarrrrggghhh! I'm going NUTS with this mod. And also with the stunned citizen dialog which refuses to not display the loot option when the stunned person has got nothing to steal, even though Nathan gave me some code that should work. Might I kindly request that somebody else (Nathan?) has a go on making all mods ready for a Build update? I don't seem to be able to understand this coding anymore; getting waaaay too complicated for a simple `modder-to`-be... <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/sad.gif" style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" />
 
Can you upload or send me your latest code? Sure I'll take a look.
Don't worry about it, we all get stuck or overbusy at points, and you (with exams, for goodness sake!) have a quite good reason! <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/par-ty.gif" style="vertical-align:middle" emoid=":cheers" border="0" alt="par-ty.gif" />
 
I've been trying to do some improving on my fistfighting code and I need your help! The code as it is now can be seen below. I'd like to know how to optimize the first part of the code; I reckon the usage of four int's isn't really very good. I'm also worried about what will happen if the enemy has a higher rank than the attack; this will return a negative rank_diff int, which won't work too well with the code. What do yuo reckon should happen when the enemy has a higher rank than the attack? Should the attack do 1 damage or something like that?

Also: You'll notice I added a switch to play a random punch sound every time you hit someone. I have some nice sounds from the Indiana Jones and the Emperor's Tomb game for that, but PotC doesn't like them (causes a crash every time you hit somebody). Someone, please help me getting <a href="http://millenniumdock.bravepages.com/storage/others/punch_sounds.zip" target="_blank">these</a> sounds working with Pirates of the Caribbean.
(Of course, the itm.sound attribute for the fists will be removed from InitItems.c as well)

BTW: Is there some code somewhere that is run every time you press the "E"-key to equip/de-equip your sword? If so, I could add a PlaySound there that plays no draw/sheath sword sound if you use your fists and plays the default when using anything else. Anyone knows of any such piece of code? I'd also need to replace the default sound file with silence, just like CCC did with some of his SWAK stuff.

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->    if( CheckAttribute(weapon, "fist" ) && enemy.chr_ai.group != LAI_GROUP_PLAYER )
    // PB: New weapons attribute, exclusively for your fists
    {
 int attack_rank = makeint(attack.rank);
 int enemy_rank = makeint(enemy.rank);
 int rank_diff = attack_rank - enemy_rank;
 int punch = rand (rank_diff) + rank_diff;
 // Calculates the strength of your punch; character's rank increases damage

 LAi_ApplyCharacterDamage(enemy, punch);
 // Applies damage to enemy

 switch(rand(2))
 {case 0:
  PlaySound("OBJECTS\duel\punch1.wav");
  break;}
 {case 1:
  PlaySound("OBJECTS\duel\punch2.wav");
  break;}
 {case 2:
  PlaySound("OBJECTS\duel\punch3.wav");
  break;}
 // Play a random punch impact sound

 LAi_CheckKillCharacter(enemy); // Checks if this has killed the character

 if(!LAi_IsDead(enemy)) //checks if char now dead or not
 {
     if(rand(100)< punch + sti(attack.skill.Sneak))
     // Checks if punch knocks enemy out; character's rank increases chance
     {
   LAi_SetPoorTypeNoGroup(enemy);   // makes initial target collapse or cover
   enemy.stuntime = locTmpTime;   // stores the time of this, for reawakening
   enemy.stuntime.dialog.filename = enemy.dialog.filename;   // saves original dialog
   enemy.dialog.filename = "stunned_dialog.c";   // assigns "stunned" dialog during stuntime
   if(enemy.sex == "man") {PlaySound("OBJECTS\Voices\dead\male\dead1.wav")}   // groan
   else{PlaySound("OBJECTS\Voices\dead\female\dead_wom2.wav")}
   Log_SetStringToLog("WHACK! You knocked out your opponent!");

   float u, v, w;      // coordinates for effects
   GetCharacterPos(enemy, &u, &v, &w);    // determines position of initial target
   CreateParticleSystem("stars" , u, v+1, w, 0.0, 0.0, 0.0, sti(20) );
   // displays the "stars" particle effect on the victim
     }
     else
     {
               LAi_group_Attack(attack, enemy);    // makes victim and associates attack you
     }
 }
    }<!--c2--></div><!--ec2-->
Of course: Thanks in advance for the help! <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/me.gif" style="vertical-align:middle" emoid=":onya" border="0" alt="me.gif" />
 
Re: "Outside" sounds in PotC:

I've had trouble trying to get outside sounds to work in PotC... Not quite sure what the problem is - even had trouble getting sounds from INSIDE PotC - but edited - to work. Mad Jack just recently did something magical to one of my files so it actually WORKED, so perhaps he can help - or at least point you in the right direction... <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/me.gif" style="vertical-align:middle" emoid=":onya" border="0" alt="me.gif" /> He takes rum as legal tender. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/w00t.gif" style="vertical-align:middle" emoid=":woot" border="0" alt="w00t.gif" />
 
1. Maybe make it rank * rank / erank, and make it plain rank/erank for the knockout check.

2. Are they at the same Hz and bits as the stock files?

3. Hmm. You can fake this by checking if pchar is not in the same fightmode (off or on) as he was a slight time ago (i.e. like how sails are handled). I don't know of a function that runs when you enter fightmode, but you can search for "fightmode" in the code...

I wouldn't worry about the ints, the code looks fine to me...

Hopefully I'll be able to help more tomorrow, when my brain is de-mushified. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />
 
About the sound files: No; they are very much not the same type. I did try to convert it, but haven't had any luck. I'll be asking Mad Jack later then.
Thanks for the help; will see what I can do Saturday or so.
 
Back
Top