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.
Stardust
Posts: 57
Joined: Sat Jan 12, 2013 6:41 pm
Location: France

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

Post by Stardust »

edward850 wrote:APROP_DamageFactor in SetActorProperty is the generic damage factor, and isn't supposed to control the damage factor of any specific damage types. In-fact, it even explains this to you on the very wiki page you linked to:
Generic damage factor for the actor.
Thanks for answering, edward.
Uguu, that's too bad... from what I learnt about your informations, it looks like I couldn't make an item (an elemental shield) that, when used, will reduce of 60% every fire attacks (every fire-related damagetypes) that hurt the actor.. right ?
Also, on another hand, I can't even get the generic damages working. Here is the code I used :

Code: Select all

script 355 (void)
{
	SetActorProperty(0, APROP_DamageFactor, 0);
}
It's not a question of "the script isn't loaded", it works when I try with APROP_Gravity. I compiled this text above (that is supposed to multiply damages by 0, so... it turns them useless against the actor, obviously), and my actor still gets the original damages...
User avatar
edward850
Posts: 5915
Joined: Tue Jul 19, 2005 9:06 pm
Location: New Zealand

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

Post by edward850 »

Seeing as you are using TID 0 (the activator of the script), what's activating script 355? Testing that code exactly works as expected for myself.
Stardust
Posts: 57
Joined: Sat Jan 12, 2013 6:41 pm
Location: France

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

Post by Stardust »

The one activating script 355 is... the player. When he/she uses the shield item, he/she calls script 355.
And it worked with APROP_Gravity, so I know the script is correctly called.
User avatar
edward850
Posts: 5915
Joined: Tue Jul 19, 2005 9:06 pm
Location: New Zealand

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

Post by edward850 »

I'm not sure what you could be doing wrong, so I wipped up an example that I know works. Doonluud heer.
The Cacodemon is set to a DamageFactor of 0 on map-spawn, and the player can set themselves to a DamageFactor of 0 by using the switch.
Stardust
Posts: 57
Joined: Sat Jan 12, 2013 6:41 pm
Location: France

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

Post by Stardust »

Ah, ah, I see... thanks. It actually works now.
But furthermore, I can't alter any specific DamageFactors, right ? I can only modify the generic (a.k.a every damages) one ?
User avatar
edward850
Posts: 5915
Joined: Tue Jul 19, 2005 9:06 pm
Location: New Zealand

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

Post by edward850 »

Stardust wrote:But furthermore, I can't alter any specific DamageFactors, right ?
You could if you wanted to make a powerup, for example.
Stardust
Posts: 57
Joined: Sat Jan 12, 2013 6:41 pm
Location: France

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

Post by Stardust »

....oh. Ho. Hahah. Hah. UGUUUURG-
I should have checked this first, sigh. If I would have known more about item classes, I would have used this... but I learnt that scripts aren't always the solution. Thanks for all that edward, my problem is solved~
User avatar
Scripten
Posts: 868
Joined: Sat May 30, 2009 9:11 pm

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

Post by Scripten »

Back here again for something a little weird. I'm working on making a chargeable plasma gun with three levels of charge. It seems to work alright with one level, but... well, when I add in any more levels, GZDoom crashes. It doesn't even show the error reporting window. Here's all the relevant code:

Code: Select all

ACTOR ChargeCounter : Inventory
{
  Inventory.MaxAmount 30
  Inventory.InterHubAmount 0
  + INVENTORY.INVBAR
}

ACTOR ChargeBeam : PowerBeam
{
  Tag "Charge Beam"
  States
  {
  Fire:
    MISG B 0 A_PlaySound("vile/firestrt")
    MISG B 2
    MISG B 2 
    MISG B 0 A_JumpIfInventory("ChargeCounter", 10, "Charge1")
    MISG B 0 A_GiveInventory("ChargeCounter", 1)
    MISG B 0 A_ReFire
    MISG B 8 A_FireCustomMissile("ChargeShot")
    MISG B 0 A_TakeInventory("ChargeCounter", 9999)
    goto Ready
    Charge1:
    MISG B 0 A_JumpIfInventory("ChargeCounter", 20, "Charge2")
    MISG B 0 A_GiveInventory("ChargeCounter", 1)
    MISG B 0 A_ReFire("Charge1")
    MISG B 2 A_FireCustomMissile("ChargeShot1")
    MISG B 0 A_TakeInventory("ChargeCounter", 9999)
    goto Ready
    Charge2:
    MISG B 0 A_JumpIfInventory("ChargeCounter", 30, "Charge3")
    MISG B 0 A_GiveInventory("ChargeCounter", 1)
    MISG B 0 A_ReFire("Charge2")
    MISG B 2 A_FireCustomMissile("ChargeShot2")
    MISG B 0 A_TakeInventory("ChargeCounter", 9999)
    goto Ready
    Charge3:
    MISG B 0 A_ReFire("Charge3")
    MISG B 4 A_FireCustomMissile("ChargeShot3")
    MISG B 0 A_TakeInventory("ChargeCounter", 9999)
    goto Ready
  }
}

actor ChargeShot : PlasmaBall
{
  Translation "192:207=168:191", "241:241=189:189"
  Scale 1.1
  Damage 2
}

actor ChargeShot1 : ChargeShot
{
  Translation "192:207=208:223", "241:241=234:234"
  Scale 1.4
  Damage 6
}

actor ChargeShot2 : ChargeShot
{
  Translation "193:198=226:231", "199:207=161:164", "241:241=164:164"
  Scale 1.6
  Damage 10
}

actor ChargeShot3 : ChargeShot
{
  Translation "192:207=192:197", "241:241=197:197"
  Scale 2
  Damage 15
}
Is this something that I'm doing wrong, or am I just looking at a GZDoom bug? (I've only just started on Decorate, so I haven't a clue.)

Edit: After taking a closer look, it happens exactly when I jump to the "Charge1" state after charging 10 units of the ChargeCounter item. If the fire button is immediately let go of, the ChargeShot1 projectile is fired, but if the A_Refire command is reached, GZDoom crashes.

Edit2: I got this working using the depreciated A_JumpIfInventory, using just an integer value. Even so, I'd like to have the code be as clean and up-to-date as possible. Plus, if it's a bug...
Last edited by Scripten on Sun Jan 13, 2013 11:33 am, edited 1 time in total.
User avatar
jpalomo
Posts: 776
Joined: Mon May 17, 2010 9:45 am
Operating System Version (Optional): Nobara Linux 43 KDE
Graphics Processor: nVidia with Vulkan support

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

Post by jpalomo »

Just from a quick glance at your code, you don't seem to have any tics during your Charge states before A_Refire is called. Put 1 on A_GiveInventory and it should work. Also, Charge3 has an infinite 0 tic loop with A_Refire. Ran into this same issue with my mod.
User avatar
Scripten
Posts: 868
Joined: Sat May 30, 2009 9:11 pm

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

Post by Scripten »

Aha. That's what was happening. Everything works perfectly now. Many thanks!
Spoiler: In case anyone else has this issue, here's how it was fixed.
User avatar
Sgt. Shivers
Posts: 1743
Joined: Fri Jun 22, 2012 5:39 am

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

Post by Sgt. Shivers »

How do I choose what sounds play when the player exits the game?
User avatar
zrrion the insect
Posts: 2432
Joined: Thu Jun 25, 2009 1:58 pm
Location: Time Station 1: Moon of Glendale

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

Post by zrrion the insect »

Code: Select all

gameinfo
{
quitsound = "TheSoundYouWantHere"
}
User avatar
Sgt. Shivers
Posts: 1743
Joined: Fri Jun 22, 2012 5:39 am

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

Post by Sgt. Shivers »

zrrion the insect wrote:

Code: Select all

gameinfo
{
quitsound = "TheSoundYouWantHere"
}
Thanks!
User avatar
Ravick
Posts: 2055
Joined: Sun Aug 22, 2010 10:59 pm
Location: Tubarão, Brasil

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

Post by Ravick »

How do I give to a monster with a projectile attack some chance to miss its target?
User avatar
cypherphage
Posts: 213
Joined: Sun Feb 27, 2011 2:54 am

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

Post by cypherphage »

Depends, first way is to use the angle property of A_CustomMissile; Secondly, something like "TNT1 A 0 A_SetAngle(angle + random(-5,5))" after A_FaceTarget but before attacking will also do the trick.
Last edited by cypherphage on Sat Jan 19, 2013 9:08 pm, edited 1 time in total.

Return to “Editing (Archive)”