The "How do I..." Thread

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: The "How do I..." Thread

Postby Matt » Wed Mar 15, 2017 8:04 pm

TheArcticWolf wrote:In Half Life, the HECU Marine standard behaviour is basically this:
    Wander on normal speed/stay in place until a target is in range and view.
    If target is seen and is in range open fire until it's out of range or view.
    If target is out of range run towards it (different speed).
    If target is behind cover, throw a grenade. If other marines are near, "flank it" running towards it.
    If severly hurt fall back towards "cover" or nearest friendly.
Want to know if anyone has done something like it or is possible.
Also, what about shooting while moving?

All possible with ZScript now...

Open fire until out of range or view / chase if out of range: Pretty straightforward DECORATE jumps can do this.

Behind cover throw grenade: Will need some more LOF checks at indirect angles just to make sure the grenade isn't thrown in some suspension-of-disbelief-breakingly idiotic way, but can be done - just a matter of "do I want to spend my next 3 weekends working out the glitches?" and "Can we be sure there won't be enough of these guys on a map at once to cause performance issues?".

If other marines near, flank: I was never able to work out flanking without ZScript, but the imps in Hideous Destructor now always attempt to flank by default whether there's backup or not. (the trick is to set a separate hate target actor, put it in a position that would cause the monster to flank the real target, then temporarily swapping one for the other while calling your chase function.)

If hurt, fall back: Running away is simple enough, and if you can get flanking to work then moving towards a friendly should generally be workable I think, though remembering where "back towards cover" was and finding a path to it is a whole new ballgame!
User avatar
Matt
Putting the XD into *xdeath since 2007
 
Joined: 04 Jan 2004
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia

Re: The "How do I..." Thread

Postby phil_56 » Wed Mar 15, 2017 9:30 pm

@Gez
Gez wrote:The tics

Code: Select allExpand view
Rest1:
      CAS2 I -1


Also don't use TNT1 when you don't want your actor to be invisible.


Thank you all, it worked perfectly! :D
phil_56
 
Joined: 13 Mar 2017
Discord: 12345

Re: The "How do I..." Thread

Postby ZZYZX » Thu Mar 16, 2017 4:30 am

Hello so I got some esoteric problems here.
I'm trying to do 16:9 SetHudSize, and using this code:
Code: Select allExpand view
#library "MAPTITLE"
#include "zcommon.acs"

function int MAKE_ID(int a, int b, int c, int d)
{
   return (a<<24)|(b<<16)|(c<<8)|d;
}

script "MAPTITLE" ENTER
{
   SetHudSize(640, 480, true);
   
   int not43 = FixedDiv(GetScreenWidth()<<16, GetScreenHeight()<<16);
   if (not43 != 1.33333)
   {
      // scale
      not43 -= 1.33333;
      not43 /= 2;
      not43 += 1.33333;
   }
   int Xoffs = ((FixedMul(480.0, not43))-4.0)&0xFFFF0000;
   
   SetFont("SMALLFONT");
   HudMessage(s:"THE CURRENT MAP IS"; HUDMSG_PLAIN|HUDMSG_NOTWITHFULLMAP|HUDMSG_NOTWITHOVERLAYMAP, MAKE_ID('C','M','A','P'), CR_DARKRED, Xoffs+0.2, 4.1, 0.029);
   SetFont("BIGFONT");
   HudMessage(n:PRINTNAME_LEVEL, s:" - ", n:PRINTNAME_LEVELNAME; HUDMSG_PLAIN|HUDMSG_NOTWITHFULLMAP|HUDMSG_NOTWITHOVERLAYMAP, MAKE_ID('C','M','A','T'), CR_GOLD, Xoffs+0.2, 12.1, 0.029);

   Delay(1);
   restart;
}


Now, for me it looks like this: http://i.imgur.com/nMV9Aa1.png
Everything is correct at any resolution, it always sticks to the right edge.

But for another guy it looks like this: http://i.imgur.com/DAzpCOa.png
He doesn't seem to have any aspect ratio forcing or anything, yet it's offset.
Same resolution.

What can be wrong here?
It's verified to not be a problem with GZDoom versions, because it works the same on ancient february 2.4-pre and 2.5-pre as well as mine (one of the latest 2.4 devbuilds).
User avatar
ZZYZX
le chat du rabbin
 
 
 
Joined: 14 Oct 2012
Location: Ukraine

Re: The "How do I..." Thread

Postby ZZYZX » Thu Mar 16, 2017 6:27 am

Actually it seems his 1366x768 is actually 1366x706. GetScreenWidth and GetScreenHeight return 1366x768, BUT THE REAL RESOLUTION IS NOT THAT. How?
User avatar
ZZYZX
le chat du rabbin
 
 
 
Joined: 14 Oct 2012
Location: Ukraine

Re: The "How do I..." Thread

Postby Gez » Thu Mar 16, 2017 8:41 am

1360x765 is a real 16:9 resolution, 1366x768 is an approximation.
Gez
 
 
 
Joined: 06 Jul 2007

Re: The "How do I..." Thread

Postby ZZYZX » Thu Mar 16, 2017 8:51 am

It's actually a bug that GZDoom doesn't scale 4:3 HUD correctly with arbitrary windowed mode window sizes. I reported that on Mantis.
User avatar
ZZYZX
le chat du rabbin
 
 
 
Joined: 14 Oct 2012
Location: Ukraine

Re: The "How do I..." Thread

Postby LanHikariDS » Thu Mar 16, 2017 10:25 am

Code: Select allExpand view
ACTOR Fire : MorphProjectile
{
  Radius 18
  Height 80
  +Bright
  +IsMonster
  +Invulnerable
  -NoTeleport
  -NoBlockMap
  -Missile
  Damage 1
  MorphProjectile.PlayerClass "InfectedPlayer"
  RenderStyle Add
  States
  {
  Spawn:
    FIRE A 0 A_PlaySound (Crackle, 0, 92, 1)
   FIRE A 0 A_ChangeFlag (IsMonster, 0)
    FIRE AABBCCDDEEFFGGHHIIJJKKLLMMNN 1 A_Warp (AAPTR_MASTER, 0, 0, 0, 0, WARPF_NOCHECKPOSITION)
    Loop
   }
}

Current Status above.
Still not warping to the player in Zandronum, but I'm continuing on regardless. Now trying to get any player that touches the fire to become an InfectedPlayer (The class that spawns the fire to follow them), however when running into the fire (Spawned via console, if that's an issue), the player simply ignores it, and remains a DoomPlayer. The MISSILE flag is removed, as Fire refuses to spawn otherwise, with the new inheritance.
User avatar
LanHikariDS
Some people call these demons, I call them bitches.
 
Joined: 05 Aug 2015
Location: Playing in the snow

Re: The "How do I..." Thread

Postby Elias79 » Thu Mar 16, 2017 8:06 pm

How do i prevent homing missiles homing in on the player.

I did not really know how to make "spell" attacks so i just tested it attached directly to the melee punch in the Player.txt file:
Code: Select allExpand view
Punch:
        PLA1 H 1
      NULL A 0 A_SpawnItemEx("MagicAttack", 0, 0, 0)   
      //NULL A 0 HealThing(-1, 1)
      NULL A 0 A_JumpIfHealthLower(2, "Death.Fire")
        NULL A 0 HealThing(-1, 1)
      NULL A 0 A_TakeInventory("Punching", 1)
      NULL A 7

That spawn this actor:
Code: Select allExpand view
Actor MagicAttack 15004 // summon MagicAttack
{
   +NOGRAVITY
   +NOBLOCKMAP
   +Missile
   +FORCEXYBILLBOARD      
    +SEEKERMISSILE
   +RIPPER   
    +FLOAT
    +DROPOFF
   Health 1
   Damage 100
   Renderstyle add
   Scale 0.1
   states
     {
     Spawn:
        TNT1 A 1
        SPKO A 1 A_SpawnItemEx("UserSpawner1", 0, -75, 40, 0, -9, 0, -90)
        TNT1 A 1
        /*TNT1 A 0       
        SPKO A 1 A_SpawnItemEx("UserSpawner1", -1, -50, 40, 0, -9, 0, -85)
        TNT1 A 0       
        SPKO A 1 A_SpawnItemEx("UserSpawner1", 1, -50, 40, 0, -9, 0, -95)
        TNT1 A 0*/
     Death:
        stop
     }
}

That spawns this projectile spawner:
Code: Select allExpand view
Actor UserSpawner1 15001 // summon UserSpawner1
{   
  +NOGRAVITY
  +NOBLOCKMAP
  +THRUACTORS
  +FORCEXYBILLBOARD
  +TOUCHY   
  +RIPPER
  +SEEKERMISSILE
  +FLOAT
  +DROPOFF
  SpawnId 25000
  Speed 3
  Height 5
  Damage 100
  Renderstyle add
  Scale 0.1
  var int user_test;
  var int user_angle;
  var int user_pitch;
  var int user_times;
    States
   {
   Spawn:
      TNT1 A 0
      SPKO A 1 A_SeekerMissile(45, 90, SMF_LOOK | SMF_PRECISE, 127, 3)      
      TNT1 A 0 A_SetUserVar("user_test", 0)
      TNT1 A 0 A_SetUserVar("user_angle", 0)
      TNT1 A 0 A_SetUserVar("user_pitch", 0)
      TNT1 A 0 A_SetUserVar("user_times", 0)
      TNT1 A 1 A_JumpIf(user_test == 0, "Setd1")
      TNT1 A 1 A_CustomMissile("Thing1", 0, 0, user_angle, 2, user_pitch)
      stop
   Setd1:      
      TNT1 A 0
      SPKO A 0 A_SeekerMissile(12, 24, SMF_LOOK | SMF_PRECISE, 127, 3)      
      TNT1 A 0 ACS_Execute(15005)
      TNT1 A 0 A_JumpIf(user_test == 1, "Spawn")
      SPKO A 1 A_SeekerMissile(12, 24, SMF_LOOK | SMF_PRECISE, 127, 3)      
      TNT1 A 0 ACS_Execute(15005)   
      TNT1 A 0 A_SetUserVar("user_times", user_times + 1)
      SPKO A 0 A_SeekerMissile(12, 24, SMF_LOOK | SMF_PRECISE, 127, 3)      
      TNT1 A 0 ACS_Execute(15005)         
      TNT1 A 0 A_SetUserVar("user_angle", 0)
      SPKO A 0 A_SeekerMissile(12, 24, SMF_LOOK | SMF_PRECISE, 127, 3)      
      TNT1 A 0 ACS_Execute(15005)   
      TNT1 A 0 A_SetUserVar("user_pitch", 90)
      SPKO A 1 A_SeekerMissile(12, 24, SMF_LOOK | SMF_PRECISE, 127, 3)      
      TNT1 A 0 ACS_Execute(15005)               
      SPKO A 0 A_CustomMissile("Thing1", 0, 0, user_angle, 2, user_pitch)
      SPKO A 0 A_SeekerMissile(12, 24, SMF_LOOK | SMF_PRECISE, 127, 3)      
      TNT1 A 0   
   Right:
      SPKO A 0 A_SeekerMissile(45, 90, SMF_LOOK | SMF_PRECISE, 127, 3)      
      TNT1 A 0 ACS_Execute(15005)
      TNT1 A 0 A_SetUserVar("user_pitch", user_pitch - 19)
      SPKO A 1 A_SeekerMissile(12, 24, SMF_LOOK | SMF_PRECISE, 127, 3)      
      TNT1 A 0 ACS_Execute(15005)   
      TNT1 A 0 A_SetUserVar("user_times", user_times + 1)
      SPKO A 0 A_SeekerMissile(12, 24, SMF_LOOK | SMF_PRECISE, 127, 3)      
      TNT1 A 0 ACS_Execute(15005)            
      SPKO A 1 A_CustomMissile("Thing1", 0, 0, user_angle, 2, user_pitch)
      SPKO A 0 A_SeekerMissile(12, 24, SMF_LOOK | SMF_PRECISE, 127, 3)      
      TNT1 A 0 ACS_Execute(15005)   
      TNT1 A 0 A_JumpIf(user_pitch <= -71, "Setd2")
      SPKO A 0 A_SeekerMissile(12, 24, SMF_LOOK | SMF_PRECISE, 127, 3)      
      TNT1 A 0 ACS_Execute(15005)   
      loop         
   Setd2:
      SPKO A 0 A_SeekerMissile(12, 24, SMF_LOOK | SMF_PRECISE, 127, 3)      
      TNT1 A 0
      TNT1 A 0 A_JumpIf(user_test == 1, "Spawn")
      SPKO A 1 A_SeekerMissile(12, 24, SMF_LOOK | SMF_PRECISE, 127, 3)      
      TNT1 A 0      
      TNT1 A 0 A_SetUserVar("user_times", user_times + 1)
      SPKO A 0 A_SeekerMissile(12, 24, SMF_LOOK | SMF_PRECISE, 127, 3)      
      TNT1 A 0      
      TNT1 A 0 A_SetUserVar("user_angle", 180)
      SPKO A 0 A_SeekerMissile(12, 24, SMF_LOOK | SMF_PRECISE, 127, 3)      
      TNT1 A 0   
      TNT1 A 0 A_SetUserVar("user_pitch", -90)
      SPKO A 0 A_SeekerMissile(12, 24, SMF_LOOK | SMF_PRECISE, 127, 3)      
      TNT1 A 0            
      SPKO A 1 A_CustomMissile("Thing1", 0, 0, user_angle, 2, user_pitch)
   Left:
      SPKO A 0 A_SeekerMissile(12, 24, SMF_LOOK | SMF_PRECISE, 127, 3)      
      TNT1 A 0 ACS_Execute(15005)
      TNT1 A 0 A_SetUserVar("user_pitch", user_pitch + 19)
      SPKO A 0 A_SeekerMissile(12, 24, SMF_LOOK | SMF_PRECISE, 127, 3)      
      TNT1 A 0 ACS_Execute(15005)      
      TNT1 A 0 A_SetUserVar("user_times", user_times + 1)
      SPKO A 0 A_SeekerMissile(12, 24, SMF_LOOK | SMF_PRECISE, 127, 3)      
      TNT1 A 0 ACS_Execute(15005)         
      SPKO A 1 A_CustomMissile("Thing1", 0, 0, user_angle, 2, user_pitch)
      SPKO A 0 A_SeekerMissile(12, 24, SMF_LOOK | SMF_PRECISE, 127, 3)      
      TNT1 A 0 ACS_Execute(15005)      
      TNT1 A 0 A_JumpIf(user_pitch >= 71, "Setd1")
      SPKO A 0 A_SeekerMissile(12, 24, SMF_LOOK | SMF_PRECISE, 127, 3)      
      TNT1 A 0 ACS_Execute(15005)   
      TNT1 A 0 A_JumpIf(user_times >= 90, "RandomExp")
      SPKO A 0 A_SeekerMissile(12, 24, SMF_LOOK | SMF_PRECISE, 127, 3)      
      TNT1 A 0 ACS_Execute(15005)   
      loop
   RandomExp:
      TNT1 A 0 A_Playsound("SPIRACT")
      TNT1 A 0 A_Explode(50, 50)
      TNT1 A 0 A_SetUserVar("user_times", user_times + 1)   
      SPKO A 0 A_CustomMissile("Thing1", 0, -15, Random (0 ,360), 2, Random (0 ,360))      
      SPKO A 0 A_CustomMissile("Thing1", 0, -25, Random (0 ,360), 2, Random (0 ,360))
      SPKO A 0 A_CustomMissile("Thing1", 0, -35, Random (0 ,360), 2, Random (0 ,360))
      TNT1 A 0 A_JumpIf(user_times >= 100, "Death")
      loop
   Death:      
      TNT1 A 1 A_Explode(50, 50)
      stop
   }
}

That spawns a bunch of these but they home on in the player so i need a way to prevent that.
Code: Select allExpand view
ACTOR Thing1
{
 speed 1
 //mass 1
 +NoGravity
 //+FLOAT
 Gravity 1.0
 //Friction 1.0
 +Missile
 +FORCEXYBILLBOARD
 Scale 0.05
 +DOOMBOUNCE
 +DONTSPLASH
 +RIPPER
 +NoBlockMap
 +SEEKERMISSILE
 +FRIENDLY
 //+THRUACTORS
 BounceFactor 1
 Health 1
 Damage 2
 alpha 1.0
 renderstyle Add
 var int user_times;
 var int user_dmg;
   states
   {
   Spawn:
      TNT1 A 0
      SPKO A 0 A_SeekerMissile(12, 24, SMF_LOOK | SMF_PRECISE, 64, 1)   
      TNT1 A 0 A_SetUserVar("user_times", 0)
      SPKO A 0 A_SeekerMissile(12, 24, SMF_LOOK | SMF_PRECISE, 64, 1)
      TNT1 A 0 A_SetUserVar("user_dmg", 80)
      SPKO A 0 A_SeekerMissile(12, 24, SMF_LOOK | SMF_PRECISE, 64, 1)      
      TNT1 A 1 A_Playsound("SPIRACT")
      SPKO A 0 A_SeekerMissile(12, 24, SMF_LOOK | SMF_PRECISE, 64, 1)
   Fire:
      TNT1 A 0
      SPKO A 0 A_SeekerMissile(45, 90, SMF_LOOK | SMF_PRECISE, 64, 1)
      TNT1 A 0 A_SetUserVar("user_times", user_times + 1)
      SPKO A 0 A_SeekerMissile(45, 90, SMF_LOOK | SMF_PRECISE, 64, 1)
      SPKO A 1 Bright A_Explode(user_dmg, 3)
      SPKO A 0 A_SeekerMissile(45, 90, SMF_LOOK | SMF_PRECISE, 64, 1)      
      TNT1 A 0 A_SetUserVar("user_dmg", user_dmg - 1)
      SPKO A 0 A_SeekerMissile(45, 90, SMF_LOOK | SMF_PRECISE, 64, 1)
      TNT1 A 0 A_JumpIf(user_times == 40, "Death")
      SPKO A 0 A_SeekerMissile(45, 90, SMF_LOOK | SMF_PRECISE, 64, 1)
      loop
   Death:
      TNT1 A 1 A_Explode(3, 3)
      stop
   }
}

I would also like to know if it is possible to restrict the homing in target to a specific type or species, or by excluding a certain monster or player class, TID id would only work for one player so it's not a good solution, and i have not figured out how to give a tid to the projectile spawner either as i wanted to guide the userspawner1 with acs by messaging its height over the floor to prevent it crashing into it if possible, as a side not these projectiles can't be manually aimed up or down yet.
Elias79
 
Joined: 30 Jan 2017

Re: The "How do I..." Thread

Postby Not Jabba » Thu Mar 16, 2017 10:37 pm

Hey all,

I'm trying to create a monster that randomly gets speed boosts for a few seconds every once in awhile. I'm aware that you can give powerups to monsters, so I thought it would be pretty easy -- just call A_Jump with a small chance of occurrence during the See state, jump to a state that gives a monster my custom PowerupGiver, and have that PowerupGiver automatically grant the Speed powerup.

It doesn't seem to work though. I've confirmed that my setup works with powerups like Ghost, but it doesn't seem to work with Speed. Any idea why, or how to fix it?
Not Jabba
 
Joined: 01 Jun 2008

Re: The "How do I..." Thread

Postby worldendDominator » Thu Mar 16, 2017 10:44 pm

Elias79 wrote:I would also like to know if it is possible to restrict the homing in target to a specific type or species, or by excluding a certain monster or player class, TID id would only work for one player so it's not a good solution, and i have not figured out how to give a tid to the projectile spawner either as i wanted to guide the userspawner1 with acs by messaging its height over the floor to prevent it crashing into it if possible, as a side not these projectiles can't be manually aimed up or down yet.

+DONTSEEK on the player actor will disable homing for all projectiles if that's what you want.

If you want to do this with with a specific projectile, you can try something like this:
Code: Select allExpand view
Spawn:
    TNT1 A 0 A_CheckProximity("NoHoming",
                              "PlayerPawn", // Or whatever class you don't want to track
                              1, // Or another suitably low value
                              1,
                              CPXF_ANCESTOR,
                              AAPTR_TRACER)
SpawnLoop:
    // Do the tracking stuff
    Loop
NoHoming:
    // Don't do the tracking stuff
    Loop


Not Jabba wrote:I'm trying to create a monster that randomly gets speed boosts for a few seconds every once in awhile. I'm aware that you can give powerups to monsters, so I thought it would be pretty easy -- just call A_Jump with a small chance of occurrence during the See state, jump to a state that gives a monster my custom PowerupGiver, and have that PowerupGiver automatically grant the Speed powerup.

It doesn't seem to work though. I've confirmed that my setup works with powerups like Ghost, but it doesn't seem to work with Speed. Any idea why, or how to fix it?

Show us your code. Both the monster and the powerup.
User avatar
worldendDominator
 
Joined: 17 May 2015

Re: The "How do I..." Thread

Postby Not Jabba » Thu Mar 16, 2017 11:44 pm

worldendDominator wrote:
Not Jabba wrote:I'm trying to create a monster that randomly gets speed boosts for a few seconds every once in awhile. I'm aware that you can give powerups to monsters, so I thought it would be pretty easy -- just call A_Jump with a small chance of occurrence during the See state, jump to a state that gives a monster my custom PowerupGiver, and have that PowerupGiver automatically grant the Speed powerup.

It doesn't seem to work though. I've confirmed that my setup works with powerups like Ghost, but it doesn't seem to work with Speed. Any idea why, or how to fix it?

Show us your code. Both the monster and the powerup.


Sure, fair enough. Here's the relevant parts:

Code: Select allExpand view
See:
    BCHR A 0 A_Jump (50, "SpeedBurst")
    BCHR AABB 3 A_Chase
    BCHR C 0 A_PlaySoundEx("Butcher/Step", "SoundSlot7", 0)
    BCHR CCDD 3 A_Chase
    BCHR A 0 A_PlaySoundEx("Butcher/Step", "SoundSlot7", 0)
    Loop
SpeedBurst:
    BCHR A 0 A_GiveInventory ("KeeperBurstGiver")
    Goto See

ACTOR PowerKeeperSpeedBurst : PowerSpeed
{
  Powerup.Duration -8
  Speed 36
}

ACTOR KeeperBurstGiver : PowerupGiver
{
  +INVENTORY.AUTOACTIVATE
  Powerup.Type "PowerKeeperSpeedBurst"
  States
  {
  Spawn:
    TNT1 A -1
    Stop
  }
}


Again, this setup works if I substitute "Ghost" as the powerup type, but it doesn't seem to do anything with either the standard Speed powerup or with my custom variant.
Not Jabba
 
Joined: 01 Jun 2008

Re: The "How do I..." Thread

Postby Blue Shadow » Fri Mar 17, 2017 12:00 am

Not all powerups work on monsters. I guess PowerSpeed is one of them.
User avatar
Blue Shadow
 
 
 
Joined: 14 Nov 2010
Operating System: Windows 10/8.1/8 64-bit
Graphics Processor: ATI/AMD (Modern GZDoom)

Re: The "How do I..." Thread

Postby Not Jabba » Fri Mar 17, 2017 12:09 am

If so, is there any other way to make the temporary speed effect work in Decorate?
Not Jabba
 
Joined: 01 Jun 2008

Re: The "How do I..." Thread

Postby Mav3r1ck » Fri Mar 17, 2017 1:46 am

How do I make reflective flats (most notably liquids) though GLDEFS or Shaders. I'm using a PK3 file.
User avatar
Mav3r1ck
 
Joined: 17 Jul 2015

Re: The "How do I..." Thread

Postby Nevander » Fri Mar 17, 2017 1:55 am

Mav3r1ck wrote:How do I make reflective flats (most notably liquids) though GLDEFS or Shaders. I'm using a PK3 file.

Through GLDEFS or Shaders I'm not sure, but there is Sector_SetPlaneReflection.
Nevander
Self-Banned User
 
Joined: 06 Jan 2014

PreviousNext

Return to Editing (Archive)

Who is online

Users browsing this forum: No registered users and 0 guests