Placing an object from the inventory to a location
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!)
-
- Posts: 16
- Joined: Mon Mar 04, 2024 11:42 am
- Operating System Version (Optional): Windows 10
- Graphics Processor: nVidia (Modern GZDoom)
Placing an object from the inventory to a location
I have a pedestal next to my portal and want the destination of the portal change based on which item sits on the portal.
A mental check tells me, that i have to place all things that are necessary on the pedestal and depend on their visibility which destination the portal leads to. But how would i do that?
Or is there a special extra for that?
A mental check tells me, that i have to place all things that are necessary on the pedestal and depend on their visibility which destination the portal leads to. But how would i do that?
Or is there a special extra for that?
Re: Placing an object from the inventory to a location
That will require a bit of ACS depending on how your portal works.
For example, if you interact with the pedestal, I would run an ACS script that checks what items the player has using CheckInventory and set a value to a variable.
Then when the player interacts with the portal, instead of making the portal line use teleport actions you can make it run a script that checks the variable and calls different teleport actions depending on it. (You can use any line action in ACS)
Alternatively you can skip the variable completely and make the pedestal change the line's teleport action using SetLineSpecial.
Again, it all depends on how your portal is set up, more context may be needed.
For example, if you interact with the pedestal, I would run an ACS script that checks what items the player has using CheckInventory and set a value to a variable.
Then when the player interacts with the portal, instead of making the portal line use teleport actions you can make it run a script that checks the variable and calls different teleport actions depending on it. (You can use any line action in ACS)
Alternatively you can skip the variable completely and make the pedestal change the line's teleport action using SetLineSpecial.
Again, it all depends on how your portal is set up, more context may be needed.
-
- Posts: 16
- Joined: Mon Mar 04, 2024 11:42 am
- Operating System Version (Optional): Windows 10
- Graphics Processor: nVidia (Modern GZDoom)
Re: Placing an object from the inventory to a location
The portal is a regular line portal and i already use Line_SetPortalTraget somewhere else to change to differentmaps depending on a switch. So i plan on finding different artifacts that you have in your inventory. So you take the item out of the inventory and place it on the pedestal and that triggers the Line_SetPortalTraget. You can see the destination change, as you place the item down. The question is how do i do that with the items? I want them to stand there and when you interact with it the item returns to the inventory.Jarewill wrote: ↑Thu Jun 13, 2024 11:13 am That will require a bit of ACS depending on how your portal works.
For example, if you interact with the pedestal, I would run an ACS script that checks what items the player has using CheckInventory and set a value to a variable.
Then when the player interacts with the portal, instead of making the portal line use teleport actions you can make it run a script that checks the variable and calls different teleport actions depending on it. (You can use any line action in ACS)
Alternatively you can skip the variable completely and make the pedestal change the line's teleport action using SetLineSpecial.
Again, it all depends on how your portal is set up, more context may be needed.
Re: Placing an object from the inventory to a location
How exactly do you want the player to put the items down? Using them from the inventory bar? Opening a menu when interacting with the pedestal?
Give and TakeInventory are going to be useful in removing/giving back the items.
And if you want to display them on the pedestal, I would create a new actor that's invisible by default but has states representing each item. That way you can change the state of that actor in ACS using SetActorState.
Give and TakeInventory are going to be useful in removing/giving back the items.
And if you want to display them on the pedestal, I would create a new actor that's invisible by default but has states representing each item. That way you can change the state of that actor in ACS using SetActorState.
-
- Posts: 16
- Joined: Mon Mar 04, 2024 11:42 am
- Operating System Version (Optional): Windows 10
- Graphics Processor: nVidia (Modern GZDoom)
Re: Placing an object from the inventory to a location
Yes, by using them from the inventory. Like you look at the pedestal and then use the item from the inventory.Jarewill wrote: ↑Thu Jun 13, 2024 12:51 pm How exactly do you want the player to put the items down? Using them from the inventory bar? Opening a menu when interacting with the pedestal?
Give and TakeInventory are going to be useful in removing/giving back the items.
And if you want to display them on the pedestal, I would create a new actor that's invisible by default but has states representing each item. That way you can change the state of that actor in ACS using SetActorState.
Re: Placing an object from the inventory to a location
Here's a quickly thrown together proof of concept:
Those items should have defined a LineId of the line you want to set the portal to as well as a Spawn sprite.
Attached is a demo map with a script and two demo items.
To use it, simply place down the Pedestal actor on your map and create new PedestalItem items.Those items should have defined a LineId of the line you want to set the portal to as well as a Spawn sprite.
Attached is a demo map with a script and two demo items.
-
- Posts: 16
- Joined: Mon Mar 04, 2024 11:42 am
- Operating System Version (Optional): Windows 10
- Graphics Processor: nVidia (Modern GZDoom)
Re: Placing an object from the inventory to a location
It works like a marvel. Thank you. I would've never come up with that solution.Jarewill wrote: ↑Fri Jun 14, 2024 11:31 am Here's a quickly thrown together proof of concept:
Pedestal.wad
To use it, simply place down the Pedestal actor on your map and create new PedestalItem items.
Those items should have defined a LineId of the line you want to set the portal to as well as a Spawn sprite.
Attached is a demo map with a script and two demo items.
-
- Posts: 16
- Joined: Mon Mar 04, 2024 11:42 am
- Operating System Version (Optional): Windows 10
- Graphics Processor: nVidia (Modern GZDoom)
Re: Placing an object from the inventory to a location
Well it works for your version. The thing is it is a bit different for me. So I have the portal with the LineID of 24. I retrieve a fuse and put it into the fuse box that activates the portal. It sets the portal target to 25, which is the default target of the portal and you can't deactivate that portal anymore. SO the next Line ID the portal goes to is by placing that item on it which then should set the Line ID to 26. I tried to figure out which of these zeroes and ones i need to change but no dice. The pedestal placing works.Jarewill wrote: ↑Fri Jun 14, 2024 11:31 am Here's a quickly thrown together proof of concept:
Pedestal.wad
To use it, simply place down the Pedestal actor on your map and create new PedestalItem items.
Those items should have defined a LineId of the line you want to set the portal to as well as a Spawn sprite.
Attached is a demo map with a script and two demo items.
Re: Placing an object from the inventory to a location
I don't quite understand your issue.
Could you post a simple example of how you want it to work?
Could you post a simple example of how you want it to work?
-
- Posts: 16
- Joined: Mon Mar 04, 2024 11:42 am
- Operating System Version (Optional): Windows 10
- Graphics Processor: nVidia (Modern GZDoom)
Re: Placing an object from the inventory to a location
So you have an active portal with lineID 24. That goes by default to line ID 25. That's without any item on the pedestal.
Place an item on it and it switches to the lineID of the item. 26 for example. Take it off and it returns to lineID 25.
Place object with setlineID 27 and it will connect the portal to lineID 27. Take it off and it returns to 25.
The item-menu system already works. I just don't seem to get the IDs right.
Re: Placing an object from the inventory to a location
Okay, I think I understand now.
So in the PedestalSwitch script, you have to change the first parameter (1) to 24, as that's the line you want to change.
Then in the line where the second parameter is 0, you want to change it to 25, as that will be the default line.
And for your items you want to set PedestalItem.LineId to 26 and 27 accordingly.
For more info, check the wiki.
So in the PedestalSwitch script, you have to change the first parameter (1) to 24, as that's the line you want to change.
Then in the line where the second parameter is 0, you want to change it to 25, as that will be the default line.
And for your items you want to set PedestalItem.LineId to 26 and 27 accordingly.
For more info, check the wiki.
-
- Posts: 16
- Joined: Mon Mar 04, 2024 11:42 am
- Operating System Version (Optional): Windows 10
- Graphics Processor: nVidia (Modern GZDoom)
Re: Placing an object from the inventory to a location
It's working. I thought i had to change those other parameters in ZSCript too. It's like everything else. It's so easy, but but only when you know. Thank you. I hope i get it done for RAMP 2024 so you can play it^^.Jarewill wrote: ↑Sun Jun 16, 2024 5:21 am Okay, I think I understand now.
So in the PedestalSwitch script, you have to change the first parameter (1) to 24, as that's the line you want to change.
Then in the line where the second parameter is 0, you want to change it to 25, as that will be the default line.
And for your items you want to set PedestalItem.LineId to 26 and 27 accordingly.
For more info, check the wiki.