Jump to content
The Dark Mod Forums

[SOLVED] How to 'remove' blackjack and sword?


grayman

Recommended Posts

HMart -
I followed your helpful outline, though my thread function was somewhat simplified:

void player::DiscardWeaponThread(entity weapon) {
    sys.trigger($atdm_gui_message_no_art_my_weapon_message);
    sys.wait(4);
        disableWeapon();    
    sys.waitFor(weapon);
    sys.wait(3); // possibly redundant    
    discardthreadNumber = 0; // Tell caller we're done
  }

My version of DiscardWeaponThread() has these differences:

  • I added the ...Thread suffix - that's just me.
  • It's a void function, since the "thread" keyword on the call takes care of returning the thread ID.
  • Wrapping the body in "eachFrame" didn't seem to buy anything other than making my head hurt. By not having an endless loop, I can end the thread just by ending the function, so don't need a sys.terminate
  • Instead of your gui method, I used an atdm_gui_message... element in the map to put a message up for 4 seconds.  This works fine.
  • weapon.weaponHolstered() is a void function, so was not meaningful to test by an "if". And its presence or absence didn't seem to make a difference.
  • I don't know if waitFor(weapon) works (I added "sys." before it), so I did sys.wait(3) too to be safe.

This is an OK if imperfect solution. A problem with using disableWeapon is that, while it puts the weapon down, it leaves it selected in the GUI, and you can't unselect with TAB. Nor can the user raise it (and see my message) again. I tried putting an enableWeapon() at the end of the thread, but that undesirably raises the weapon again.

I also tried, in place of the disableWeapon() call, these functions -

  • LowerWeapon(); // w or w/o "self."
  • selectWeapon("atdm:weapon_unarmed");

Neither exhibited the necessary lowering response (although getting rid of disableWeapon did mean you could lower the weapon with the normal keystroke, and when you re-raised it with the normal keystroke, the gui message would re-appear).

Finally, I considered trying .Lower(), that is available for certain weapons, e.g.:

#include "script/tdm_weapon_blackjack.script"
...
    // replace "disableWeapon()" with code that checks if weapon is blackjack (not shown) and if so:
    weapon_blackjack jack = weapon; // cast so "Lower" is available. BAD SYNTAX
    jack.Lower();

But I don't know how to do the required cast/conversion in this scripting language.

Link to comment
Share on other sites

Among my problems with disableWeapon() is that it disables ALL weapons, not just the current one, by essentially freezing the weapons part of the user interface. This may work for grayman's use case (the player put in jail) but not mine... I want to be more selective. (Not shown: my filtering of weapon type so that DisarmWeaponThread gets called only for blackjack and shortsword).

[SOLVED] I finally have a solution for my needs. Instead of using "disableWeapon()" in the above function, I use:
    selectWeapon("unarmed");

Note carefully the argument here. It is not either of these:
    selectWeapon("atdm:weapon_unarmed");    
    selectWeapon("player1_weapon"); // Name returned by weapon.GetName() when player unarmed.

FYI, grayman gives the otherwise-undocumented list of selectWeapons strings here as:
 
"unarmed"
"blackjack"
"shortsword"
"broadhead"
"waterarrow"
"firearrow"
"ropearrow"
"gasarrow"
"noisemaker"
"mossarrow"
"vinearrow"

 

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.

  • Recent Status Updates

    • Ansome

      Turns out my 15th anniversary mission idea has already been done once or twice before! I've been beaten to the punch once again, but I suppose that's to be expected when there's over 170 FMs out there, eh? I'm not complaining though, I love learning new tricks and taking inspiration from past FMs. Best of luck on your own fan missions!
      · 4 replies
    • The Black Arrow

      I wanna play Doom 3, but fhDoom has much better features than dhewm3, yet fhDoom is old, outdated and probably not supported. Damn!
      Makes me think that TDM engine for Doom 3 itself would actually be perfect.
      · 6 replies
    • Petike the Taffer

      Maybe a bit of advice ? In the FM series I'm preparing, the two main characters have the given names Toby and Agnes (it's the protagonist and deuteragonist, respectively), I've been toying with the idea of giving them family names as well, since many of the FM series have named protagonists who have surnames. Toby's from a family who were usually farriers, though he eventually wound up working as a cobbler (this serves as a daylight "front" for his night time thieving). Would it make sense if the man's popularly accepted family name was Farrier ? It's an existing, though less common English surname, and it directly refers to the profession practiced by his relatives. Your suggestions ?
      · 9 replies
    • nbohr1more

      Looks like the "Reverse April Fools" releases were too well hidden. Darkfate still hasn't acknowledge all the new releases. Did you play any of the new April Fools missions?
      · 5 replies
    • The Black Arrow

      Hope everyone has the blessing of undying motivation for "The Dark Mod 15th Anniversary Contest". Can't wait to see the many magnificent missions you all may have planned. Good luck, with an Ace!
      · 0 replies
×
×
  • Create New...