It is currently 20 Jun 2013, 08:38

Post new topic Reply to topic  Page 1 of 3
 [ 23 posts ]  1, 2, 3  

Waterlevel usage + Flags = ?


Author Message
 Post subject: Waterlevel usage + Flags = ?
PostPosted: 08 Dec 2011, 09:20 
Offline
Imp  Teamleader of Team Chimera
User avatar
Joined: 08 Aug 2011, 19:35
Posts: 48
Location: Maine, USA
In my WAD, "Elemental Pain", water-based monsters are granted "powers" or "qualities" in water, but lose them when on land.
Though my idea may seem strange, it is unique to Dooming; environmental factors means everything to the WAD's progress.

Using 'A_JumpIf' with 'waterlevel' seems to be the logical course, but so far... it's not working. I've been having problems with my Decorate.

As soon as I get a chance, I'll copypasta my code so people can better understand my predicament.

Edit:
Here's my code.
I'm Just Your Friendly Neighborhood Chimera, "Ashura".


Top
 Profile  
 
 Post subject: Re: Waterlevel usage + Flags = ?
PostPosted: 09 Dec 2011, 01:12 
Offline
Arachnotron  Really?
User avatar
Joined: 04 Mar 2010, 21:30
Posts: 373
Location: Florida
It's about impossible to figure that out.

Use State Labels instead of offset-based jumps. That will make it much more managable and you'll probably spot the issue yourself.


Top
 Profile  
 
 Post subject: Re: Waterlevel usage + Flags = ?
PostPosted: 09 Dec 2011, 07:43 
Offline
Cyberdemon  Approved Adder
User avatar
Joined: 01 Feb 2011, 20:07
Posts: 882
Is there a particular reason for using the bitshift operator '>>' in this and other similar lines:

Code:
TROO A 0 A_JumpIf(waterlevel >> 1, 4)

Unless I'm missing something here, I think what you're looking for instead is the greater than or equal to operator '>=':

Code:
TROO A 0 A_JumpIf(waterlevel >= 1, 4)


Top
 Profile  
 
 Post subject: Re: Waterlevel usage + Flags = ?
PostPosted: 09 Dec 2011, 21:03 
Offline
Imp  Teamleader of Team Chimera
User avatar
Joined: 08 Aug 2011, 19:35
Posts: 48
Location: Maine, USA
Anybody have any ideas on how to make this work? You know, make monsters gain powers in water, and lose them on land?


Top
 Profile  
 
 Post subject: Re: Waterlevel usage + Flags = ?
PostPosted: 10 Dec 2011, 02:31 
Offline
Arachnotron  Really?
User avatar
Joined: 04 Mar 2010, 21:30
Posts: 373
Location: Florida
Did you even read the messages your topic got? I said you should clean up and make it more readable, and Blue Shadow asked a valid question...


Top
 Profile  
 
 Post subject: Re: Waterlevel usage + Flags = ?
PostPosted: 10 Dec 2011, 17:33 
Offline
Imp  Teamleader of Team Chimera
User avatar
Joined: 08 Aug 2011, 19:35
Posts: 48
Location: Maine, USA
Ceeb wrote:
Did you even read the messages your topic got? I said you should clean up and make it more readable, and Blue Shadow asked a valid question...

@Ceeb
Yes, I read the messages.
Yes, I cleaned it up. I still can't find the problem.

@Blue Shadow
I only used those operators because I assumed that using math in my DECORATE would work. Apparently, I don't know fully how math works in DECORATE. I did try your suggestion, but to no avail.

@Everyone
I was trying for like four hours to fix the problem before I posted my last question.

I'm regrettably stuck.


Top
 Profile  
 
 Post subject: Re: Waterlevel usage + Flags = ?
PostPosted: 10 Dec 2011, 18:41 
Offline
Commander Keen  A rather ghastly dragon
User avatar
Joined: 11 Dec 2009, 20:01
Posts: 2667
For things like this (where you have to check and set flags and things immediately), I recommend leaving it out of the monster iteself, and A_GiveInventory-ing a CustomInventory item that does this stuff in the Use state (with the flags and things to make sure it's used immediately on receipt). It's a LOT cleaner, like that, and you can more easily track how things go.

For example:
Code:
  Use:
    SPRT A 0 A_JumpIf(WaterLevel > 0, "Underwater")
    SPRT A 0 A_ChangeFlag("NoPain", 0)
    Stop
  Underwater:
    SPRT A 0 A_ChangeFlag("NoPain", 1)
    Stop


CustomInventory items like this can be used like subroutines and functions, without messing around with your states.
Currently reading: Blood Ravens, The Dawn of War Omnibus
_________________
Total approved submissions: 78
Total approved updates: 21
Total rejected: 2


Top
 Profile  
 
 Post subject: Re: Waterlevel usage + Flags = ?
PostPosted: 11 Dec 2011, 06:44 
Offline
Cyberdemon  Approved Adder
User avatar
Joined: 01 Feb 2011, 20:07
Posts: 882
I presume that there is water where you encounter this monster. So, make sure the water is "swimmable", because if it's not, the check on waterlevel is pointless here (That's what I found out after some testing. Anybody is free to correct me if I'm wrong).

FYI, I tested the code you posted with my suggested fix and it does work for me - Imp inside water, it becomes tolerent to pain (+NOPAIN). Imp outside water, it behaves as normal.


Top
 Profile  
 
 Post subject: Re: Waterlevel usage + Flags = ?
PostPosted: 11 Dec 2011, 21:03 
Offline
Imp  Teamleader of Team Chimera
User avatar
Joined: 08 Aug 2011, 19:35
Posts: 48
Location: Maine, USA
Blue Shadow wrote:
I presume that there is water where you encounter this monster. So, make sure the water is "swimmable", because if it's not, the check on waterlevel is pointless here (That's what I found out after some testing. Anybody is free to correct me if I'm wrong).

FYI, I tested the code you posted with my suggested fix and it does work for me - Imp inside water, it becomes tolerent to pain (+NOPAIN). Imp outside water, it behaves as normal.

What kind of water are you using?

I'm using the TERRAIN lump for water:
Code:
Terrain Water
{
  Splash        Water
  FootClip      10
  Liquid
}

Am I doing something wrong?


Top
 Profile  
 
 Post subject: Re: Waterlevel usage + Flags = ?
PostPosted: 11 Dec 2011, 22:48 
Offline
Arachnotron  Really?
User avatar
Joined: 04 Mar 2010, 21:30
Posts: 373
Location: Florida
That's not water. That's just a special effect.

You'll need to make actual bodies of swimmable water, using 3D floors. Here is a good place to start.


Top
 Profile  
 
Display posts from previous:  Sort by  

Post new topic Reply to topic  Page 1 of 3
 [ 23 posts ]  1, 2, 3  


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: