Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Xegethra

Adding polish to melee weapons - Some things I don't quite understand.

Recommended Posts

Hey,

I've been working on melee weapons recently and I have managed it, using experience from normal weapons and a fair bit of trial and error I have managed to make a weapon that can be both thrown, and smashed over enemies. Managed a working alt fire for fists to use either hand and for throwing/smashing a weapon.

While it works, it needs polish and this is where I am becoming stuck.

First of all, how do I make it so you can only pick up the weapon by button command?

How do I make the fists un-selectable until you throw/use the weapon?

How do I make it so that only one weapon at a time can be picked up? As it is now, sure I can only pick up one weapon of that type...good, I want it that way, but how do I also make it so that only one weapon at all ever, can be held?

And finally, how do I make the projectile arc when thrown? Currently it gets thrown in a straight line dead centre.

There would have been a fifth one, asking how to drop the weapon immediately after use but I figured it out with the A_TakeInventory, because infinitely throwable weapons...no.

There is another thing, which I am happy to live with for now, until the the other things are finished.

Share this post


Link to post
Xegethra said:

I've been working on melee weapons recently and I have managed it, using experience from normal weapons and a fair bit of trial and error I have managed to make a weapon that can be both thrown, and smashed over enemies. Managed a working alt fire for fists to use either hand and for throwing/smashing a weapon.

So is your weapon a separate weapon actor or just a pickup that enables an altfire of the fists weapon actor? I will assume it's a separate weapon actor in the rest of this post - if I assume wrong, it might invalidate my answer to your 2nd question (and maybe, but probably not, the other ones too).

Xegethra said:

First of all, how do I make it so you can only pick up the weapon by button command?

You mean by pressing use on it? Make a new actor that will serve as the weapon's pickup instead of the weapon itself. Don't give this actor a PICKUP flag, give it an USESPECIAL flag instead. Give it such a special that will give the weapon to the special's activator (who will be the player who pressed use on the actor) as well as removing the actor from the map (a script might be needed to do both simultaneously).

Xegethra said:

How do I make the fists un-selectable until you throw/use the weapon?

For example by using A_JumpIfInventory and A_SelectWeapon in the fist's Raise (maybe also Ready) state to forcibly select the weapon if the player has it.

Xegethra said:

How do I make it so that only one weapon at a time can be picked up? As it is now, sure I can only pick up one weapon of that type...good, I want it that way, but how do I also make it so that only one weapon at all ever, can be held?

???

Xegethra said:

And finally, how do I make the projectile arc when thrown? Currently it gets thrown in a straight line dead centre.

Remove the projectile's NOGRAVITY flag and play with its Gravity property. Beware that projectiles that don't fly in straight line tend to work poorly with autoaim on, though.

Share this post


Link to post
scifista42 said:

So is your weapon a separate weapon actor or just a pickup that enables an altfire of the fists weapon actor? I will assume it's a separate weapon actor in the rest of this post - if I assume wrong, it might invalidate my answer to your 2nd question (and maybe, but probably not, the other ones too).


It is a separate actor entirely yeah. The alt fire on the fists just enables the right arm to punch.

scifista42 said:

You mean by pressing use on it? Make a new actor that will serve as the weapon's pickup instead of the weapon itself. Don't give this actor a PICKUP flag, give it an USESPECIAL flag instead. Give it such a special that will give the weapon to the special's activator (who will be the player who pressed use on the actor) as well as removing the actor from the map (a script might be needed to do both simultaneously).


By pressing use yeah. I can't seem to get this to work, I make the item and give it the usespecial but I'm not sure where to go from there, I find a list of things it is supposed to do but I can't make sense of which to use and exactly where. I keep coming back to this and this. But I don't really get it.

scifista42 said:

For example by using A_JumpIfInventory and A_SelectWeapon in the fist's Raise (maybe also Ready) state to forcibly select the weapon if the player has it.


This is perfect thanks. Works just like I need it to!

scifista42 said:

???


Yeah I wasn't sure how to word this too well. What I mean is how can I make it so only one weapon can be picked up? Like say there is a bat and a plank, how do I make it so that I can only pick up one of these and can't have the other until I'm hands free again?

scifista42 said:

Remove the projectile's NOGRAVITY flag and play with its Gravity property. Beware that projectiles that don't fly in straight line tend to work poorly with autoaim on, though.


I'm a bit stuck here too, I set the values but it still goes in a straight line. I've fiddled with making the gravity heavy and light but they seem to have no effect. It has no nogravity flag, and I never play with autoaim on. But yeah, I can't break it from its straight line.

Share this post


Link to post
Xegethra said:

By pressing use yeah. I can't seem to get this to work, I make the item and give it the usespecial but I'm not sure where to go from there, I find a list of things it is supposed to do but I can't make sense of which to use and exactly where. I keep coming back to this and this. But I don't really get it.

Give USESPECIAL flag to the actor in a DECORATE editor, put an ACS_ExecuteAlways special onto the actor in a map editor, and write an ACS script to give the weapon to the script's activator (via GiveInventory, maybe call SetWeapon immediately after) + remove the actor (via Thing_Remove, the actor needs to have a non-zero tag to be recognized).

Xegethra said:

Yeah I wasn't sure how to word this too well. What I mean is how can I make it so only one weapon can be picked up? Like say there is a bat and a plank, how do I make it so that I can only pick up one of these and can't have the other until I'm hands free again?

I get it now - multiple weapon types exist, the player should only have one type at a time. I don't know how to do this best, but I think Action Doom 2 implements this very thing, so check it out.

Xegethra said:

I'm a bit stuck here too, I set the values but it still goes in a straight line. I've fiddled with making the gravity heavy and light but they seem to have no effect. It has no nogravity flag, and I never play with autoaim on. But yeah, I can't break it from its straight line.

NOGRAVITY flag is given automatically by the Projectile combo, which your projectile presumably has set, so put -NOGRAVITY after it to remove its effect.

Share this post


Link to post

The script, it works! I can pick up the weapon by a command now. But the remove_thing doesn't work, I gave it a new id so I would remember it and I have also tried putting in its name, but the pick up item remains...but it does give me the weapon at least.

*Edit*

My mistake, I got the numbers wrong, I ended up mistaking the TID for something else, got it fixed now!

Also, the gravity thing works nicely too, just have to find the right values but yeah in general it works quite well, semi realism I know but easy to use.

scifista42 said:

I get it now - multiple weapon types exist, the player should only have one type at a time. I don't know how to do this best, but I think Action Doom 2 implements this very thing, so check it out.


I think I will then, I remember that game has a few weapons but not sure if it lets you only hold the one thing..it's been a while.

But thanks for the help though, it has made using the weapon, which I made a beer glass a lot better.

*Edit 2*

O.K, ran into another snag. I realised that the script takes away all of the items that share the same tag away, so all of the beer glass pick up items are removed from the map. To get around this I gave the other glasses unique tags and made copy scripts for them, now when I pick up a weapon, all of the others remain on the map, however I am now able to pick up more than one beer glass where as before the script was implemented at all I could only pick up one.

I'm not sure how to edit the script. I'm, looking for a way but haven't found one yet but is there a way that I can have them all still be the same tag, but the script tells the game to only let me pick one up at a time, like how it was before the script? Iv'e been over the wiki, looked at the ACS commands and all that but I can't seem to get the right one out of it. I had tried the check inventory, and told it to check if I am holding the Beer glass....but I'm not sure what the next one should be, the command that says don't pick anything else up, not sure which one it is. I wish I could just type "PreventItemPickUP" or "PreventItemInventoy" or something, then follow it with the other weapon names/TID, sort of like

PreventItemPickUp/Inventory ("Beer1, Beer2");

Something along those lines, follow that after the checkiventory for any currently held item.

I have also tried setting a maximum inventory amount of 1 in the hopes that when reached, nothing else will be picked up. But no, you can still pick up additional items, I don't get it.

Share this post


Link to post

CRACKED IT!!!!!!

With this code in ACS.

script 1 (void)
{
int buttons = GetPlayerInput(0, BT_USE);
{
if (CheckInventory("Beer1"))
{
ACS_Terminate(1, 0);
}
else
{
GiveInventory("Beer1", 1);

Setweapon("Beer1");

Thing_Remove(6);
}
}
}

Say I have two glasses, one activates script 1, and one activates script 2. The script two glass has a tag of 7. And however many more glasses there are, they activate the next script up and have the next tag up. So now I can finally be happy that I got it right. I looked up so many wiki pages, topics and forums and got absolutely nowhere. Then I remembered that scripts have the if and else thing going for them...so I tried it, failed a few times but kept going....now, I have it working. You pick up ONE glass at a time and can't pick up any more until used.

Now I can do with the other weapons, but whether or not I can edit these scripts to terminate when holding other weapons, is another thing. That'll be when I look at Action Doom 2 like Scifista suggested.

*Edit*

Yes, yes I can, by doing this

script 1 (void)
{
int buttons = GetPlayerInput(0, BT_USE);
{
if (CheckInventory("Beer1"))
{
ACS_Terminate(1, 0);
}
if (CheckInventory("Beer2"))
{
ACS_Terminate(1, 0);
}
else
{
GiveInventory("Beer1", 1);

Setweapon("Beer1");

Thing_Remove(6);
}
}
}

And when it comes to the Beer2 item scripts, it's more or less the same.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×