Advanced Search

Author Topic: The "How do I make a weapon do that?" thread  (Read 91828 times)

0 Members and 1 Guest are viewing this topic.

October 03, 2014, 04:49:29 AM
Reply #510

Offline Russel

  • MM8BDM Extender

  • Doc Croc
  • **********
  • Date Registered: December 17, 2010, 11:11:25 PM

    • View Profile
Re: The "How do I make a weapon do that?" thread
« Reply #510 on: October 03, 2014, 04:49:29 AM »
Try changing the 1 after the expression to a 2. A_Jump functions have always confused me and sometimes they don't work in ways you think they would...

October 03, 2014, 08:32:15 PM
Reply #511

Offline TheDoc

  • Standard Member
  • Date Registered: August 31, 2011, 10:37:33 PM

    • View Profile
Re: The "How do I make a weapon do that?" thread
« Reply #511 on: October 03, 2014, 08:32:15 PM »
Oh yea it is weird like that isn't it?

Finally it works! Thank you again...but I have one more question :mrgreen:
How does the damage property of an actor work? Specifically, is there a difference between putting damage in parentheses and not?

October 03, 2014, 08:46:11 PM
Reply #512

Offline Ceridran

  • MM8BDM Extender
  • **
  • Date Registered: April 07, 2012, 01:08:52 AM

    • View Profile
    • http://ceridran.tumblr.com/
Re: The "How do I make a weapon do that?" thread
« Reply #512 on: October 03, 2014, 08:46:11 PM »
Far as I know, you need to put it in parentheses, or it ain't gonna recognize it.

October 03, 2014, 09:56:21 PM
Reply #513

Offline Russel

  • MM8BDM Extender

  • Doc Croc
  • **********
  • Date Registered: December 17, 2010, 11:11:25 PM

    • View Profile
Re: The "How do I make a weapon do that?" thread
« Reply #513 on: October 03, 2014, 09:56:21 PM »
That one actually has a legitimate answer.

By default, there is a damage spread of a randomized value of 1-8 times the given value. In the case of the +STRIFEDAMAGE flag, this value is changed to 1-4 times the given value.
If this value is placed in parenthesis, the randomization is removed.

It's even stated on the wiki, it helps to read.

October 03, 2014, 10:11:01 PM
Reply #514

Offline TheDoc

  • Standard Member
  • Date Registered: August 31, 2011, 10:37:33 PM

    • View Profile
Re: The "How do I make a weapon do that?" thread
« Reply #514 on: October 03, 2014, 10:11:01 PM »
I actually did read that and apparently missed the parentheses part; sorry bout that :? . Thanks tho

January 12, 2015, 02:33:40 PM
Reply #515

Offline Beed28

  • MM8BDM Extender

  • Putting the 'bounce' into your world.
  • ***
  • Date Registered: June 20, 2011, 08:07:58 PM

    • View Profile
Re: The "How do I make a weapon do that?" thread
« Reply #515 on: January 12, 2015, 02:33:40 PM »
I need help. I'm trying to make a script that checks if the up, down, left or right keys are pressed (and only pressed; not held down) and gives the player a flag item based on which key is pressed for a very brief period. However, I just can't get this working properly, it always acts when the key is held down.

(click to show/hide)

January 12, 2015, 02:54:31 PM
Reply #516

Offline Russel

  • MM8BDM Extender

  • Doc Croc
  • **********
  • Date Registered: December 17, 2010, 11:11:25 PM

    • View Profile
Re: The "How do I make a weapon do that?" thread
« Reply #516 on: January 12, 2015, 02:54:31 PM »
First off, the check logic on the keys is wrong. Basically what you would want to do is something along the lines of checking if the button you're checking is among the list of buttons being pressed and what you're checking is if the button you're checking is the only button pressed.
In my work in progress kart racing mod for Doom, my button checks used a statement more like this:
Code: [Select]
if(buttons & BT_FORWARD)Also in the given script, your use of "&" needs to be replaced with "&&." I can't find the words to explain this any better than X&Y basically asks "does X contain Y?" rather than a boolean statement saying "X and Y."

Second, I'm having trouble interpreting what you're trying to ask here:
Code: [Select]
if ((buttons == (BT_FORWARD|BT_BACK|BT_MOVELEFT|BT_MOVERIGHT)) & (keyHold == TRUE))It seems like you're checking to see if any of those buttons are pressed, but...that seems unnecessary because you're doing the same thing below anyway?

Third, the delays after the button statements aren't necessary and might actually cause the response time to get reduced should the button direction get changed.

Finally, I would recommend using a while loop over a restart statement, as that reactivates the script rather than keeping it running in the same instance.

January 12, 2015, 03:46:59 PM
Reply #517

Offline Beed28

  • MM8BDM Extender

  • Putting the 'bounce' into your world.
  • ***
  • Date Registered: June 20, 2011, 08:07:58 PM

    • View Profile
Re: The "How do I make a weapon do that?" thread
« Reply #517 on: January 12, 2015, 03:46:59 PM »
Jeez, I still can't wrap my head around all this. For the second one, it's to try and prevent the keys from being registered held down, but it didn't work.

January 12, 2015, 04:10:25 PM
Reply #518

Offline Russel

  • MM8BDM Extender

  • Doc Croc
  • **********
  • Date Registered: December 17, 2010, 11:11:25 PM

    • View Profile
Re: The "How do I make a weapon do that?" thread
« Reply #518 on: January 12, 2015, 04:10:25 PM »
Why not just use the boolean you established at the beginning of the script, then?

I mean it's set up to set keypressed to true if any of the valid keys have been pressed, so why need to check if they were already pressed again?

January 12, 2015, 06:43:33 PM
Reply #519

Offline Beed28

  • MM8BDM Extender

  • Putting the 'bounce' into your world.
  • ***
  • Date Registered: June 20, 2011, 08:07:58 PM

    • View Profile
Re: The "How do I make a weapon do that?" thread
« Reply #519 on: January 12, 2015, 06:43:33 PM »
Still very confused. Is there nothing out there I can use for a reference?

The only examples on the ZDoom wiki doesn't look like any examples of button pressing (and not holding).

January 13, 2015, 12:36:01 AM
Reply #520

Offline Russel

  • MM8BDM Extender

  • Doc Croc
  • **********
  • Date Registered: December 17, 2010, 11:11:25 PM

    • View Profile
Re: The "How do I make a weapon do that?" thread
« Reply #520 on: January 13, 2015, 12:36:01 AM »
idk man I guess you could do something similar to...

Code: [Select]
script  ENTER
{
If(PlayerIsBot(PlayerNumber())){terminate;}

int keyPressed = 0;

While(true)
{
int buttons = GetPlayerInfo(-1, INPUT_BUTTONS);
if(buttons & BT_FORWARD)
{
if(keypressed==0)
{
GiveInventory("FowardKey",1);
TakeInventory("BackKey", 1);
//The other take lines should be here too
keypressed=1;
}
}


}
}

January 13, 2015, 01:05:03 AM
Reply #521

Offline Beed28

  • MM8BDM Extender

  • Putting the 'bounce' into your world.
  • ***
  • Date Registered: June 20, 2011, 08:07:58 PM

    • View Profile
Re: The "How do I make a weapon do that?" thread
« Reply #521 on: January 13, 2015, 01:05:03 AM »
Well, I asked on the ZDoom forum, and got a working solution at last.

Thank you for the help, anyway.

January 16, 2015, 03:23:43 PM
Reply #522

Offline Beed28

  • MM8BDM Extender

  • Putting the 'bounce' into your world.
  • ***
  • Date Registered: June 20, 2011, 08:07:58 PM

    • View Profile
apologies for the double post
« Reply #522 on: January 16, 2015, 03:23:43 PM »
New situation. How can I make a shield weapon be able to absorb hits while protecting the user from damage?

January 16, 2015, 03:39:04 PM
Reply #523

Offline Megaman94

  • Standard Member
  • Date Registered: April 08, 2013, 08:49:51 PM

    • View Profile
    • http://sonicfansunited.forumotion.com/
Re: apologies for the double post
« Reply #523 on: January 16, 2015, 03:39:04 PM »
Quote from: "Beed28"
New situation. How can I make a shield weapon be able to absorb hits while protecting the user from damage?

Doesn't the leaf shield do that?

January 16, 2015, 06:37:54 PM
Reply #524

Offline Beed28

  • MM8BDM Extender

  • Putting the 'bounce' into your world.
  • ***
  • Date Registered: June 20, 2011, 08:07:58 PM

    • View Profile
Re: apologies for the double post
« Reply #524 on: January 16, 2015, 06:37:54 PM »
Quote from: "Megaman94"
Quote from: "Beed28"
New situation. How can I make a shield weapon be able to absorb hits while protecting the user from damage?

Doesn't the leaf shield do that?
Nope. Leaf Shield reflects certain projectiles. Skull Barrier makes you invincible. Plant Barrier heals you. Junk Shield gives you armour, not exactly what I'm looking for.