Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ON=@DAMAGE together with CAN_I_DAMAGEABLE #1260

Open
GladieUO opened this issue Jul 5, 2024 · 9 comments
Open

ON=@DAMAGE together with CAN_I_DAMAGEABLE #1260

GladieUO opened this issue Jul 5, 2024 · 9 comments

Comments

@GladieUO
Copy link
Contributor

GladieUO commented Jul 5, 2024

So the problem is If we do damage on the item with flag CAN_I_DAMAGEABLE, the trigger fires, but since this flag is using HITS and MAXHITS, and not MORE1L and MORE1H, it will not inflict any damage on that item.

Maybe it is connected also to the problem #1259. I think ideally the @damage lowering HITS for items with CAN_I_DAMAGEABLE, should also start the status bar update.

I was trying to inspect the CItem.cpp -> CItem::OnTakeDamage and CCItemDamageable.cpp, and I think it should be possible in CItem.cpp add check if the item is not any of the defined types, and has the CAN flag, use the hits and maxhits using the CCItemDamageable.cpp ?

@Tolokio
Copy link
Contributor

Tolokio commented Jul 15, 2024

hits and maxhits is a way to call more1l and more1h. LEts me explore but I think the fix is easy. Can you give me the script u are using to test?

image

This is not true. Atilla is right. tested

image

Havent test it, but if u are right and damage fires @itemdamage. only wereables will be damaged in that trigger.

Anyway u can deal with it by script, this way.

on=@damage
if (<can>&can_i_damageable)
    Hits -=<argn1>
endif

if anyone wants a fix by source:
image
I dont know how to call this functions from CItem without setting a pointer in CItem for CCItemDamageable*
I dont know this system anyway.

image

@GladieUO
Copy link
Contributor Author

GladieUO commented Jul 15, 2024

Its basically item (no weareble like armor, weapon or other types that have defined hits/maxhits for them) with can=can_i_damageable (lets say crystal that is attr_static)
Then you try to trigger @damage lets say after @dclick -> damage x,y,z, it triggers @damage, but dont deal any damage, since I believe someone who made this flag forgot, that hits/maxhits are not supported for non wearebles. (inside the @damage trigger)
For some reason @itemdamage is not even called, I dont think its finished fully.

Yes, right now im using just hits -=xy, but then there comes another issue, which is my second PR, and the fact that the hitbar / statusbar of the item is not being updated after that. The two issues might be maybe connected, or there was missing function being called that I added.

I quickly tried to summarize quote to your post. I hope it helps.

@Tolokio
Copy link
Contributor

Tolokio commented Jul 16, 2024

I dont know the state of the system right now. I tried to attack items but dosnt work. Anyone knows the state of the feature?

@GladieUO
Copy link
Contributor Author

GladieUO commented Jul 16, 2024

I dont know the state of the system right now. I tried to attack items but dosnt work. Anyone knows the state of the feature?

Its working up to the dealing dmg.

  1. items placed on the ground with hits and maxhits can have status bar pulled out and you can see actual health
  2. damaging them by the .damage 5 doesnt work
  3. works only if you make a workaround, something like hits -=5 after @dclick for example
  4. But with workaround, the status bar will not update automatically

Potential Solution:

  1. Include other items not necessary wearables, but with flag can_i_damageable in the trigger @damage, so it looks for hits and maxhits (and not for more1l and more1h)
  2. Either use my PR for the status updating, or include this function somewhere else, so that the status bars gets updated after the damage is dealt. (OnTickStatsUpdate();)
    2.1 - this function should be called once the damage is dealth through @damage trigger
    2.2 - this function should be called once the damage is done by other way, for example hits -=5

@Tolokio
Copy link
Contributor

Tolokio commented Jul 16, 2024

But can the player "attack" the item using the normal combat system?

I don't know how it is right now. Should explosions damage those items?
There are a lot of questions to solve before getting to that part you propose. I would like to know the entire design or at least how it should work.

@GladieUO
Copy link
Contributor Author

From what I understand and it was mentioned some time ago by someone from devs, the "attack" part is up to the user to handle it by the script.
To make it easier I think the @damage should work. If not, atleast the status bar updating once hits manually changed should work.
Thats all I know.

@Tolokio
Copy link
Contributor

Tolokio commented Jul 16, 2024

Handled by script? I don't know how it should work on OSI, but yes, you can create a primitive system by script, I think. Is there any guide or info about how the system has been designed? I can't find anything solid.

Should the system work as if you attack that rat in the picture, showing the life? I don't know how to do that by script.
image

@GladieUO
Copy link
Contributor Author

GladieUO commented Jul 16, 2024

This is all that the flag does.
Takes hits and maxhits, and allows you to drag the status bar, as it was the player. Everything after that, is up to the user to script.
Dclick or spell on the status bar does nothing and I dont think its scripted in CORE.
https://i.gyazo.com/b2425d98b4b427488c58fb6c9989598e.mp4

@GladieUO
Copy link
Contributor Author

GladieUO commented Aug 14, 2024

This problem is slightly different then updating status bar with can_i_damageable.
Trigger @damage is being fired once we damage the item by script, but since can_i_damageable is using maxhits and hits, instead of MORE1L and MORE1H, the damage is not passed or used in the @damage trigger (trigger looks for MORE1, MORE2 etc...).
When creating the item with the flag and maxhits / hits, we have a console warning about setting hits and maxhits on item thats not suppose to have it.

I think the problem is that if the item is not wearable, the system dont expect that.

The workaround is lowering/increasing hits or maxhits manually by scripts. (HITS -=5)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants