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
Apeirogon
Posts: 1606
Joined: Mon Jun 12, 2017 12:57 am

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

Post by Apeirogon »

Jekyll Grim Payne wrote:
Apeirogon wrote:When i try launch this code game crash
Spoiler:
ACS
Spoiler:
Where error?
You're trying to use CallAcs to run a script. But that script is already running because for some reason it's an Enter script. (And Enter scripts run once per player per map, at the beginning of the map.) What you need is a script that will only run when it's called by CallAcs. So, to put it simply, your script should be (void) or better yet (int speed). Then CallACS will run it and return its result value.

Ok, now
Spoiler:
it launch without question.

But when I aim any shootable actor game crash with error.
Spoiler:
I try (void) too, with the same result.
Or this script crash game because speed changes and script try to return original, unchanged, speed?
User avatar
Ryuhi
Posts: 372
Joined: Tue Feb 21, 2017 11:00 pm

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

Post by Ryuhi »

I'm currently trying to write a script for a magical torch familiar that floats around the players head. I have everything set with creating the actor for the familiar, but I'm having trouble creating a script that allows it to toggle on and off. Essentially while its on, it drains a mana pool and should summon the familiar to orbit the player. While its off, it should remove the familiar actor and allow the player to regenerate their mana. I have everything set, except i can't find a command to get rid of the damn familiar once the ability is toggled off.

the ACS:

Code: Select all

Script "LightCasting" (Void)
{
  If (CheckInventory("LightSpell"))
  {
  TakeInventory("ManaCounter",1);
  GiveInventory("ManaRegen",1);
  TakeInventory("LightSpell",1);
  terminate;
  }
  If (!CheckInventory("LightSpell"))
  {
  TakeInventory("ManaRegen",1);
  GiveInventory("ManaCounter",1);
  SpawnForced("TorchFamiliar",0,0,0);
  GiveInventory("LightSpell",1);
  terminate;
  }
}
The Decorate actors:

Code: Select all

ACTOR LightSpell : Inventory
{
	Inventory.MaxAmount 1
}
	
ACTOR TorchFamiliar : Inventory
{	
	+MISSILE
	+NOINTERACTION
	+FLOATBOB
	Renderstyle Translucent
	Alpha 0.3
	var int user_angle;
	States
	{
		Spawn:
		TRCH D 1 Bright A_SpawnItemEx("TorchGlowFlare",0,0,31,0,0,0,0,SXF_NOCHECKPOSITION)
		TNT1 A 0 A_Warp(AAPTR_PLAYER1,35,0,30,user_angle,WARPF_ABSOLUTEANGLE|WARPF_NOCHECKPOSITION|WARPF_INTERPOLATE)
		TNT1 A 0 A_SetUserVar("user_angle", user_angle + 2)
		TRCH E 1 Bright A_SpawnItemEx("TorchGlowFlare",0,0,31,0,0,0,0,SXF_NOCHECKPOSITION)
		TNT1 A 0 A_Warp(AAPTR_PLAYER1,35,0,30,user_angle,WARPF_ABSOLUTEANGLE|WARPF_NOCHECKPOSITION|WARPF_INTERPOLATE)
		TNT1 A 0 A_SetUserVar("user_angle", user_angle + 2)
		TRCH F 1 Bright A_SpawnItemEx("TorchGlowFlare",0,0,31,0,0,0,0,SXF_NOCHECKPOSITION)
		TNT1 A 0 A_Warp(AAPTR_PLAYER1,35,0,30,user_angle,WARPF_ABSOLUTEANGLE|WARPF_NOCHECKPOSITION|WARPF_INTERPOLATE)
		TNT1 A 0 A_SetUserVar("user_angle", user_angle + 2)
		Loop
	}
}
Blue Shadow
Posts: 5043
Joined: Sun Nov 14, 2010 12:59 am

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

Post by Blue Shadow »

The spawn functions allow for assigning a new TID to the spawned actor. Use [wiki]Thing_Remove[/wiki] while passing the TID of the actor to the special to remove it from the game.
User avatar
Ryuhi
Posts: 372
Joined: Tue Feb 21, 2017 11:00 pm

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

Post by Ryuhi »

I'm really bad at TIDs, but that did the trick. thanks!

Next up: I have my 4 spells, and they all work perfectly! currently I am calling them through a pukename system, so they need keys bound to them. I would like to know if there is a simple way of creating a system to cycle through them to reduce the number of required keybinds, havent really been able to find any good examples though. :(
User avatar
HexenMapper
Posts: 160
Joined: Mon Jan 18, 2016 7:24 am
Contact:

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

Post by HexenMapper »

HexenMapper wrote:Is there a way to display par times in heretic?

I've set

par = 90

in MAPINFO but no par time displays when the level is completed. Do I need to set up something in the intermission definition? and if so, what?

Thanks
I found this in the standard zdoom LANGUAGE lump, under the heretic stuff:

// Raven intermission
TXT_IMKILLS = "KILLS";
TXT_IMITEMS = "ITEMS";
TXT_IMSECRETS = "SECRETS";
TXT_IMTIME = "TIME";

I can alter these and different things will show up, but can I add a par time to this? Anyone know where these "TXT_IMTIME" or "TIME" things are referenced? or how to add something? I've looked through the MAPINFO for common, doom, doom2 and heretic and they don't seem to be referenced anywhere in there...
User avatar
Jekyll Grim Payne
Global Moderator
Posts: 1118
Joined: Mon Jul 21, 2008 4:08 am
Preferred Pronouns: He/Him
Graphics Processor: nVidia (Modern GZDoom)
Contact:

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

Post by Jekyll Grim Payne »

Apeirogon wrote: Ok, now
Spoiler:
it launch without question.

But when I aim any shootable actor game crash with error.
Spoiler:
I try (void) too, with the same result.
Or this script crash game because speed changes and script try to return original, unchanged, speed?

Sorry, I didn't pay enough attention to the code last time. First, you don't need ACS to check for the actor's speed, you can simply use b]A_JumpIf(speed < 30, "Death")[/b] for that. Try that for a change, maybe that'll work.

However, after looking at the code, frankly, I'm not sure what you're trying to do there. Upon entering XDeath state the rocket's speed is already 0 (because projectiles stop when they hit something), so trying to do anything with it won't change anything, it'll always jump to Death state. And even if its speed wasn't 0, what would jumping back to flying state accomplish?

Anyway, to test it out I made this simplified version in DECORATE:

Code: Select all

Actor NewRocket : Rocket replaces Rocket
{
	states
	{
	Spawn:
		TNT1 AAAA 0 nodelay A_ScaleVelocity(1.5, AAPTR_DEFAULT)
	fly_sweety:
		MISL AABB 1 A_ScaleVelocity(1.2, AAPTR_DEFAULT)
		loop
	death: //wall
		MISL BC 1 a_explode(17, 35, 0, true, 11, 0, 0, 0)
		stop
	XDeath: //bleeding actor
	   TNT1 AA 0 A_ScaleVelocity(0.7, AAPTR_DEFAULT)
	   TNT A 0 a_jumpif(speed < 30, "death")   
		goto fly_sweety
	}
}
It doesn't crash anything but again, I'm not entirely sure wha you want to do there.

Scaling the speed 4 times at 0-length frames at the spawn state doesn't really make much sense. Why not just set the initial speed higher? It'll yield the same effect.

Also, I'm not sure about the syntax. It kinda looks like a mix between DECORATE and ZScript. I suck at the latter so I don't know if that's how it's properly used but I'm not sure that syntax is correct.

It's also possible that the crash is caused by something else. You showed the states but you didn't show the code for the projectile. Chances are that its initial speed is something like 10 and when it gets scaled up it gets extremely fast. Doom's projectiles don't handle high speeds well unless they inherit from [wiki]FastProjectile[/wiki], and I don't know if you utilized that.

P.S. Minor nitpick: you're calling a rocket flying sound 4 times at a 0-length frame in the spawn state which is basically pointless. And then again twice in 1-tick frames in the flying state. I don't think that was what you want. If you want it to be looped, you need to use A_PlaySound("soundname",slotname,1.0,true) and call it just once, at TNT1 A 0 NoDelay at the beginning of the first state.
User avatar
Mav3r1ck
Posts: 262
Joined: Thu Jul 16, 2015 11:09 pm

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

Post by Mav3r1ck »

Ok, I'm having trouble with a script I'm trying to get working in a unique way.

I have a scripted trap that can trigger repeatedly and spawns a monster and removes it's corpse once it's dead. Now once the corpse is removed the Thing no longer exists and it can't respawn once the trap triggers again. I'm trying to get it to where the monster spawns repeatedly once the trap is triggered over and over again but also removes it's corpse after it's dead.

How exactly would I go about doing this?
User avatar
Apeirogon
Posts: 1606
Joined: Mon Jun 12, 2017 12:57 am

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

Post by Apeirogon »

Jekyll Grim Payne wrote:I'm not entirely sure wha you want to do there.
I try make ripper projectile which stay ripper only if it speed higher than some number.

That all code of rocket that i use NOW, without "send crash report to Micro...DRD team?"
Spoiler:
User avatar
Cherno
Posts: 1337
Joined: Tue Dec 06, 2016 11:25 am

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

Post by Cherno »

Mav3r1ck wrote:Ok, I'm having trouble with a script I'm trying to get working in a unique way.

I have a scripted trap that can trigger repeatedly and spawns a monster and removes it's corpse once it's dead. Now once the corpse is removed the Thing no longer exists and it can't respawn once the trap triggers again. I'm trying to get it to where the monster spawns repeatedly once the trap is triggered over and over again but also removes it's corpse after it's dead.

How exactly would I go about doing this?
Maybe keep the monster (I assume it has a unique TID) and just make it invisible and not blocking after it's dead (calling a script that does just that in it's Death state). In it's spawn state, make it vivible and blocking again.
Gez
 
 
Posts: 17942
Joined: Fri Jul 06, 2007 3:22 pm

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

Post by Gez »

Amuscaria wrote:Just out of curiosity, what's the purpose for the "Null Texture" checkbox in the Textures lump editing interface in Slade? I just spent 40 minutes trying to figure out why one of my textures wouldn't show up in-game no matter now many times I re-imported the file, renamed the graphics, and looked thru the Textures lump to see if I've accidentally misspelled anything only to to realize I had that box checked. :P
There's no real use for a modder; the feature exists only to support stuff like AASHITTY from vanilla. Not sure why you had that box checked in the first place though, I don't think it's set by default when making a new texture.
Nevander wrote:
Jaxxoon R wrote:Because there's monster-blocking lines there.
Seriously? Wow wtf id. Weird place for block monster lines.
I think it was so that the zombies wouldn't leave the stairs if the player attacks them from the ledge. It looks kind of dumb if they're swarming at the bottom of the wall below you and you're killing them by shooting empty air above their head.

We're talking about the beginning of the first map here. It's important to give a good first impression; and not let the engine quirks turn off the player before they even started to love the game.
User avatar
Jekyll Grim Payne
Global Moderator
Posts: 1118
Joined: Mon Jul 21, 2008 4:08 am
Preferred Pronouns: He/Him
Graphics Processor: nVidia (Modern GZDoom)
Contact:

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

Post by Jekyll Grim Payne »

Apeirogon wrote:
Jekyll Grim Payne wrote:I'm not entirely sure wha you want to do there.
I try make ripper projectile which stay ripper only if it speed higher than some number.

That all code of rocket that i use NOW, without "send crash report to Micro...DRD team?"
Spoiler:
Ah, well, at least one of the problems is that Ripper projectiles don't enter enter their XDeath state when they go through a bleeding actor. XDeath is a Death state, like regular Death it can only be entered if the projectile actually died. Going through an actor doesn't trigger dying for a Ripper projectile. At least that's how it works for me, I just checked. So, I'm not 100% sure what causes the crash, but your XDeath shouldn't be working at all. I don't think it's possible to link some sort of a change to the act of a ripper projectile piercing an actor via DECORATE. Can't say anything for Zscript.
User avatar
Apeirogon
Posts: 1606
Joined: Mon Jun 12, 2017 12:57 am

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

Post by Apeirogon »

Understood.
Crew, this is captain. Close hatch, nose and ears. We going to dive into murky depth of madness....into zscript manuals...
arachnotron
Posts: 41
Joined: Sat Sep 16, 2017 10:38 am

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

Post by arachnotron »

I have a question about the swinging door. I finally got it working exactly how I wanted, using Polywait to not get glitches when I spam use on the linedef that triggers script of the polyobject to rotate, but im not sure what TagWait is doing at the end of the script, and TagWait asks for a tag number according to the zdoom wiki, but there are no tags involved in a rotating polyobject, unless the "angle" on "Polyobject anchor" and "Polyobject start spot" are considered tags and that is what I should be putting on TagWait() ?? or I need to put the number of the scriptin between the parenthesis? example of the door script:

Code: Select all

script 1 (void)

{
    if (door == 0) {
        door = 1;
		SoundSequence ("dopen");
		delay (1);
		Polyobj_RotateRight  (1, 16, 66);
		PolyWait (1);
    } else {
        door = 0;
		delay (1);
		Polyobj_RotateLeft  (1, 16, 66);
		PolyWait (1);
		SoundSequence ("dclose");

    }
    TagWait(1);
}
So what I mean is, is TagWait(1) refering to script 1, or to polyobject 1?
arachnotron
Posts: 41
Joined: Sat Sep 16, 2017 10:38 am

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

Post by arachnotron »

AN additional question: How do I make the ceiling at a different brightness than the floor in UDMF format? I used to use the cheap and old trick of raising the ceiling a ton and having no textures on the upper sides in the legacy format but im making my first non classic format doom map and im using 3d floors and I got this house with a 3D floor ceiling, and I want a light on this ceiling that is at full 255 brightness but I want the floor to be at the same brightness as the rest of the floor on the other sectors. So I want 255 brightness on the ceiling texture, and 128 brightness on floor texture so I dont get a dumb looking bright square on the floor, then I add a dynamic pointlight and it looks cool with the very intense bright on the ceiling on the actual light in combination with this pointlight. The "brightness" in the "surfaces" section that are at 0 by default do nothing.
Nevander
Posts: 2254
Joined: Mon Jan 06, 2014 11:32 pm

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

Post by Nevander »

Go into the sector properties and check the absolute brightness box under floor/ceiling, and then set the value to the same light as surrounding sectors.
Locked

Return to “Editing (Archive)”