Jump to content

Recommended Posts

Posted

I am making a mod that in effect lets a player wear multiple armor sets, Ideally I want this to work "out of the box" with other mods. Right now I have it so on each armor tick of my mod's armor it loops through the armor sets swaping them out on the player and calling their armor tick methods, and eventually putting my mod armor back on. This works fine for tick based things but a lot of armor sets do stuff based on forge events not just ticks.

 

So my idea for how to handle this:

copy of original health and armor damage values
for each event that fires for the player
   put a copy of one of the sets on the player
   do the necessary steps to create this event for the player with the alternate set
   if player is wearing the first set
      copy player health and all armor damages
   if player health is more than copy
       copy player health and all damage value
   set player health and all armor damages to original
put the original armor set back on.
set player health and damage values to copy

theoretically this results in the best outcome among the armor sets

 

I should mention that there is a fairly large energy cost required for any of this to run and the cost grows exponentially for each additional armor set, a single user will likely not use more than 2 or 3.

 

 

I will be working on implementing this but it would be nice to know if this idea is even plausible or if I need to stop and figure out a different way.

 

Edit1:an example of necessary steps to fire an event

for LivingHurtEvent

attack the target(player) from damage source(source)

which would set off a new chain of events but wouldn't create a loop

because my event catch wouldn't trigger because the player isn't wearing my mod armor

 

Edit2: slight update to idea

 

 

 

Current Project: Armerger 

Planned mods: Light Drafter  | Ore Swords

Looking for help getting a mod off the ground? Coding  | Textures

Posted

Do all your magic inside extendedproperties for the player.

 

I'm still not sure I understand why to do this.

Long time Bukkit & Forge Programmer

Happy to try and help

Posted

If you are not sure why "I" want to do this it is, one example is thaumcrafts goggles of revealing, being able to see nodes and still have a decent helmet for protection.

 

Do you know of any decent tutorials for using extendedproperties? I haven't touched those yet.

Current Project: Armerger 

Planned mods: Light Drafter  | Ore Swords

Looking for help getting a mod off the ground? Coding  | Textures

Posted

using IEEP wont help. seriously.

My opinion, and I might be wrong, is that what you are triing to do might end in processor murder.

My idea. You need to fire the living hurt event again by yourself for every piece/set of armor. After that evaluate the results and think how you want to handle the damage taken, because some armors totally absorb damage(blood magic?) , so you see okay one result says no damage, so I wont let the player gain ANY damage.

 

For every other event it should work to fire the event again with the new set of armor equipped. But I tell you there are cases where this can cause REALLY strange effects.

 

Feel free to correct me, I can be wrong.

Posted

Those types of things are what i was suggesting he put inside the IEEP.  He will probably need to keep track of some variables and he will already have the structure for storage at that point.

Long time Bukkit & Forge Programmer

Happy to try and help

Posted

you want to save how much damage he took or what? you cant do that because the result of the damage you get may change (energy empty no quantum suit, no blood in ur network? goodbye bloodmagic)

Posted

@delpi I can find tutorials just fine, I was asking because the best tutorials don't always make it to the top and you might know of a better one.

 

@Failender Unfortunately I think I agree that this might simply be too much going on in too short a time and cause horrid tick lag.

 

I updated the original posted to better clarify my idea(i had forgotten to put a part)

Current Project: Armerger 

Planned mods: Light Drafter  | Ore Swords

Looking for help getting a mod off the ground? Coding  | Textures

Posted

i cant tell you how to fire it, got no IDE here, but you can find it out yourself. just create a living hurt event and say open call hierachy ( right mouse button on the method? Im not sure google it) then you can see how forge fires the event.

the event itself should not damage the entity ( I think) so there shouldnt be a problem firing it 1000000 times ;)

Posted

I was planning on doing more than just fire the event, I was planning to duplicate? the event.

 

As the Player being hit

If I was attacked by an arrow and had the full mod set on

I would then get hit by that arrow while wearing each of the armor sets

and my health would get set back to the version that was the most beneficial.

 

So it's like that one attack got split and attacked an identical player with each of the armor sets and

the one that faired the best is the one that the original player gets set to.

 

Actually I just realized that I probably need to make a full copy of the player, not just their health, otherwise they might get sent flying pretty far backwards or accidentally be murdered and suddenly get health back.

Current Project: Armerger 

Planned mods: Light Drafter  | Ore Swords

Looking for help getting a mod off the ground? Coding  | Textures

Posted

fire the event again == duplicate

 

no need to do that. the event itself is NOT damaging the player. it is just telling everyone hey look this guy got hurt, do you want to do anything about it? after the event is fired you should be able to look into the result and see the value of damage they should have taken. save that fire the event with the next armor set. check the results. decide which one you want to keep

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.