Prevent "underwater actors" from moving out of the water?

Discuss all aspects of editing for ZDoom.
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.

Prevent "underwater actors" from moving out of the water?

Postby Tormentor667 » Sun Mar 22, 2015 5:56 am

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"?
User avatar
Tormentor667
needs more detail
 
Joined: 16 Jul 2003
Location: Germany

Re: Prevent "underwater actors" from moving out of the water

Postby Hellser » Sun Mar 22, 2015 5:59 am

Hm. There are checks to see if an actor is underwater, but not "keep an actor IN the water" -- could be a feature request?
User avatar
Hellser
Remember Citadel
 
Joined: 25 Jun 2006
Location: Citadel Station
Discord: Hellser#8156
Operating System: Windows 10/8.1/8 64-bit
Graphics Processor: nVidia with Vulkan support

Re: Prevent "underwater actors" from moving out of the water

Postby Nash » Sun Mar 22, 2015 6:46 am

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).
User avatar
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes

Re: Prevent "underwater actors" from moving out of the water

Postby Zanieon » Sun Mar 22, 2015 7:50 am

in ACS:
Code: Select allExpand view
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);
   }
}


in DECORATE:
Code: Select allExpand view
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
   }
}


I didn't tested, write this right now, but the idea is something like this.
User avatar
Zanieon
A Tamer of The Dark
 
Joined: 13 Jan 2009
Location: Somewhere in the future
Discord: Zanieon#3177
Twitch ID: Zanieon
Operating System: Windows 10/8.1/8 64-bit
Graphics Processor: ATI/AMD with Vulkan Support

Re: Prevent "underwater actors" from moving out of the water

Postby Ozymandias81 » Sun Mar 22, 2015 8:57 am

There is also a much more easy way to fix sharks without using acs. Just give me ten mins and I'll post here.
User avatar
Ozymandias81
Doom is a State of Mind... Out of Control.
 
Joined: 04 Jul 2013
Location: Mount Olympus, Mars
Github ID: Ozymandias81
Operating System: Windows Vista/7 64-bit
Graphics Processor: nVidia (Modern GZDoom)

Re: Prevent "underwater actors" from moving out of the water

Postby Ozymandias81 » Sun Mar 22, 2015 9:31 am

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... :roll:
Nevermind above stuff.
User avatar
Ozymandias81
Doom is a State of Mind... Out of Control.
 
Joined: 04 Jul 2013
Location: Mount Olympus, Mars
Github ID: Ozymandias81
Operating System: Windows Vista/7 64-bit
Graphics Processor: nVidia (Modern GZDoom)

Re: Prevent "underwater actors" from moving out of the water

Postby Ozymandias81 » Sun Mar 22, 2015 10:11 am

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).

That's the MaxED piranha code, it has some actors inheritances here and there, but everyhting is here.

Spoiler:
User avatar
Ozymandias81
Doom is a State of Mind... Out of Control.
 
Joined: 04 Jul 2013
Location: Mount Olympus, Mars
Github ID: Ozymandias81
Operating System: Windows Vista/7 64-bit
Graphics Processor: nVidia (Modern GZDoom)

Re: Prevent "underwater actors" from moving out of the water

Postby Zanieon » Sun Mar 22, 2015 10:44 am

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)
User avatar
Zanieon
A Tamer of The Dark
 
Joined: 13 Jan 2009
Location: Somewhere in the future
Discord: Zanieon#3177
Twitch ID: Zanieon
Operating System: Windows 10/8.1/8 64-bit
Graphics Processor: ATI/AMD with Vulkan Support

Re: Prevent "underwater actors" from moving out of the water

Postby Ozymandias81 » Sun Mar 22, 2015 11:18 am

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)

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).
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).
User avatar
Ozymandias81
Doom is a State of Mind... Out of Control.
 
Joined: 04 Jul 2013
Location: Mount Olympus, Mars
Github ID: Ozymandias81
Operating System: Windows Vista/7 64-bit
Graphics Processor: nVidia (Modern GZDoom)

Re: Prevent "underwater actors" from moving out of the water

Postby Ozymandias81 » Sun Mar 22, 2015 12:45 pm

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:

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?
User avatar
Ozymandias81
Doom is a State of Mind... Out of Control.
 
Joined: 04 Jul 2013
Location: Mount Olympus, Mars
Github ID: Ozymandias81
Operating System: Windows Vista/7 64-bit
Graphics Processor: nVidia (Modern GZDoom)

Re: Prevent "underwater actors" from moving out of the water

Postby Nash » Sun Mar 22, 2015 12:47 pm

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
User avatar
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes

Re: Prevent "underwater actors" from moving out of the water

Postby Zanieon » Sun Mar 22, 2015 1:15 pm

Hellser wins the match then, lol
User avatar
Zanieon
A Tamer of The Dark
 
Joined: 13 Jan 2009
Location: Somewhere in the future
Discord: Zanieon#3177
Twitch ID: Zanieon
Operating System: Windows 10/8.1/8 64-bit
Graphics Processor: ATI/AMD with Vulkan Support

Re: Prevent "underwater actors" from moving out of the water

Postby Ozymandias81 » Sun Mar 22, 2015 1:33 pm

@nash
Exactly the same I had in my mind while losing time with it :roll:

@revilution
Definately :lol: :bang: :lol:
User avatar
Ozymandias81
Doom is a State of Mind... Out of Control.
 
Joined: 04 Jul 2013
Location: Mount Olympus, Mars
Github ID: Ozymandias81
Operating System: Windows Vista/7 64-bit
Graphics Processor: nVidia (Modern GZDoom)

Re: Prevent "underwater actors" from moving out of the water

Postby Tormentor667 » Sun Mar 22, 2015 4:53 pm

Nash 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

Yep, I am just gonna request that :)
User avatar
Tormentor667
needs more detail
 
Joined: 16 Jul 2003
Location: Germany

Re: Prevent "underwater actors" from moving out of the water

Postby Tormentor667 » Mon Mar 23, 2015 6:17 am

viewtopic.php?f=15&t=48160&p=823288#p823288
Actually not solvable, so we need to continue hacking around -_-
User avatar
Tormentor667
needs more detail
 
Joined: 16 Jul 2003
Location: Germany

Next

Return to Editing (Archive)

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 2 guests