Ammunition Consumption Bypass
Ammunition Consumption Bypass
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.
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.
Re: Ammunition Consumption Bypass
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.
Re: Ammunition Consumption Bypass
I think the flag and the hook, are 2 very good ideas.
Unfortunately I can not score both.
I think it's a good idea , 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 , but many will use it and thank
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.
Unfortunately I can not score both.
I think it's a good idea , 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 , but many will use it and thank
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.
Re: Ammunition Consumption Bypass
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.
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.
Re: Ammunition Consumption Bypass
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.
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.
Re: Ammunition Consumption Bypass
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.
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.
Re: Ammunition Consumption Bypass
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.
Re: Ammunition Consumption Bypass
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
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
Re: Ammunition Consumption Bypass
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"
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"
Re: Ammunition Consumption Bypass
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.
Dunno what you'd do about negative numbers. Either add ammo...? or just say it's 0 ammo used.
Re: Ammunition Consumption Bypass
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 .
My translator is autistic today
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 .
My translator is autistic today
Re: Ammunition Consumption Bypass
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.
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.
Re: Ammunition Consumption Bypass
my proposal is this
combat pseudo code becomes:
hook code could look something similar to
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.
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
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
Ultimately in this hook you could have it consume mana or staminia or tithing points whatever you want.
Re: Ammunition Consumption Bypass
1 carry out the attack
0 performs the expected consumption in the core
-1 do not carry out the attack
0 performs the expected consumption in the core
-1 do not carry out the attack