Ammunition Consumption Bypass

Bug reports and feature requests. New features can only be added to the current development version. Bug-fixes may be back-ported.

Current release: 099 / Current development: 100
Post Reply

What bypass method should be used.

Add a flag to npcdesc to bypass npcs consuming ammo.
1
17%
Add a flag to weapondesc to bypass consuming ammo.
0
No votes
Allow weapondesc to accept no ammotype and thus not consuming anything(dangerous).
0
No votes
Create a new hook for ammunition consumption which would allow people to use other things for consumption (vitals).
5
83%
 
Total votes: 6

DevGIB
Grandmaster Poster
Posts: 248
Joined: Mon Feb 06, 2006 6:12 am

Ammunition Consumption Bypass

Post by DevGIB »

As request has been made to add a way to remove the core functionality of consuming ammunition from ranged weapons.

We have a few different options or ways to do it so i figured i'd throw it to a vote to see what people thinks is best and then we can look at adding that in.

The reason for suggesting to add it this way is if people do it through the combat hook it requires them writing full combat code rather than just hooking the consumption part.

Feel free to add your suggestions or comments below, once i've got a general consensus we'll look at adding that in.

A note on the 3rd option the reason i suggest its dangerous is that it leaves it open to the mistake of someone forgetting to put an ammo type in and people getting away with being able to shoot any time, however it was a suggestion from the original request so i've included it here.
Yukiko
Distro Developer
Posts: 2825
Joined: Thu Feb 02, 2006 1:41 pm
Location: San Antonio, Texas
Contact:

Re: Ammunition Consumption Bypass

Post by Yukiko »

I think a flag ConsuneAmmo 0/1 added to an NPCs definition for any NPC that might use ammo is probably the best way to go.
guialtran
Grandmaster Poster
Posts: 120
Joined: Wed Jul 30, 2008 12:42 pm

Re: Ammunition Consumption Bypass

Post by guialtran »

I think the flag and the hook, are 2 very good ideas.
Unfortunately I can not score both. :shame:

I think it's a good idea :D , and I'd like to suggest some equivalent code in Escript, to get in the place of the pseudo code of documentation.

in this way it becomes clearer, what the player must do of any system is turned off, or partially for archer for example.

https://docs.polserver.com/pol100/attack.php
I know it's a tiring job :deadhorse: , but many will use it and thank :bacondance:

PS:the hook would allow a custom arrow consumption system, this player's could have more than one type of flachas, with different damage and different effects.
remembering that there is a new item arrows port.
Yukiko
Distro Developer
Posts: 2825
Joined: Thu Feb 02, 2006 1:41 pm
Location: San Antonio, Texas
Contact:

Re: Ammunition Consumption Bypass

Post by Yukiko »

I don't understand how adding a flag to a weapon's description would work in cases where you do want the weapon to consume ammo. For example I define a regular bow with the flag set to not consume ammo. Does that mean any character using the bow would never have to worry about carrying arrows?

This whole issue came up because NPCs used up ammo, ie. arrows, and there is no easy way to prevent that. Setting a member for an NPC ConsumeAmmo to 0 would be the easiest for developers to use. No special hooks. The default would be ammo is used unless specifically set to ConsumeAmmo 0.

POL is already complicated enough. Let's do something that is simple and straight forward. If someone wants to script their own combat system there is already provision for that.
guialtran
Grandmaster Poster
Posts: 120
Joined: Wed Jul 30, 2008 12:42 pm

Re: Ammunition Consumption Bypass

Post by guialtran »

yes but what the gib tried to say is that the flag would only fit npcs, so it would be ignored for normal players.

the hook for consumption is something that falls within the pseudocode of combat.
So if you do not have it done it will work normally.

but if you want a modification in the combat pseudocode's consuming core, you have a powerful weapon with that hook.

I think it's interesting, at worst, you do not do the trick.
and if you have the system completely turned off, you will not even hear about it.
ThisIsMe
Distro Developer
Posts: 101
Joined: Sun Jul 17, 2016 1:29 am
Contact:

Re: Ammunition Consumption Bypass

Post by ThisIsMe »

I am going to suggest something not mentioned above.

Why not put this in the Privilege stuff, this ensures it can be both utilized by players and npcs and does not add anything in terms of a new hook or function syntax, it is just something devs will need to put in their npcdesc files or however they want to grant the privilege.

This would be the best option in my opinion as there is already a framework for dealing with archery and movement so perhaps that is at least a starting point plus the privileges are a fairly easy and straightforward thing to use from a shard dev perspective and again, it gives the ability for this to be used by pcs as well as npcs.
Yukiko
Distro Developer
Posts: 2825
Joined: Thu Feb 02, 2006 1:41 pm
Location: San Antonio, Texas
Contact:

Re: Ammunition Consumption Bypass

Post by Yukiko »

The Privilege idea sounds good to me. It could work as a "buff" (I hate that word) or bonus for players and the NPC AI could enable it for NPCs that do not use ammo.
DevGIB
Grandmaster Poster
Posts: 248
Joined: Mon Feb 06, 2006 6:12 am

Re: Ammunition Consumption Bypass

Post by DevGIB »

Then you would suggest an equipt script that enables the privs for players if you wanted to have a bow which does not consume ammunition?

If its a priv then its blanket access to bypass ammunition consumption which i don't think is a good idea and personally believe that it should be more granular to allow people the level of customability they've become used to with POL :P
Yukiko
Distro Developer
Posts: 2825
Joined: Thu Feb 02, 2006 1:41 pm
Location: San Antonio, Texas
Contact:

Re: Ammunition Consumption Bypass

Post by Yukiko »

It wouldn't be a "blanket privilege". In the equip script it could be enabled but do not forget there is an unequip script. There you could revoke the privilege. I think this is much more versatile and convenient than even my suggestion. Also, if it is a privilege it could be used in custom magic spells to grant, temporarily, "infinite ammo from the gods" or whatever the spell/rite would be named. Your "magical bow" you mentioned could have a CProp that tells the equip script to enable the privilege and your unequip script to disable it or the equip/unequip scripts could use the ObjType or weapon name to trigger granting and revoking the privilege. Plus this works for NPCs as well, which was the original issue that go this idea started.

I do not see any inherent problems with this idea. We grant the "invulnerable" privilege in some cleric rites and it gets turned off/revoked at the end of the rite's timer. Spirit Speak grants "hear ghost" temporarily and it gets revoked at the timer's end. These privileges are very useful. So add one more. Heck, add it as a privilege along with the fancy whamo-bango other ways you want to grant infinite ammo so we have the option of using the privilege if we want to. I think having the option of it as a privilege would "allow people the level of customability they've become used to with POL"
kevin
POL Developer
Posts: 53
Joined: Wed Sep 29, 2010 3:47 pm
Contact:

Re: Ammunition Consumption Bypass

Post by kevin »

I like the hook idea. That gives shard developers complete control over how ammunition would be calculated. If the hook returns an integer, you could return 0 for no ammo used, 1 for normal, and then i dunno, maybe the player has some special skill attached that uses 3x ammo for 1.5x damage or something, so you'd return 3. I like iiiiit

Dunno what you'd do about negative numbers. Either add ammo...? or just say it's 0 ammo used.
guialtran
Grandmaster Poster
Posts: 120
Joined: Wed Jul 30, 2008 12:42 pm

Re: Ammunition Consumption Bypass

Post by guialtran »

My idea of hook is different from this.
if (the hook was loaded, then)
the player has no ammo,(combat must not proceed) return 0 :( .
the player has ammunition and your code verified this(the combat is done) return 1 :whip: .

My translator is autistic today :( :deadhorse:
User avatar
Austin
Former Developer
Posts: 621
Joined: Wed Jan 25, 2006 2:30 am

Re: Ammunition Consumption Bypass

Post by Austin »

https://sourceforge.net/p/mytharria/cod ... atHook.src

Line 177.
function AmmoChecks(byref a_info, byref d_info)


This handles ammo consumption and could be modified to meet the requirements in the thread.
That is unless this is desired to be something implemented for the core's built-in combat functionality.
DevGIB
Grandmaster Poster
Posts: 248
Joined: Mon Feb 06, 2006 6:12 am

Re: Ammunition Consumption Bypass

Post by DevGIB »

my proposal is this

combat pseudo code becomes:

Code: Select all

if( weapon is projectile )
  if( no ammunition hook )
      try to comsume projectile
      if none, exit
   else
       if ammunition hook returns 0 exit
       if ammunition hook returns 1 continue
   endif
endif
hook code could look something similar to

Code: Select all

if(weapon.freefire ==1 || attacker.isA(POLCLASS_NPC))
    return 1;
else
    if( consume(weapon.ammotype) )
        return 1;
    else
        return 0;
    endif
endif
where freefire is a cprop and ammotype is read from the config file.

Ultimately in this hook you could have it consume mana or staminia or tithing points whatever you want.
guialtran
Grandmaster Poster
Posts: 120
Joined: Wed Jul 30, 2008 12:42 pm

Re: Ammunition Consumption Bypass

Post by guialtran »

1 carry out the attack
0 performs the expected consumption in the core
-1 do not carry out the attack
Post Reply