A blindning weapon

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

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.

A blindning weapon

Postby Kzer-Za » Mon Feb 04, 2019 1:15 pm

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 allExpand view
   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?
Kzer-Za
 
Joined: 20 Aug 2017

Re: A blindning weapon

Postby ZzZombo » Thu Feb 07, 2019 10:44 pm

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.
ZzZombo
 
Joined: 16 Jul 2012

Re: A blindning weapon

Postby Kzer-Za » Fri Feb 08, 2019 7:38 am

Thanks, I will try it when I know zscript better.
Kzer-Za
 
Joined: 20 Aug 2017

Re: A blindning weapon

Postby ZzZombo » Fri Feb 08, 2019 9:06 am

But it's not even ZScript really! It is actually feasible in Decorate.
ZzZombo
 
Joined: 16 Jul 2012

Re: A blindning weapon

Postby Kzer-Za » Fri Feb 08, 2019 9:34 am

Ah, you mean like this?

Code: Select allExpand view
IMPX ABCB 4 A_LookEx(0, 1, 50)


Or
Code: Select allExpand view
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.
Kzer-Za
 
Joined: 20 Aug 2017


Return to Scripting

Who is online

Users browsing this forum: No registered users and 0 guests