Prevent "underwater actors" from moving out of the water?
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
- Tormentor667
- Posts: 13533
- Joined: Wed Jul 16, 2003 3:52 am
- Contact:
Prevent "underwater actors" from moving out of the water?
Another nooby-question I guess: I am using Sharks in BoA that can fly but should not be able to leave the 3d water sectors. How can I prevent them to do this? Or are there any other flags for "swimming in water sectors"?
- Hellser
- Global Moderator
- Posts: 2706
- Joined: Sun Jun 25, 2006 4:43 pm
- Preferred Pronouns: He/Him
- Operating System Version (Optional): Windows 11
- Graphics Processor: ATI/AMD with Vulkan/Metal Support
- Location: Citadel Station
Re: Prevent "underwater actors" from moving out of the water
Hm. There are checks to see if an actor is underwater, but not "keep an actor IN the water" -- could be a feature request?
Re: Prevent "underwater actors" from moving out of the water
I'm interested in this too. Would appreciate it if someone posted a bare-bones example. I see MaxEd achieved this in his Powerslave mod but the WAD is too large-scope for me to quickly inspect (yeah I'm impatient LOL).
- Zanieon
- Posts: 2059
- Joined: Tue Jan 13, 2009 4:13 pm
- Graphics Processor: ATI/AMD with Vulkan/Metal Support
- Location: Somewhere in the future
- Contact:
Re: Prevent "underwater actors" from moving out of the water
in ACS:
in DECORATE:
I didn't tested, write this right now, but the idea is something like this.
Code: Select all
Script "WaterLevelCheck" (Void)
{
While (TRUE)
{
if ( GetActorProperty (0, APROP_Waterlevel) < 3 && GetUserVariable(0, "user_isswimming")==1 )
SetActorState(0, "Swim.Cancel");
else if ( GetActorProperty (0, APROP_Waterlevel) == 3 && GetUserVariable(0, "user_isswimming")==0 )
SetActorState(0, "Swim.Allow");
Delay(1);
}
}
Code: Select all
ACTOR Somerandomshitthatswims
{
var int user_isswimming;
States:
{
Swim.Cancel:
TNT1 A 0 A_ChangeFlag("FLOAT",0)
TNT1 A 0 A_ChangeFlag("NOGRAVITY",0)
TNT1 A 0 A_SetUserVar("user_isswimming",0)
Goto See
Swim.Allow:
TNT1 A 0 A_ChangeFlag("FLOAT",1)
TNT1 A 0 A_ChangeFlag("NOGRAVITY",1)
TNT1 A 0 A_SetUserVar("user_isswimming",1)
Goto See
}
}
- Ozymandias81
- Posts: 2063
- Joined: Thu Jul 04, 2013 8:01 am
- Graphics Processor: nVidia with Vulkan support
- Location: Mount Olympus, Mars
- Contact:
Re: Prevent "underwater actors" from moving out of the water
There is also a much more easy way to fix sharks without using acs. Just give me ten mins and I'll post here.
- Ozymandias81
- Posts: 2063
- Joined: Thu Jul 04, 2013 8:01 am
- Graphics Processor: nVidia with Vulkan support
- Location: Mount Olympus, Mars
- Contact:
Re: Prevent "underwater actors" from moving out of the water
Here you are: add MaxStepHeight 1 to properties. I wasn't on my PC for a while
[EDIT]: I see you've add a missile state inside shark, now I know exactly why you needed it...
Nevermind above stuff.
[EDIT]: I see you've add a missile state inside shark, now I know exactly why you needed it...
Nevermind above stuff.
- Ozymandias81
- Posts: 2063
- Joined: Thu Jul 04, 2013 8:01 am
- Graphics Processor: nVidia with Vulkan support
- Location: Mount Olympus, Mars
- Contact:
Re: Prevent "underwater actors" from moving out of the water
That's the MaxED piranha code, it has some actors inheritances here and there, but everyhting is here.Nash wrote:I'm interested in this too. Would appreciate it if someone posted a bare-bones example. I see MaxEd achieved this in his Powerslave mod but the WAD is too large-scope for me to quickly inspect (yeah I'm impatient LOL).
Spoiler:
- Zanieon
- Posts: 2059
- Joined: Tue Jan 13, 2009 4:13 pm
- Graphics Processor: ATI/AMD with Vulkan/Metal Support
- Location: Somewhere in the future
- Contact:
Re: Prevent "underwater actors" from moving out of the water
The problem there Ozymandias81, the delay to check if the actor is under water is too long and causes a bit of "jumping" out of the water, this behavior is the intention on this mainly because a piranha really behaves as this unlike a shark that stays underwater more often, reducing the check delay on the state would solve the problem but this will go make piles of extra lines in the decorate which isn't necessary if there is a script is running on background to do the job it.
Well decision is up to Torm on what code use, both solves the problem i think (as i said above, i didn't tested mine)
Well decision is up to Torm on what code use, both solves the problem i think (as i said above, i didn't tested mine)
- Ozymandias81
- Posts: 2063
- Joined: Thu Jul 04, 2013 8:01 am
- Graphics Processor: nVidia with Vulkan support
- Location: Mount Olympus, Mars
- Contact:
Re: Prevent "underwater actors" from moving out of the water
I'm OK with you Rev, I tried some odd stuff to see if running continuosly thingthrust while underwater could help, but didn't work unless we have only melee states in it (I mean the shark).Revilution wrote:The problem there Ozymandias81, the delay to check if the actor is under water is too long and causes a bit of "jumping" out of the water, this behavior is the intention on this mainly because a piranha really behaves as this unlike a shark that stays underwater more often, reducing the check delay on the state would solve the problem but this will go make piles of extra lines in the decorate which isn't necessary if there is a script is running on background to do the job it.
Well decision is up to Torm on what code use, both solves the problem i think (as i said above, i didn't tested mine)
The fact is that I have a piranha inside Gore that works exactly like shark one, except that it doesn't have any missiles states that will prevent it to go out of water.
BTW I'll try now your code and if it works I'll ask to Torm to implement on sharks.
Thankx anyway Rev (I'm gonna give a look to your big boss and see if I'm skilled enough to to make/change its not-so-doomish palette into a baron one).
- Ozymandias81
- Posts: 2063
- Joined: Thu Jul 04, 2013 8:01 am
- Graphics Processor: nVidia with Vulkan support
- Location: Mount Olympus, Mars
- Contact:
Re: Prevent "underwater actors" from moving out of the water
While I wasn't capable to implement Rev's code, I've done a silly trick that worked a bit.
Here's the shark code, the trick can be found inside "missile" state:
@Torm
If it works, may I add this stuff?
Here's the shark code, the trick can be found inside "missile" state:
Spoiler:Inspired to maulerdemon attack, the shark can't fly out the water sector, it just "jumps" sometimes like a swimming player.
@Torm
If it works, may I add this stuff?
Re: Prevent "underwater actors" from moving out of the water
TBH (and no offense) this is all really hacky shit and it really should be just be an engine-side flag like +CANTLEAVEWATER or something like that. :S
- Zanieon
- Posts: 2059
- Joined: Tue Jan 13, 2009 4:13 pm
- Graphics Processor: ATI/AMD with Vulkan/Metal Support
- Location: Somewhere in the future
- Contact:
Re: Prevent "underwater actors" from moving out of the water
Hellser wins the match then, lol
- Ozymandias81
- Posts: 2063
- Joined: Thu Jul 04, 2013 8:01 am
- Graphics Processor: nVidia with Vulkan support
- Location: Mount Olympus, Mars
- Contact:
Re: Prevent "underwater actors" from moving out of the water
@nash
Exactly the same I had in my mind while losing time with it
@revilution
Definately
Exactly the same I had in my mind while losing time with it
@revilution
Definately
- Tormentor667
- Posts: 13533
- Joined: Wed Jul 16, 2003 3:52 am
- Contact:
Re: Prevent "underwater actors" from moving out of the water
Yep, I am just gonna request thatNash wrote:TBH (and no offense) this is all really hacky shit and it really should be just be an engine-side flag like +CANTLEAVEWATER or something like that. :S
- Tormentor667
- Posts: 13533
- Joined: Wed Jul 16, 2003 3:52 am
- Contact:
Re: Prevent "underwater actors" from moving out of the water
http://forum.zdoom.org/viewtopic.php?f= ... 88#p823288
Actually not solvable, so we need to continue hacking around -_-
Actually not solvable, so we need to continue hacking around -_-