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

pistol unequip

Jack Rackham

ex train dispatcher
Quest Writer
Storm Modder
I really need some coding help:

In Lai_events

under LAi_CharacterAttack()

I want to unequip the gun under certain (blade-) conditions:

1) if(CheckAttribute(attack, "equip.blade") && attack.equip.blade == "blade1")
{
RemoveCharacterEquip(attack, GUN_ITEM_TYPE);
}


2) RemoveCharacterEquip(attack, GUN_ITEM_TYPE );

1) doesn´t work but 2) on it´s own does.

I´ve tried a lot of variations but no use when you not "speak the language".

What to do? Please help, this may be a fun thing. <img src="style_emoticons/<#EMO_DIR#>/blink.gif" style="vertical-align:middle" emoid=":blink:" border="0" alt="blink.gif" />
 
Try using "<i>if(attack.equip.blade == "blade1")</i>". Even if a character doesn't have a blade at all, he/she still has the equip.blade attribute. You can, for example, check if somebody doesn't have a blade using "<i>if(attack.equip.blade == "")</i>". In my bladedamage mod, the line "<i>if(attack.equip.blade != "bladeX4")</i>" seems to be working just fine, so I don't see why your code shouldn't work.
 
<!--quoteo(post=143021:date=Mar 23 2006, 05:51 PM:name=Jack Rackham)--><div class='quotetop'>QUOTE(Jack Rackham @ Mar 23 2006, 05:51 PM) [snapback]143021[/snapback]</div><div class='quotemain'><!--quotec-->
I really need some coding help:

In Lai_events

under LAi_CharacterAttack()

I want to unequip the gun under certain (blade-) conditions:

1) if(CheckAttribute(attack, "equip.blade") && attack.equip.blade == "blade1")
{
RemoveCharacterEquip(attack, GUN_ITEM_TYPE);
}


2) RemoveCharacterEquip(attack, GUN_ITEM_TYPE );

1) doesn´t work but 2) on it´s own does.

I´ve tried a lot of variations but no use when you not "speak the language".

What to do? Please help, this may be a fun thing. <img src="style_emoticons/<#EMO_DIR#>/blink.gif" style="vertical-align:middle" emoid=":blink:" border="0" alt="blink.gif" />
<!--QuoteEnd--></div><!--QuoteEEnd-->


Insert a Trace before, and another one inside the if block, then look in the compile.log

I.e:


Trace("JK - LAi_CharacterAttack - Before IF " + attack.equip.blade + " - " + attack + " - " + GUN_ITEM_TYPE);
if(CheckAttribute(attack, "equip.blade") && attack.equip.blade == "blade1")
{
Trace("JK - LAi_CharacterAttack - Inside IF " + attack + " - "+ GUN_ITEM_TYPE);
RemoveCharacterEquip(attack, GUN_ITEM_TYPE);
}


Luck.
 
Not a two-handed & not a blade.

Thanks Pieter, I`ll try this.

Thank you kblack, I´ll do as you say.
 
a pair of fist's <img src="style_emoticons/<#EMO_DIR#>/w00t.gif" style="vertical-align:middle" emoid=":woot" border="0" alt="w00t.gif" /> Boxing!
 
Not a pair & not fists. 16 questions left.

Sorry to say but nothing helped.

Last 4 lines in compile log:

Gauging: Enc Officers
JK - LAi_CharacterAttack - Before IF blade1 - - gun
JK - LAi_CharacterAttack - Inside IF - gun
SETTING MUSIC: music_bitva

Guess this tells me that the game IS reading here.
 
Now I tested this:

if(CheckAttribute(attack, "equip.blade") && attack.equip.blade == "blade1")
{
RemoveCharacterEquip(attack, BLADE_ITEM_TYPE);
RemoveCharacterEquip(attack, GUN_ITEM_TYPE);
RemoveCharacterEquip(attack, FLASK_ITEM_TYPE);
RemoveCharacterEquip(attack, POUCH_ITEM_TYPE);
}


blade & pouch worked, not flask or gun. What is going on? <img src="style_emoticons/<#EMO_DIR#>/wacko.gif" style="vertical-align:middle" emoid=":wacko:" border="0" alt="wacko.gif" />
 
<!--quoteo(post=143093:date=Mar 24 2006, 06:35 AM:name=Jack Rackham)--><div class='quotetop'>QUOTE(Jack Rackham @ Mar 24 2006, 06:35 AM) [snapback]143093[/snapback]</div><div class='quotemain'><!--quotec-->
Now I tested this:

if(CheckAttribute(attack, "equip.blade") && attack.equip.blade == "blade1")
{
RemoveCharacterEquip(attack, BLADE_ITEM_TYPE);
RemoveCharacterEquip(attack, GUN_ITEM_TYPE);
RemoveCharacterEquip(attack, FLASK_ITEM_TYPE);
RemoveCharacterEquip(attack, POUCH_ITEM_TYPE);
}


blade & pouch worked, not flask or gun. What is going on? <img src="style_emoticons/<#EMO_DIR#>/wacko.gif" style="vertical-align:middle" emoid=":wacko:" border="0" alt="wacko.gif" />
<!--QuoteEnd--></div><!--QuoteEEnd-->


No idea, really.

Suggestions:

- Dump the structure of object "attack" (guess attack has ben defined as aref or ref ) - Look in tools directory, there are a file by NK that tells you how to do that (among other things)

- Verify that GUN_ITEM_TYPE and FLASK_ITEM_TYPE are defined and have correct values

- Go into RemoveCharacterEquip sub and analize the code.

Luck
 
<!--quoteo(post=143093:date=Mar 24 2006, 06:35 AM:name=Jack Rackham)--><div class='quotetop'>QUOTE(Jack Rackham @ Mar 24 2006, 06:35 AM) [snapback]143093[/snapback]</div><div class='quotemain'><!--quotec-->
blade & pouch worked, not flask or gun. What is going on? <img src="style_emoticons/<#EMO_DIR#>/wacko.gif" style="vertical-align:middle" emoid=":wacko:" border="0" alt="wacko.gif" />
<!--QuoteEnd--></div><!--QuoteEEnd-->
What the HECK???? I did notice something with the pistols not working though: Quick-equip pistol button. Still beats me why. <img src="style_emoticons/<#EMO_DIR#>/modding.gif" style="vertical-align:middle" emoid=":modding" border="0" alt="modding.gif" />
 
oooooh, let mes guess you are making one of those boarding cutlasses with a flintlock attached to it at the grip?
 
club yes. <img src="style_emoticons/<#EMO_DIR#>/guns.gif" style="vertical-align:middle" emoid=":2guns" border="0" alt="guns.gif" />
 
You have won a very valuable DUTCH painting.

I´m not sure how to insert an image.

Think I got it finally:
These lines are ok

if(CheckAttribute(attack, "equip.blade") && attack.equip.blade == "blade1")
{
RemoveCharacterEquip(attack, GUN_ITEM_TYPE );
}


if NOT inserted under

if(CheckAttribute(attack, "equip.blade")) // NK just in case.
{


but instead before it

Is this something that may help the blade damage mod? <img src="style_emoticons/<#EMO_DIR#>/duel_pa.gif" style="vertical-align:middle" emoid=":ixi" border="0" alt="duel_pa.gif" />
 
good a DUTCH painting, i`ll hang it above my bed!! I am very curious about you club, we need more weapons, that club is good for those thugs in the towns.
 
Back
Top