Page 857 of 972

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

Posted: Wed Mar 15, 2017 7:04 pm
by Matt
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!

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

Posted: Wed Mar 15, 2017 8:30 pm
by phil_56
@Gez
Gez wrote:The tics

Code: Select all

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

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

Posted: Thu Mar 16, 2017 3:30 am
by ZZYZX
Hello so I got some esoteric problems here.
I'm trying to do 16:9 SetHudSize, and using this code:

Code: Select all

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

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

Posted: Thu Mar 16, 2017 5:27 am
by ZZYZX
Actually it seems his 1366x768 is actually 1366x706. GetScreenWidth and GetScreenHeight return 1366x768, BUT THE REAL RESOLUTION IS NOT THAT. How?

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

Posted: Thu Mar 16, 2017 7:41 am
by Gez
1360x765 is a real 16:9 resolution, 1366x768 is an approximation.

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

Posted: Thu Mar 16, 2017 7:51 am
by ZZYZX
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.

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

Posted: Thu Mar 16, 2017 9:25 am
by LanHikariDS

Code: Select all

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.

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

Posted: Thu Mar 16, 2017 7:06 pm
by Elias79
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 all

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 all

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 all

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 all

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.

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

Posted: Thu Mar 16, 2017 9:37 pm
by Not Jabba
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?

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

Posted: Thu Mar 16, 2017 9:44 pm
by worldendDominator
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 all

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.

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

Posted: Thu Mar 16, 2017 10:44 pm
by Not Jabba
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 all

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.

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

Posted: Thu Mar 16, 2017 11:00 pm
by Blue Shadow
Not all powerups work on monsters. I guess PowerSpeed is one of them.

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

Posted: Thu Mar 16, 2017 11:09 pm
by Not Jabba
If so, is there any other way to make the temporary speed effect work in Decorate?

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

Posted: Fri Mar 17, 2017 12:46 am
by Mav3r1ck
How do I make reflective flats (most notably liquids) though GLDEFS or Shaders. I'm using a PK3 file.

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

Posted: Fri Mar 17, 2017 12:55 am
by Nevander
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 [wiki]Sector_SetPlaneReflection[/wiki].