Jump to content

Triggers


viking99

Recommended Posts

Hi I am making a mod about hunting. I have chosen a Ranchhouse as the main headquarter. Following the turial I managed to create a trigger and a trigger script to start the first quest. When I am creating the second quest I have problems with what to to with the trigger. I would prefer to attach it to a npc but when I try to attach a script to my main npc the dialoque won´t trigger. I have also tried to create a new trigger but the old one was in the way. I then tried to create a trigger script something like this.

 

 

 

scn HMSamGiveQuest

 

Begin onTriggerEnter player

 

if getStage HMQ1 <10

setStage HMQ1 10

 

if HMQ1 >= 100

Startquest HMQ2

 

if getStage HMQ2 <10

setStage HMQ2 10

 

 

if HMQ2 >= 100

Startquest HMQ3

 

 

endif

endif

endif

endif

End

 

I have set HMQ1 to start game enabled an it triggers fine. However HMQ2 won´t trigger the way it is supposed to do. When I tested the quest on it own it worked out fine but I can´t get the combined trigger to work. Does anyone have suggestions what can be done. you help would be really appreciated!

Link to comment
Share on other sites

I am guessing that you have not done much programming before. If you have, and the below is obvious, I apologize.

 

You have created "nested" if statements when this is probably not what you want. The second if statement is only executed when the first if statement has already been checked and found true. So, these three lines will not do what you want:

 

if getStage HMQ1 <10
  setStage HMQ1 10
  if HMQ1 >= 100
     ...
  endif
endif

Also please note here that I have used the [ code ] tags in the forum editor to preserve the indentation.

 

I did not carefully check your logic, but probably what you want is:

 

if getStage HMQ1 <10
  setStage HMQ1 10
endif
if HMQ1 >= 100
  ...
endif

 

You may find a tutorial like this one to be helpful in learning more about nesting if statements.

Link to comment
Share on other sites

Thanks for the quick reply. After changing a few settings in the geck I actually got my trigger to work though I admit the scripting don´t look pretty. I will change my script according to your suggestions, it seem more logic and is probably safer. Thanks again..
Link to comment
Share on other sites

After finding my nested trigger buggy and not very reliable. I have experimented a bit with your suggested changes. Sadly I did not work very well so I decided to add the trigger to a book and advanced the plot when the book is added to the player. Works like a charm even if it´s not what I originally intended
Link to comment
Share on other sites

  • Recently Browsing   0 members

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