Magnet items (how can i do it?)
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.
Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
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.
Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Magnet items (how can i do it?)
So..i wanted to know how to make an item go to the player if he is close to it. Something like the health pickups in Doom eternal or 2016 after you do a glory kill. I´ve seen mods that have this feature but i don't remember which mods were.
Re: Magnet items (how can i do it?)
Using ZScript you can detect if a player is nearby and make the item move towards the player.
Example code:
Example code:
Spoiler:
Re: Magnet items (how can i do it?)
Sorry i don't know how to use Zscript, i only know how to use decorate. Hmmm could you edit the zscript file inside the .pk3? inside you'll find the armor bonus item and you can use the default doom player, i'll make sure to add you to the credits if i post my mod later this yearJarewill wrote:Using ZScript you can detect if a player is nearby and make the item move towards the player.
Example code:Spoiler:
the item: https://www.mediafire.com/file/03ulyem7 ... r.pk3/file
Re: Magnet items (how can i do it?)
Here you go.
I edited the item inside ZScript to look and function like your armor pickup.
I also included a MAPINFO file with editor number definition, because that's the only way to assign those numbers in ZScript.
There's just one small problem with this:
The item will only move horizontally and not vertically, but I have no idea how to fix it.
Someone more skilled in trigonometry might be able to help here.
Edit: Forgot to actually include the file.
I edited the item inside ZScript to look and function like your armor pickup.
I also included a MAPINFO file with editor number definition, because that's the only way to assign those numbers in ZScript.
There's just one small problem with this:
The item will only move horizontally and not vertically, but I have no idea how to fix it.
Someone more skilled in trigonometry might be able to help here.
Edit: Forgot to actually include the file.
- Attachments
-
Smallarmor.pk3
- (12.23 KiB) Downloaded 55 times
Re: Magnet items (how can i do it?)
Thank you very much! don't worry about the vertically movementJarewill wrote:Here you go.
I edited the item inside ZScript to look and function like your armor pickup.
I also included a MAPINFO file with editor number definition, because that's the only way to assign those numbers in ZScript.
There's just one small problem with this:
The item will only move horizontally and not vertically, but I have no idea how to fix it.
Someone more skilled in trigonometry might be able to help here.
Edit: Forgot to actually include the file.

EDIT: hmm i can't find the item on ultimate doom builder to place it somewhere in a map
Re: Magnet items (how can i do it?)
Right, I forgot.
First you will have to include gzdoom.pk3 in UDB.
To do that, first open your map.
In the resource menu as you open the map, you should add a new resource:

Then specify it to be a .pk3 and navigate to your gzdoom.pk3 file:

And lastly make sure to exclude it from the game itself:

Hope this helps.
First you will have to include gzdoom.pk3 in UDB.
To do that, first open your map.
In the resource menu as you open the map, you should add a new resource:

Then specify it to be a .pk3 and navigate to your gzdoom.pk3 file:

And lastly make sure to exclude it from the game itself:

Hope this helps.
Re: Magnet items (how can i do it?)
it works thank you very much!Jarewill wrote:Right, I forgot.
First you will have to include gzdoom.pk3 in UDB.
To do that, first open your map.
In the resource menu as you open the map, you should add a new resource:
Then specify it to be a .pk3 and navigate to your gzdoom.pk3 file:
And lastly make sure to exclude it from the game itself:
Hope this helps.
- Leglock
- Posts: 88
- Joined: Sat Mar 02, 2019 2:04 pm
- Graphics Processor: ATI/AMD with Vulkan/Metal Support
Re: Magnet items (how can i do it?)
Sorry for the late bump, I´ve been looking for somthing like this as an "universal pick up drops" (Not static items like keys and ammo/health placed in the map, just enemy drops).
I never tried before scripting in Zscript, I know before I jump into this, I should read the tutotials. But I want to ask if this, or a modified version of this script could work as a universal add on for must mods, like nashgore, damnums or ucminimap.
I´m really looking for something like this to cut down unnecesary grind time collecting pick ups in some mods that, otherwise, they are a blast.
Re: Magnet items (how can i do it?)
That can be possible using event handlers and inventory items with custom logic.
Example:
Example:
- Attachments
-
ItemGlide.wad
- (741 Bytes) Downloaded 80 times
- Leglock
- Posts: 88
- Joined: Sat Mar 02, 2019 2:04 pm
- Graphics Processor: ATI/AMD with Vulkan/Metal Support
Re: Magnet items (how can i do it?)
I will check it out this weekend.Jarewill wrote: ↑Tue Apr 18, 2023 1:09 pm That can be possible using event handlers and inventory items with custom logic.
Example:
Thanks for the fast replay!