Jump to content

Script - Only spawn if custom quest is active


ZunaSW

Recommended Posts

Well, I make a script, and if I put a function in my script and the script is like this:

 

Well, you have errors in your script:

 

1) you put "CWFortSoldierImperialCWE.enable()" AFTER the "endif" instead of BEFORE it.

2) you have a stray "end function", which is causing the compiler errors. The function declaration is missing. But in this case you shouldn't be declaring any functions anyway.

3) you didn't declare the Property for the CWSonsFaction.

4) you haven't declared the "player" variable

5) enabling an object from inside an OnLoad block will make OnLoad fire again!

 

 

Ghaunadaur's script is correct, but there's a wee problem. I'm not sure if OnLoad will fire on a disabled object (its 3D hasn't loaded), but note also that when you ENABLE a disabled object it will make OnLoad fire again when the object's 3D loads, so that script will make OnLoad fire TWICE if it works at all. Use OnCellAttach or maybe OnInit to avoid this situation.

 

If you put this script on the NPC that you want to enable it should work, but it's a rather quick-and-dirty way to do spawns, as the NPC will only enable if the cell is not yet loaded when you enter it:

 

Scriptname CHANGEFORYOURSCRIPTNAME extends ObjectReference   

quest property CWE02 auto

Event OnCellLoad()
     if CWE02.IsRunning()
      enable()
     endIf
EndEvent 

Edited by steve40
Link to comment
Share on other sites

I put IsInFaction only to try if it works with IsInFaction, and it works, but when I put IsRunning it doesn't work. I have this errors:

 

Starting 1 compile threads for 1 files...

Compiling "CWE02"...

e:\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\CWE02.psc(3,15): cannot name a variable or property the same as a known type or script

e:\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\CWE02.psc(6,15): IsRunning is not a function or does not exist

e:\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\CWE02.psc(6,15): cannot call the member function IsRunning alone or on a type, must call it on a variable

No output generated for CWE02, compilation failed.

 

Batch compile of 1 files finished. 0 succeeded, 1 failed.

Failed on CWE02

 

 

 

When I put a function, I have other errors:

 

 

 

Starting 1 compile threads for 1 files...

Compiling "CWE02"...

e:\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\CWE02.psc(11,0): missing EOF at 'EndFunction'

No output generated for CWE02, compilation failed.

 

Batch compile of 1 files finished. 0 succeeded, 1 failed.

Failed on CWE02

 

 

Errors are in IsRunning :wallbash: I Don't know how to put the script to make it works.

The script of Ghaunadaur don't give me errors.

I understand the scripts, I know what I have to put in my script, but it doesn't work ._.

Link to comment
Share on other sites

Starting 1 compile threads for 1 files...

Compiling "CWE02"...

e:\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\CWE02.psc(3,15): cannot name a variable or property the same as a known type or script

 

The problem is not with IsRunning, it's the property name. You named your script the same as the property for the quest. That's why you are getting the error. Rename the property or the script and it will work.

Edited by Ghaunadaur
Link to comment
Share on other sites

Then I need to create a property in the script. If I understand that you say, I have to add a property in the script. I called NewPropertyCWE, type: quest and pick object CWE02. Ok I created it, and now the script is like this:

 

Scriptname CWEScript02 extends ObjectReference   

Quest Property NewPropertyCWE  Auto  

Event OnCellLoad()
 if CWE02.IsRunning()
       enable()
 endIf
EndEvent 

 

 

But I'm still geting errors:

 

Starting 1 compile threads for 1 files...

Compiling "CWEScript02"...

e:\steam\steamapps\common\skyrim\Data\Scripts\Source\CWE02.psc(3,15): cannot name a variable or property the same as a known type or script

e:\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\CWEScript02.psc(6,15): IsRunning is not a function or does not exist

e:\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\CWEScript02.psc(6,15): cannot call the member function IsRunning alone or on a type, must call it on a variable

No output generated for CWEScript02, compilation failed.

 

Batch compile of 1 files finished. 0 succeeded, 1 failed.

Failed on CWEScript02

 

 

 

For details: My script is called CWEScript02. Quest property NewPropertyCWE. Quest CWE02.

Edited by ZunaSW
Link to comment
Share on other sites

Ok!!!! Solved guys!!! It was a very very very simple problem. I explain it if anyone have the same problems. Simply I saw the problem was in the scripts and then I have a error with my psc archive called CWE02.psc located in skyrim/data/scripts/source. I deleted all scripts which have the "CWE02" word in his name. And then I compile the script and it works!! :D

Thank you guys!! you helped me a lot!! Really, thank you :)

Link to comment
Share on other sites

Ok!!!! Solved guys!!! It was a very very very simple problem. I explain it if anyone have the same problems. Simply I saw the problem was in the scripts and then I have a error with my psc archive called CWE02.psc located in skyrim/data/scripts/source. I deleted all scripts which have the "CWE02" word in his name. And then I compile the script and it works!! :D

Thank you guys!! you helped me a lot!! Really, thank you :)

 

You just needed to name the property consistently in the script:

 

Scriptname CWEScript02 extends ObjectReference   

Quest Property NewPropertyCWE  Auto  

Event OnCellLoad()
 if  NewPropertyCWE.IsRunning()
       enable()
 endIf
EndEvent 

 

And just point "NewPropertyCWE" to the appropriate quest object.

Edited by steve40
Link to comment
Share on other sites

  • Recently Browsing   0 members

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