Random Editing Questions

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.

Re: Random Editing Questions

Postby amv2k9 » Mon Apr 16, 2012 4:13 pm

Eh, it's still not working. I removed the semicolons from the if statements and added in a 1-tic delay right before the last restart.
Last edited by amv2k9 on Mon Apr 16, 2012 5:32 pm, edited 1 time in total.
User avatar
amv2k9
Satanic Redux, Order & Chaos, Mutation, and Weapons of Rebellion Series Dev
 
Joined: 10 Jan 2010
Location: Southern California

Re: Random Editing Questions

Postby FDARI » Mon Apr 16, 2012 4:39 pm

Maybe you should print PLAYER_TID to verify it. You didn't try to set the player's tid in the map editor, did you? (The tid of the startspot doesn't affect the tid of the spawned player, you must set it in script)

Besides, in an enter-script you should be using tid 0 for efficiency and simplicity, as well as CheckInventory rather than CheckActorInventory. (Roughly same as CheckActorInventory with tid 0)

Another discovery: You'll never get anything but less than 40 the way your checks are organised. Whenever the value is less than 30, it will already have triggered and restarted at "less than 40". You'll need to reverse them if you want to use that approach. (Check for less than 10 first, then less than 20...)
Spoiler: My own version
If you're loading it as a library, don't forget the loadacs lump.
User avatar
FDARI
Bronies eunt domus
 
Joined: 03 Nov 2009

Re: Random Editing Questions

Postby amv2k9 » Mon Apr 16, 2012 5:31 pm

FDARI wrote:Maybe you should print PLAYER_TID to verify it. You didn't try to set the player's tid in the map editor, did you? (The tid of the startspot doesn't affect the tid of the spawned player, you must set it in script)
No, I didn't set the player's tid in a map editor. Other scripts use PLAYER_TID and work just fine... But I'll try that just in case.
Besides, in an enter-script you should be using tid 0 for efficiency and simplicity, as well as CheckInventory rather than CheckActorInventory. (Roughly same as CheckActorInventory with tid 0)
CheckInventory would work okay with this? I didn't think it would, since its an enter-type script.
Another discovery: You'll never get anything but less than 40 the way your checks are organised. Whenever the value is less than 30, it will already have triggered and restarted at "less than 40". You'll need to reverse them if you want to use that approach.(Check for less than 10 first, then less than 20...)
Yeah, I thought this had to be set up like how you would check for inventory in DECORATE; you check for the largest at-least value first.
Spoiler: My own version
I'm a big user of switches. Using a series of if-statements is perfectly fine as well.
Thanks a lot for this! I'll be sure to study it so I can correct these kind of things earlier in the future :)
User avatar
amv2k9
Satanic Redux, Order & Chaos, Mutation, and Weapons of Rebellion Series Dev
 
Joined: 10 Jan 2010
Location: Southern California

Re: Random Editing Questions

Postby FDARI » Tue Apr 17, 2012 1:44 am

"No, I didn't set the player's tid in a map editor. Other scripts use PLAYER_TID and work just fine... But I'll try that just in case."
Slightly confusing. What did you do to set the player's tid? Perhaps you did not do anything. PLAYER_TID is just the name of a variable, or a number. You create that number, and you provide its actual meaning. To make it meaningful for your purpose, you must cause the player to have PLAYER_TID as its tid. However, you don't need to use it at all as long as you know the script is activated by the player. (ENTER is always activated by each player.)

Use TID 0 in functions that support it.
Use functions that affect the activator where there are multiple variants. (CheckInventory, CheckActorInventory)

Decorate versus ACS (check order): -- Do not worry if this confuses you, it is somewhat poorly worded --
A_JumpIfInventory("item", x, "state") compares to if (CheckInventory("x) >= x) { SetActorState(0, "state", false); }
Note: The check is variable >= control_value, not variable < control_value. When you are checking for greater values, using the lowest threshold first makes the higher thresholds irrelevant. When checking for smaller values, using the highest threshold first makes the lower thresholds irrelevant. Any occurence that could trigger a later condition, will also trigger the very first condition. Decorate inventory checks do not allow you to check for less inventory, only equal/more.

Spoiler: Read if the above was confusing
User avatar
FDARI
Bronies eunt domus
 
Joined: 03 Nov 2009

Re: Random Editing Questions

Postby amv2k9 » Mon Apr 30, 2012 5:39 pm

Thanks for the help, FDARI!

ALrighty, next question:

I'm making a weapon that launches multiple remote-detonated stickymines. Basically how it works right now is the mine has +SEEKERMISSILE, and its death state is a loop where it alternates between checking for a token item held by the player (if true, it then jumps to a state where it explodes) and calling A_Fire, which allows it to "adhere" to a monster's collison box. The problem is... this weapon fires multiple mines, and when you fire them at a monster, even if only some of them would impact the monster, they ALL adhere to the monster, in the same spot. At first I thought some of them were disappearing, but that appears to not be the case; I did a little test where the mines had dynamic lights. The resulting dynamic light was very strong and had a very fine edge instead of fading out slowly, telling me all the dynamic lights were in the same xyz coordinates in relation to the monster's collison box.

...So, can I get these mines to adhere to different places on a monster's collison box?
User avatar
amv2k9
Satanic Redux, Order & Chaos, Mutation, and Weapons of Rebellion Series Dev
 
Joined: 10 Jan 2010
Location: Southern California

Re: Random Editing Questions

Postby FDARI » Tue May 01, 2012 1:53 am

I'd check out A_Warp, which is written to be a general purpose A_Fire. If you store an angle in a user variable on the mine, you should be able to warp the sticky mine to a specific position on the victim. A_Warp will not determine the correct distance from the monster, though, so you might have to make an initial A_Fire call to get into position, if that function knows a monster's radius.

A fully functional thing isn't the simplest, so I'll provide a potentially helpful code fragment.
Spoiler: It could might work
User avatar
FDARI
Bronies eunt domus
 
Joined: 03 Nov 2009

Re: Random Editing Questions

Postby amv2k9 » Tue May 01, 2012 5:17 pm

Actually, I remembered about A_Warp a while after I made that post, and I got it working! But this code you gave me looks very interesting as well. I'll have to give it a shot. Thanks!
User avatar
amv2k9
Satanic Redux, Order & Chaos, Mutation, and Weapons of Rebellion Series Dev
 
Joined: 10 Jan 2010
Location: Southern California

Re: Random Editing Questions

Postby amv2k9 » Mon Jun 04, 2012 5:34 pm

For something I'm working on, I need an action function that jumps if the player has the calling actor in view within a specified FOV cone. Now, I already looked at A_JumpIfTargetInLOS and A_JumpIfInTargetLOS, and unless I'm reading them wrong, these aren't what I need. Anyone able to clarify?
Last edited by amv2k9 on Mon Jun 04, 2012 7:37 pm, edited 1 time in total.
User avatar
amv2k9
Satanic Redux, Order & Chaos, Mutation, and Weapons of Rebellion Series Dev
 
Joined: 10 Jan 2010
Location: Southern California

Re: Random Editing Questions

Postby NeuralStunner » Mon Jun 04, 2012 7:30 pm

I don't even know what you just said, so I can't say for sure unless you give a step-by-step of what you're looking for.
User avatar
NeuralStunner
O'Neill with it.
 
Joined: 21 Jul 2009
Location: The Colonies

Re: Random Editing Questions

Postby amv2k9 » Mon Jun 04, 2012 7:45 pm

Lemme see if I can explain it better.

Basically, this is for weapon pickups that, when you're close enough and looking directly at it (or within a couple of degrees of directly), spawn an actor above the pickup, telling you the weapon properties. Once you're looking away, that window goes away.

Like this:
http://i.ytimg.com/vi/_y3QkAKmAhU/0.jpg
User avatar
amv2k9
Satanic Redux, Order & Chaos, Mutation, and Weapons of Rebellion Series Dev
 
Joined: 10 Jan 2010
Location: Southern California

Re: Random Editing Questions

Postby FDARI » Tue Jun 05, 2012 5:17 am

I think you may need to go this route:
Code: Select allExpand view
actor BaseNotifyPickup : Inventory // You may want to inherit from CustomInventory for greater flexibility
{
    var int user_pnum;

    states
    {
        spawn: // you should provide a different spawn state
            tnt1 a 1
        checkNextPlayer:
            "####" "#" 0 A_RearrangePointers(AAPTR_PLAYER1<<user_pnum)
            "####" "#" 0 A_SetUserVar("user_pnum", (user_pnum < 7) * (user_pnum + 1))
            "####" "#" 0 A_JumpIfTargetInLOS("notify", 9, JLOSF_TARGETLOS|JLOSF_DEADNOJUMP) // deadnojump isn't required, max distance isn't specified, fov is 9 degrees
            "####" "#" 0 A_JumpIf(true, "spawn")
        notify:
            "####" "#" 0 a_spawnitemex("defaultNotificationActorIfYouHaveOne_orMaybeYouWouldNotDefineThisStateInTheBaseActor")
            "####" "#" 0 A_JumpIf(true, "spawn")
            stop     
    }
}
Code: Select allExpand view
actor ExampleNotifyPickup : BaseNotifyPickup
{
    states
    {
        notify:
           "####" "#" 0 a_custommissile("notifyExample") // There are many ways to spawn an actor; this is just provided as an alternate suggestion
        spawn:
            ITEM A 1 A_JumpIf(user_pnum, "checkNextPlayer") // First spawn: No action. Later iterations: Check players 2-8 and then wait 1 tick
            goto checkNextPlayer // check player 1, which will eventually return to the spawn state
    }
}

actor LaxNotifyPickup : BaseNotifyPickup
{
    states
    {
        notify:
            "####" "#" 0 a_facetarget
            "####" "#" 0 a_spawnitemex("laxNotifier") // this is the function I think you'll be using
        spawn:
            ITEM B 1
            goto checkNextPlayer // check 1 player every tick
    }
}
ExampleNotifyPickup checks all players every tick (except for the very first one), while LaxNotifyPickup checks one player each tick (not the first one), repeating each player every 8 ticks. There is only one state with a non-0 duration here. That duration must be at least 1, but can be higher. Whatever delay you set here will be between each player (Lax) or between each check of all players (the first example).

Does this work?
User avatar
FDARI
Bronies eunt domus
 
Joined: 03 Nov 2009

Re: Random Editing Questions

Postby amv2k9 » Tue Jun 05, 2012 12:37 pm

I'll have to give this a try. Thanks a lot!

See the thing was is, I wasn't sure if inventory actors have the player as their target. Hence the confusion over what action function I'd need.
User avatar
amv2k9
Satanic Redux, Order & Chaos, Mutation, and Weapons of Rebellion Series Dev
 
Joined: 10 Jan 2010
Location: Southern California

Re: Random Editing Questions

Postby amv2k9 » Fri Jun 29, 2012 3:18 pm

Where is Strife's base HUD defined? I looked in the sbarinfo folder, and there isn't a file for it. Then I looked through the Strife IWAD, thinking that it might be defined there (like part of Hexen's is) but it's not there either. I'm trying to make new versions of the dropdown questlog, keys and stats windows that Strife has.
User avatar
amv2k9
Satanic Redux, Order & Chaos, Mutation, and Weapons of Rebellion Series Dev
 
Joined: 10 Jan 2010
Location: Southern California

Re: Random Editing Questions

Postby ChronoSeth » Sat Jun 30, 2012 12:06 am

IIRC, it's not defined. SBARINFO isn't quite flexible enough to do everything that the HUD does yet.
User avatar
ChronoSeth
You are totally unique... just like everyone else.
 
Joined: 05 Jul 2010

Re: Random Editing Questions

Postby amv2k9 » Sun Jul 22, 2012 5:02 pm

Having a problem with a friendly monster in a project I'm working on. I've narrowed it down to the following; if the monster is killed when its in an attack state, it crashes the game. I've tried some tweaks to the code, but nothing seems to solve the problem.

Spoiler:


Here's the whole actor entry:
Spoiler:
User avatar
amv2k9
Satanic Redux, Order & Chaos, Mutation, and Weapons of Rebellion Series Dev
 
Joined: 10 Jan 2010
Location: Southern California

PreviousNext

Return to Editing

Who is online

Users browsing this forum: Ed the Bat, Peanut and 6 guests