Jump to content

How Do I Apply a Passive Area Effect by Script?


user826

Recommended Posts

I'm trying to create a hologram disruptor for Dead Money. Basically, I have a piece of gear that I want to, when equipped, disable all holograms within a certain radius of the player. What would be the best way to go about this? I'm working on an effect script that currently looks like this, but I would prefer to do this using vanilla New Vegas GECK commands (i.e. I want to avoid using GetFirstRef/GetNextRef if I can help it, so the mod doesn't require NVSE) and without touching the NPCs vanilla game scripts

ref Victim
float Distance

begin ScriptEffectStart
    set Victim to GetFirstRef 43 1 ;* 43 = Creature, 1 = cell depth radius
    while Victim != 0
        if Victim.GetDead || Victim.GetDisabled
                ;Ignore
        elseif (Victim.GetInFaction NVDLC01HologramFaction == 1) || (Victim.GetInFaction NVDLC01HologramSecurityFaction == 1) || (Victim.GetInFaction NVDLC01HologramStarletFaction == 1)
            set Distance to Victim.GetDistance Player
                if (Distance <= 1000)
                    Victim.SetActorsAI 0
                elseif (Distance > 1000)
                    Victim.SetActorsAI 1
                endif
        endif
        set Victim to GetNextRef
    loop
end

How else can I achieve the effect? Could I do it by creating a custom explosion, maybe? An object effect or custom quest? Or some other method that I haven't thought of? I'd appreciate the help!

Edited by user826
Link to comment
Share on other sites

I originally wanted to do it that way, but then how would I apply the script to the target? The script is on a piece of armor that the player is wearing. Using GetSelf would therefore target the player. To use GetSelf, I'd have to make it into a weapon and then run GetSelf in an OnHitWith block to target the holograms, and in that case it wouldn't be a passive effect. I'd have to actively hunt down and shoot each hologram with the weapon to run the script...

Link to comment
Share on other sites

If you don't want to use NVSE, use a 'touch' spell (actor effect) with a large radius like 5000 or so, that also ignores LOS. That way the scripteffectstart block runs on every actor and you can do stuff to them. You have a quest script that bouces the spell off the player every few seconds to scan the cell. I call them 'radar' effects. If you want to see examples I have on in my wendy gilbert mod RHKWendyCBRadarEffect, and I'm using them in Project Brazil - PBrazilEncSTVRadarEffect. set the flags on the base effect to self, touch, no mag, painless, no hit effect. On the actor effect, 'force touch explode' ignore LOS'.




scn PBrazilCH1STVRadarEffectScript


BEGIN ScripteffectStart


if (IsActor)
if (GetDead) || (GetDisabled)
return
else
if (GetInFaction ProjectBrazilVault18EnclavePatriot == 1)
else
return
endif
if (GetIsReference PlayerREF == 1)
return
endif
set PBrazilCH1Save.iCH1PatriotAlive to PBrazilCH1Save.iCH1PatriotAlive + 1
endif
endif


END






scn PBrazilCH1SaveQuestScript

short iCH1PatriotAlive ;roll call of live ENC during battle
short iEnableRadar
short iCH1STVBattleDone
short iCH1BraggRevive ;flag to revive Bragg once during STV (if no limbs missing)
float iCH1BraggReviveTimer
short iCH1HYDVSecControl ;package flag for remaining V-sec to follow player to the atrium
short iFailOnce

;Quest delay 5 seconds
;Bounce a touch spell off the player to detect Enclave that are alive. The Base Effect script is PBrazilCH1STVRadarEffectScript
BEGIN GameMode

if (iEnableRadar == 1)
if (Player.IsSpellTarget PBrazilEncSTVRadarEffect == 1)
else
set iCH1PatriotAlive to 0
Player.cios PBrazilEncSTVRadarEffect
set iEnableRadar to 2
endif
elseif (iEnableRadar == 2) ;will be here on the next loop in 5 seconds
if (iCH1PatriotAlive) || (iCH1BraggRevive < 4) ;Not done with battle, Bragg not dead-dead
set iEnableRadar to 1
else
set iCH1STVBattleDone to 1 ;No ENC responded
endif
endif



END

Link to comment
Share on other sites

Thanks, rickerhk! This looks like it could be just what I need. I'm still trying to parse your example scripts to see how I'd need to modify them but it's a solid start. Thanks again!

 

EDIT: Is there a reason why there isn't any code to run between the if and else conditions like in the following snippets?

      if (GetInFaction ProjectBrazilVault18EnclavePatriot == 1)
      else
         return
      endif
   if (Player.IsSpellTarget PBrazilEncSTVRadarEffect == 1)
   else
      set iCH1PatriotAlive to 0
      Player.cios PBrazilEncSTVRadarEffect
      set iEnableRadar to 2
   endif

Is that necessary for the script to run properly? Because I did everything else like you said, created the Base and Actor effects with the proper flags but it's not working for whatever reason. Here are my scripts as they currently stand:

 

Base Effect Script:

scn SCPTHologramDisruptorEffect

begin ScriptEffectStart
	if (IsActor)
		if (GetDead) || (GetDisabled) || (GetIsReference Player)
			Return
		else
			if (GetInFaction NVDLC01HologramFaction == 1) || (GetInFaction NVDLC01HologramSecurityFaction == 1) || (GetInFaction NVDLC01HologramStarletFaction == 1)
				if (GetDistance Player <= 5000)
					SetActorsAI 0
					ShowMessage MESGHologramDisruptorActive
				elseif (GetDistance Player > 5000)
					SetActorsAI 1
				endif
			endif
		endif
	endif
end

Quest Script (Priority 55, Start Game Enabled, Script Processing Delay of 5.000):

scn SCPTHologramDisruptorQuest

short DisruptorActive

begin GameMode
	if (DisruptorActive == 1)
		Player.CIOS SPELHologramDisruptor
		set DisruptorActive to 2
	elseif (DisruptorActive == 2)
		set DisruptorActive to 1
	endif
end

Armor Object Script:

scn SCPTSignalJammer

begin OnEquip Player
	ShowMessage MESGSignalJammerEquipped
	set QUSTHologramDisruptor.DisruptorActive to 1
end

begin GameMode
	if (player.GetEquipped ARMOSignalJammer == 1)
		if (NVDLC01BombCollarQuest.fCollarTimer < 10)
			PlaySound UIPipBoyStatic
			ShowMessage MESGSignalJammerActive
			set NVDLC01BombCollarQuest.fCollarTimer to 10
		endif
	else
		;Do nothing
	endif
end

begin OnUnEquip Player
	ShowMessage MESGSignalJammerUnEquipped
	set QUSTHologramDisruptor.DisruptorActive to 0
end
Edited by user826
Link to comment
Share on other sites

Does your actor effect record have an area and a small duration?




From what I can tell, your scripts should work.


The if/else structure is just an optimization to avoid checking an expression for zero.




if (GetInFaction ProjectBrazilVault18EnclavePatriot == 1)
else
return
endif


is the same as:




if (GetInFaction ProjectBrazilVault18EnclavePatriot == 1)
;do nothing
else
return
endif


and it's faster than:




if (GetInFaction ProjectBrazilVault18EnclavePatriot == 0)
return
endif



Link to comment
Share on other sites

Aha, that was it! I'd left both those values at 0, since whenever I make clothing or weapon enchantments, I can just leave it. Old habits die hard, I guess. It's working perfectly now. Thanks for your time!

 

EDIT: The Concise Step-By-Step Guide (for anyone stumbling across this thread in the future)

 

  1. Create the Base Effect (Effect Archetype: Script, Assoc. Item: {your script}, [x] Self, [x] Touch, [x] No Magnitude, [x] No Hit Effect, [x] Painless)
  2. Create the Actor Effect ([x] Area Effect Ignores LOS, [x] Force Touch Explode)
  3. Attach the Base Effect to the Actor Effect (Effect: {base effect}, Range: Touch, Area: {a number greater than 0}, Duration: {a number greater than 0})
Edited by user826
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...