Jump to content

Need help creating a script to trigger an enemy attack


RaffTheSweetling

Recommended Posts

Hi guys, I am hopeless at scripting, and I need to know how to write a script to trigger initially disabled enemies in FO3. I tried with a simple script but "mynpcref.enable" did not work and I kept getting errors telling me that that command was not right.

 

Please someone help.

 

Thanks heaps

 

Griffin

Edited by RaffTheSweetling
Link to comment
Share on other sites

Could it be that Persistent Reference is not checked for the new reference? This makes the reference accessible by scripts. The workflow for all this is:

  1. Make a copy of the disabled AI form by opening it and renaming its ID. GECK will ask you if you want to create a new form. Say yes.
  2. Drag the new AI form into the render window to create a reference of it.
  3. Double-click on the AI, to bring up the reference dialogue box.
  4. Give the reference a Reference Editor ID in the first box. This is should be unique name and which you can easily identify later.
  5. At the bottom of the dialogue, make sure initially disabled and persistent reference are checked.

You should now be able to access the new reference AI object, using its Editor ID, from a script. To enable the object, you need a line like:

 

[editor ID name].enable

 

That has to go in the script that triggers it. The trigger could be an activator such as a box, with a script attached. The script might look like this

scn SpawnGriffinsAI SCRIPT
short doOnce
begin onTriggerEnter player
if doOnce == 0
[editor ID name].enable
endif
end

The doOnce variable makes sure the code is only executed once, and not every time you walkthrough it. SpawnGriffinsAI is the unique name of your script.

 

/Jason

Edited by Jason210
Link to comment
Share on other sites

Glad to help - good luck with the project!

 

All I do is make lists like this:

scn SpawnGriffinsAI SCRIPT
short doOnce begin
OnTriggerEnter player
if doOnce == 0
[editor ID name#1].enable 
[editor ID name#2].enable 
[editor ID name#3].enable 
[editor ID name#4].enable 
[editor ID name#5].enable 
endif
end

Not very elegant but it works. I guess enable parent will work too but I've never tried it.

Edited by Jason210
Link to comment
Share on other sites

Just a word of warning that using the Enable Parent can be a little glitchy at times. At least in my experience you can sometimes get strange side effects. Nothing I can ever really put my finger on as far as a cause, but just strange bugs where things do not work as expected. I still use it at times, but not so much with NPC's. Just something to keep in mind if you ever run across one of those bugs the GECK seems to have where you cannot workout why it is not working when it should.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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