[ZScript] Replicating A_RadiusGive functionality

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

[ZScript] Replicating A_RadiusGive functionality

Postby Virathas » Tue Feb 23, 2021 5:54 am

Hey,

I've been thinking lately how to replicate A_RadiusGive function, to add my own limits/parameters, and perform additional operation on successfully given item. For instance, having an AoE given Immolation debuff, that deals damage over time, and stacks with each other, so each inventory item needs to have a source pointer. Or simply an AoE granted slow, where i test for special flags of an actor, if a target is immune or not.

I believe this should be done with iterators (maybe even ActorIterators), but I wasn't really able to fully understand how to do so "the good way", as in many places i read that they are resource intensive, and are fairly dangerous to stability.

So the question is - How would one go working on such Iterators to replicate that function?
User avatar
Virathas
 
Joined: 10 Aug 2017

Re: [ZScript] Replicating A_RadiusGive functionality

Postby Jarewill » Tue Feb 23, 2021 6:01 am

This example by Cherno might be of use to you.
Jarewill
 
 
 
Joined: 21 Jul 2019

Re: [ZScript] Replicating A_RadiusGive functionality

Postby Virathas » Tue Feb 23, 2021 6:32 am

That will come in handy!
Yet the followup question remains:
If this function is called repeatedly, will it impact performance? I believe I read somewhere, that iterators, once created, remain permanently until they are manually removed.
User avatar
Virathas
 
Joined: 10 Aug 2017

Re: [ZScript] Replicating A_RadiusGive functionality

Postby Jarewill » Tue Feb 23, 2021 8:01 am

Unsure about that.
But I have implemented that example into my mod and it's being called every tic by the most common enemy in the game and I didn't notice any performance issues, neither did those get reported to me.
Jarewill
 
 
 
Joined: 21 Jul 2019

Re: [ZScript] Replicating A_RadiusGive functionality

Postby Virathas » Tue Feb 23, 2021 9:07 am

Now THAT is good enough for me, thanks a ton! :)
User avatar
Virathas
 
Joined: 10 Aug 2017


Return to Scripting

Who is online

Users browsing this forum: JohnnyTheWolf, Player701 and 1 guest