ZScript: Monster Who You Can Command [UNRESOLVED/WIP]

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!
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!)
Post Reply
Psychojack88
Posts: 54
Joined: Sat May 07, 2022 10:12 pm
Graphics Processor: nVidia (Modern GZDoom)

ZScript: Monster Who You Can Command [UNRESOLVED/WIP]

Post by Psychojack88 »

I am working on a potential update for my Daisy Eternal mod, specifically commands. I was able to get basic randomized interactions working when you are close to her, but want to upgrade into something that really cooks for custom monsters when from a distance.

Ideally, I would like to make it based on certain parameters in Zscript. Note that I'm putting steps to break down the code logic in a way that I can figure out on my own in case all steps can't be answered here. Any progress is a win in my book for this to potentially work. The first 2 are the most important for this to work. Any help will be greatly appreciated.

FOUNDATION
1. When the player points at her relative area, when you press "Use" button she enters a "Command State", pretty much an "Idle"/"Wait for player input" state (This is KEY for everything else to work, so I'm good with just having this foundation for now. If anyone knows or has a potential clue as to how to make this work please feel free to add to the discussion no matter how small it may seem).

2. If the player clicks nothing for 5-10 seconds (or whatever number of "tics", she breaks out of "Command" state. This is a failsafe to prevent her from being eternally stuck in the "Command" state. (This is KEY before everything else.)

ESSENTIAL FEATURE
3. When you point somewhere else while she is in the "Command" state and click a location with the "Use" button, she goes to that relative area. (Does anyone know any RTS Doom wads that do this already with Zscript/Decorate? If anything it might help here because the discipline is the same as an RTS in a way.)

3. If an enemy/target is nearby, she gets back to "See" state to attack normally.

OPTIONAL/AMBITIOUS/POTENTIALLY UNREALISTIC FEATURE

4. If an item is nearby she picks it and the player gets it, serving as an extension of the player. (This is OPTIONAL for now, just an ambition I have in mind but don't know if this is realistic due to potential issues with Custom WADS, Assets or Actors. Feel free to tell me if this is unrealistic so that I can scrap it and move on from here.)
User avatar
fakemai
Posts: 408
Joined: Mon Feb 12, 2018 12:26 am
Location: Australia

Re: ZScript: Monster Who You Can Command [UNRESOLVED/WIP]

Post by fakemai »

I am not actually sure if you can determine when the player presses use generally without modifying the player and you don't want to do that, but what you can do is make a custom key binding that can trigger stuff in NetworkProcess, you have an event handler in your mod, it's another function for those. Incidentally so is WorldLoaded, which is a better way of spawning her in than using ACS.
All the stuff about event handlers is here, you already use one.
KEYCONF addmenukey "Daisy Command" "netevent DE_Command" for example.
This'll be your go-to for figuring out what a player is looking at.
Post Reply

Return to “Scripting”