A blindning weapon

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!
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.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Post Reply
Kzer-Za
Posts: 530
Joined: Sat Aug 19, 2017 11:52 pm
Graphics Processor: nVidia (Modern GZDoom)

A blindning weapon

Post by Kzer-Za »

I want to give one weapon in Heretic an altfire with a blinding attack.

So I was wondering how to best go about it. From my limited knowledge of modding it seems that the way to go is to give this attack a FORCEPAIN flag and to give each monster a custom Pain state for this attack's type of damage and a Blind state in which this monster would A_Wander. Something like this:

Code: Select all

	Pain.BlindingWeapon:
		TNT1 A 0 A_SetUserVar("user_blindtimer", ACS_NamedExecuteWithResult("LevelTimer"))
		Goto Blind
	Blind:
		TNT1 A 0 A_JumpIfTargetInsideMeleeRange("BlindMelee") // I want the monster to fight if you bump into it
		SPRT ABCD x A_Wander
		TNT1 A 0 A_JumpIf((ACS_NamedExecuteWithResult("LevelTimer") - user_blindtimer) > 350, "See")
		Loop
	BlindMelee:
		// it would be a copy of Melee, except the ending:
		Goto Blind
Perhaps, I don't know a better way that someone could offer? What would be the drawbacks of this method?
ZzZombo
Posts: 339
Joined: Mon Jul 16, 2012 2:02 am

Re: A blindning weapon

Post by ZzZombo »

You could simply have a variable like `sight_range` defined on your monster, when it's blinded, reduce it to some low value that is still enough for a melee attack, and make your `See` sequence use the parametrized version of `A_Look` that uses the `sight_range` variable for its `view range` argument and leave the rest unchanged. Don't forget to restore sight range after blind ends.
Kzer-Za
Posts: 530
Joined: Sat Aug 19, 2017 11:52 pm
Graphics Processor: nVidia (Modern GZDoom)

Re: A blindning weapon

Post by Kzer-Za »

Thanks, I will try it when I know zscript better.
ZzZombo
Posts: 339
Joined: Mon Jul 16, 2012 2:02 am

Re: A blindning weapon

Post by ZzZombo »

But it's not even ZScript really! It is actually feasible in Decorate.
Kzer-Za
Posts: 530
Joined: Sat Aug 19, 2017 11:52 pm
Graphics Processor: nVidia (Modern GZDoom)

Re: A blindning weapon

Post by Kzer-Za »

Ah, you mean like this?

Code: Select all

IMPX ABCB 4 A_LookEx(0, 1, 50)
Or

Code: Select all

IMPX ABCB 4 A_LookEx(1, LOF_NOSIGHTCHECK)
But this works only until they don't actually go to their See state, I just tested it. And they do go to their See state if you attack them, even if you add LOF_NOSOUNDCHECK, LOF_DONTCHASEGOAL. And the intended purpose of the weapon was to temporarily allow attacking the blinded monster with impunity :) So if I understood you correctly, this doesn't seem to work as I intended.
Post Reply

Return to “Scripting”