The "How do I..." Thread

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
User avatar
cocka
Posts: 1520
Joined: Sat Jul 02, 2011 7:21 am
Location: Hungary

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

Post by cocka »

Please bear in mind that the function won't return the first power of the number.

If kitevo (power in Hungarian) is 1, the result will be second power of the given number.

Code: Select all

int eredmeny = FixedMul(alap, alap);
So 1 will represent the second power of the number.
2 the 3., 3 the 4. etc..

You can solve this problem with an extra if condition in the function.
User avatar
MadTux
Posts: 40
Joined: Wed Apr 02, 2014 7:50 am

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

Post by MadTux »

New "How do I?":
Is there a way for a new actor to replace two weapons? I have a new weapon, and I want it to replace the Chainsaw and the SSG :?
User avatar
Mikk-
Posts: 2274
Joined: Tue Jun 30, 2009 1:31 pm

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

Post by Mikk- »

Would this work? Uses the [wiki]WeaponGiver[/wiki] actor.

Code: Select all

ACTOR NewWeapon replaces Chainsaw
{
	[Your code goes here]
}

ACTOR NewWeapon2 : WeaponGiver replaces Supershotgun
{
	DropItem "NewWeapon"
	States
	{
	Spawn:
		GUN1 A -1
		stop
	}
}
User avatar
MadTux
Posts: 40
Joined: Wed Apr 02, 2014 7:50 am

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

Post by MadTux »

Ah -- didn't know about that one. It seems to work perfectly. Thanks.
User avatar
SouthernLion
Posts: 776
Joined: Wed Aug 21, 2013 6:45 pm

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

Post by SouthernLion »

cocka wrote:
how do I make it so that both have to die for the event to unfold?
It depends. Basically there are two ways to do that.

1. Assign the same tid for each of the monsters and an event (a script).

Example:

Code: Select all

if(!ThingCount(T_NONE, <yourmonsters' tid>))
{
 // something will happen
}
2. Assign the same tid for each of the monsters, BUT now place a line or a "thing executed special" next to the place where you have the monsters and invoke the event with that line/object.

Example:

Code: Select all

until(!ThingCount(T_NONE, <yourmonsters' tid>))
{
  delay(3);
}
// then do something else
OR you can also use

Code: Select all

while(ThingCount(T_NONE, <yourmonsters' tid>))
. That's all.

The second option is archiproof therefore it's better when there might be some resurrected monsters.
I'm not getting it to work. I have both zombies set as tag "4" and the sector to open as a door is "5". Then, this is my script for my level:

Code: Select all

#include "zcommon.acs"

script 1 ENTER
{
    Scroll_Floor (2, 0, -20, 2);
} 

script 2 ENTER
{
    if(!ThingCount(T_NONE, 4))
    {
    Door_Open(5,50);
    }
}
Am I failing at coding correctly?
User avatar
cocka
Posts: 1520
Joined: Sat Jul 02, 2011 7:21 am
Location: Hungary

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

Post by cocka »

Am I failing at coding correctly?
Yes, you are.

Code: Select all

script 2 ENTER
Why do you want to start the script right at the loading of the map?! You have to assign an event (ACS_Execute) to the tagged monsters.

Use script 2 (void) or (int tid, int tag) instead and make sure you have set the script for the tagged monsters.

Not the player but the monster has to be the activator!

Your script can be interpreted like this:

Right at the beginning of the map let's count how many monsters there are with tag 4. Well, you'll get a number greater than 0. So your if condition will be false and nothing will happen.
User avatar
SouthernLion
Posts: 776
Joined: Wed Aug 21, 2013 6:45 pm

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

Post by SouthernLion »

cocka wrote:
Am I failing at coding correctly?
Yes, you are.

Code: Select all

script 2 ENTER
Why do you want to start the script right at the loading of the map?! You have to assign an event (ACS_Execute) to the tagged monsters.

Use script 2 (void) or (int tid, int tag) instead and make sure you have set the script for the tagged monsters.

Not the player but the monster has to be the activator!


Your script can be interpreted like this:

Right at the beginning of the map let's count how many monsters there are with tag 4. Well, you'll get a number greater than 0. So your if condition will be false and nothing will happen.
Can you elaborate on what you mean by that?

EDIT: NVM, I just got it to work. Ty for the help, I'm still new to code. lol
User avatar
xenoxols
Posts: 2134
Joined: Mon Mar 18, 2013 6:08 pm
Preferred Pronouns: She/Her
Location: Behind you

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

Post by xenoxols »

No matter what I do, I cant seem to get this projectile to drop.

Code: Select all

actor holywater
{
    +FORCEXYBILLBOARD
	-nogravity	
	+LOOKALLAROUND
	+RIPPER
	-Randomize
	Radius 11
	Height 8
	Speed 15
	Scale 1
	Damage (2)
	Gravity 2.00
	Projectile
	states
	{
	spawn: 
		HPP4 A 1
		loop
	death:
		TNT1 A 0 a_playsound ("subweapons/holywaterhit")
		HFIR A 3 bright A_Explode(70,120,120)
		HFIR B 3 bright A_Explode(70,120,120)
		HFIR C 3 bright A_Explode(70,120,120)
		HFIR D 3 bright A_Explode(70,120,120)
		HFIR C 3 bright A_Explode(70,120,120)
		HFIR B 3 bright A_Explode(70,120,120)
		HFIR A 3 bright A_Explode(70,120,120)
		stop
	Crash:
		TNT1 A 0 a_playsound ("subweapons/holywaterhit")
		HFIR A 3 bright A_Explode(70,120,120)
		HFIR B 3 bright A_Explode(70,120,120)
		HFIR C 3 bright A_Explode(70,120,120)
		HFIR D 3 bright A_Explode(70,120,120)
		HFIR C 3 bright A_Explode(70,120,120)
		HFIR B 3 bright A_Explode(70,120,120)
		HFIR A 3 bright A_Explode(70,120,120)
		stop
	xdeath:
		TNT1 A 0 a_playsound ("subweapons/holywaterhit")
		HFIR A 3 bright A_Explode(70,120,120)
		HFIR B 3 bright A_Explode(70,120,120)
		HFIR C 3 bright A_Explode(70,120,120)
		HFIR D 3 bright A_Explode(70,120,120)
		HFIR C 3 bright A_Explode(70,120,120)
		HFIR B 3 bright A_Explode(70,120,120)
		HFIR A 3 bright A_Explode(70,120,120)			
		stop
		}
}
Gez
 
 
Posts: 17946
Joined: Fri Jul 06, 2007 3:22 pm

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

Post by Gez »

xenoxols wrote:No matter what I do, I cant seem to get this projectile to drop.
Put the Projectile combo before the flags.

DECORATE parsing is done linearly. If two or more lines conflict, the last one wins. So if you have the following sequence:

Code: Select all

-NOGRAVITY
+NOGRAVITY
It is the last line which wins.

[wiki=Actor properties#Projectile]Projectile[/wiki] gives a set of flags, among which is NOGRAVITY. Since it is placed after your -NOGRAVITY line, it wins, and your missile has +NOGRAVITY set.
User avatar
xenoxols
Posts: 2134
Joined: Mon Mar 18, 2013 6:08 pm
Preferred Pronouns: She/Her
Location: Behind you

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

Post by xenoxols »

Thanks gez, that works, however A_Explode doesn't appear to be doing anything.
Updated Code.

Code: Select all

actor holywater
{
	Projectile
    +FORCEXYBILLBOARD
	-nogravity	
	+LOOKALLAROUND
	+RIPPER
	-Randomize
	-Solid
	Radius 11
	Height 8
	Speed 12
	Scale 1
	Damage (6)
	Gravity 0.80
	states
	{
	spawn: 
		HPP4 A 1
		loop
	death:
		TNT1 A 0 a_playsound ("subweapons/holywaterhit")
		HFIR A 3 bright A_Explode(20,120,120)
		HFIR B 3 bright A_Explode(10,120,120)
		HFIR C 3 bright A_Explode(20,120,120)
		HFIR D 3 bright A_Explode(10,120,120)
		HFIR C 3 bright A_Explode(20,120,120)
		HFIR B 3 bright A_Explode(10,120,120)
		HFIR A 3 bright A_Explode(20,120,120)
		stop
	Crash:
		TNT1 A 0 a_playsound ("subweapons/holywaterhit")
		HFIR A 3 bright A_Explode(20,120,120)
		HFIR B 3 bright A_Explode(10,120,120)
		HFIR C 3 bright A_Explode(20,120,120)
		HFIR D 3 bright A_Explode(10,120,120)
		HFIR C 3 bright A_Explode(20,120,120)
		HFIR B 3 bright A_Explode(10,120,120)
		HFIR A 3 bright A_Explode(20,120,120)
		stop
	xdeath:
		TNT1 A 0 a_playsound ("subweapons/holywaterhit")
		HFIR A 3 bright A_Explode(20,120,120)
		HFIR B 3 bright A_Explode(10,120,120)
		HFIR C 3 bright A_Explode(20,120,120)
		HFIR D 3 bright A_Explode(10,120,120)
		HFIR C 3 bright A_Explode(20,120,120)
		HFIR B 3 bright A_Explode(10,120,120)
		HFIR A 3 bright A_Explode(20,120,120)			
		stop
		}
}
User avatar
jpalomo
Posts: 772
Joined: Mon May 17, 2010 9:45 am

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

Post by jpalomo »

The third argument for A_Explode is a flags field. You can use a number to represent the flags if you want (I believe the flags for A_Explode can only be 0, 1, 4, or 5), but that is not recommended. Instead, use the names you want like so:

Code: Select all

A_Explode (20, 120, XF_HURTSOURCE|XF_NOTMISSILE)
| is used to combine multiple flags.
User avatar
xenoxols
Posts: 2134
Joined: Mon Mar 18, 2013 6:08 pm
Preferred Pronouns: She/Her
Location: Behind you

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

Post by xenoxols »

Thanks, and I have ANOTHER question.(sorry) How could I make A projectile that circles around the player?
User avatar
GhostKillahZero
Posts: 742
Joined: Wed Nov 13, 2013 4:41 pm
Location: 343 Industries Headquarters
Contact:

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

Post by GhostKillahZero »

xenoxols wrote:How could I make A projectile that circles around the player?
[wiki]A_Warp[/wiki]
ArchXeno
Posts: 192
Joined: Sat Jan 09, 2010 4:33 pm

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

Post by ArchXeno »

How can I make this weapon fire in a circular arrangement? I don't quite understand how to customize A_FireCustomMissile, as the wiki page is pretty vague.

Code: Select all

vhnd e 0 a_firecustommissile("FrostShot1",-2,0,4,5,0,3)
	vhnd e 0 a_firecustommissile("FrostShot1",-3,0,-4,5,0,3)
	vhnd e 0 a_firecustommissile("FrostShot1",0,1)
	vhnd e 0 a_firecustommissile("FrostShot1",3,0,-4,-5,0,3)
	vhnd e 0 a_firecustommissile("FrostShot1",2,0,4,-5,0,3)
Blue Shadow
Posts: 5046
Joined: Sun Nov 14, 2010 12:59 am

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

Post by Blue Shadow »

The angle parameter is what you want to achieve that. Try this example (you can copy the code, paste it in a text file which is called decorate and drag-and-drop it onto zdoom.exe to test):

Code: Select all

ACTOR NewPlasmaRifle : PlasmaRifle
{
  Weapon.SlotNumber 6
  States
  {
  Fire:
    TNT1 A 0 A_GunFlash
    PLSG A 0 A_FireCustomMissile("PlasmaBall", 20, FALSE)
    PLSG A 0 A_FireCustomMissile("PlasmaBall", 40, FALSE)
    PLSG A 0 A_FireCustomMissile("PlasmaBall", 60, FALSE)
    PLSG A 0 A_FireCustomMissile("PlasmaBall", 80, FALSE)
    PLSG A 0 A_FireCustomMissile("PlasmaBall", 100, FALSE)
    PLSG A 0 A_FireCustomMissile("PlasmaBall", 120, FALSE)
    PLSG A 0 A_FireCustomMissile("PlasmaBall", 140, FALSE)
    PLSG A 0 A_FireCustomMissile("PlasmaBall", 160, FALSE)
    PLSG A 0 A_FireCustomMissile("PlasmaBall", 180, FALSE)
    PLSG A 0 A_FireCustomMissile("PlasmaBall", 200, FALSE)
    PLSG A 0 A_FireCustomMissile("PlasmaBall", 220, FALSE)
    PLSG A 0 A_FireCustomMissile("PlasmaBall", 240, FALSE)
    PLSG A 0 A_FireCustomMissile("PlasmaBall", 260, FALSE)
    PLSG A 0 A_FireCustomMissile("PlasmaBall", 280, FALSE)
    PLSG A 0 A_FireCustomMissile("PlasmaBall", 300, FALSE)
    PLSG A 0 A_FireCustomMissile("PlasmaBall", 320, FALSE)
    PLSG A 0 A_FireCustomMissile("PlasmaBall", 340, FALSE)
    PLSG A 3 A_FireCustomMissile("PlasmaBall")
    PLSG B 20 A_ReFire
    Goto Ready
  }
}
Locked

Return to “Editing (Archive)”