Jump to content

Help with In combat auras.


Recommended Posts

Hey if anyone could help me out with this, I'm very new to programming, this is honestly my first experiences with it but I'm currently trying to figure out how to give a character a temporary Sanity aura while in combat, Preferably exclusive to teammates but if not that's okay too I'd learn this myself if i wasn't completely brand new to programming/coding but  i thought i might as well ask for help while i research this sort of thing.

So to reiterate
I'm trying to give my character a Decently strong sanity aura with a moderate radius, for about 10 seconds after combat begins and preferably affects everyone but him. (also contemplating a Defensive buff exclusive to teammates during this time like a mini Wigfrid passive for anyone around him.)

My best bet on what that might be like is something along the lines of maybe if i were to attack something, it activates it for 10 seconds?

Link to comment
Share on other sites

Should there be a cooldown for this aura effect, or should it keep it running for 10 seconds after the battle has ended, or do you have to be out of combat for some time before it can trigger again? Many questions which have a great impact on how this should be implemented.

Link to comment
Share on other sites

I was looking for something that stays active until 10 seconds after the battle ends,
So an aura lasting 10 seconds that refreshes on attack without cooldown (So it can refresh)

The sanity buff is something I'll tweak with and play around with so that it does a moderately nice job at promoting fighting alongside this character as opposed to watching on the side without making it so strong that you'd just nullify sanity auras that are supposed to be a big threat i.e deerclops, shadow pieces or fuel weaver.

Link to comment
Share on other sites

Great! OK, so you specify that it is specifically on attack that it should refresh. So not on getting attacked or on blocking an attack or on taking damage from something arbitrary. It is whenever YOU attack something, and only then?

Link to comment
Share on other sites

On 8/6/2019 at 11:03 AM, Ultroman said:

Great! OK, so you specify that it is specifically on attack that it should refresh. So not on getting attacked or on blocking an attack or on taking damage from something arbitrary. It is whenever YOU attack something, and only then?

Edit: Apologies for the late response, I responded but forgot to quote Sorry!

Uh, i actually hadn't considered that,

But considering that this character has a whole Leader vibe going for him, I feel it should be On his attack, Signifying him taking charge and having the situation under control.

So yeah On him attacking specifically, A Sanity aura and if possible a Minor Defensive buff (Say 10 or 15% Damage reduction) to allies around him both lasting the same 10 second duration without cooldown and without stacking.

Edited by Iceright
Link to comment
Share on other sites

Sorry for the late reply. Real life called. Also, I wanted to do more than just provide an answer, since auras are frequently requested. I wanted to see if I could create a sort of template and then expand upon it to have it solve your particular use case.

Take a look at the new post. Complete code for your particular use case is in the example at the very bottom.

Link to comment
Share on other sites

On 8/11/2019 at 11:39 PM, Ultroman said:

Sorry for the late reply. Real life called. Also, I wanted to do more than just provide an answer, since auras are frequently requested. I wanted to see if I could create a sort of template and then expand upon it to have it solve your particular use case.

Take a look at the new post. Complete code for your particular use case is in the example at the very bottom.

Apologies for the late response on my part too, Same reason as you tbh.

Holy crap! Thank you so much!! it works perfectly! (although i need to look into how I'd set it so that He isn't affected by his own aura but that's honestly not that big of a deal and I'll probs try to figure that one out.) all that's left is to fiddle around with the numbers and i can try and balance this character of mine out, Write the DST specific dialogue and update the mod page on steam. Thank you so freaking much and an even bigger thank you for making it all make coherent sense, I'm having a bit of trouble understanding the code  myself but I'm sure I'll figure things out eventually reaching the point where i could make and write my own stuff from scratch too!

If you're wondering what the mod is or where you'd find it it's Adam, the World Jumper I'll update it with the code after i fix up the dialogue tomorrow and add a couple final little things, such as sanity penalty for hurting Rabbits which i know a couple other mods also have done. (and after that update I'll look into fixing my little Invisible ghost issue.)
That being said I'll make sure to give a big thanks to you on the mod page.

Edited by Iceright
Link to comment
Share on other sites

 

6 hours ago, Iceright said:

i need to look into how I'd set it so that He isn't affected by his own aura but that's honestly not that big of a deal and I'll probs try to figure that one out.

That's super easy. Barely an inconvenience.

Change this code:

-- Apply the aura to any of the found entities within the radius, including the aura-emitting
-- entity itself if it fits the tag-list parameters!
for i, v in ipairs(ents) do
	onApplyAura(v, inst)
end

to this:

-- Apply the aura to any of the found entities within the radius, including the aura-emitting
-- entity itself if it fits the tag-list parameters!
for i, v in ipairs(ents) do
	if v ~= inst then
		onApplyAura(v, inst)
	end
end

And you're welcome :) Godspeed with your mod!

Edited by Ultroman
Link to comment
Share on other sites

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
 Share

×
×
  • Create New...