Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Scripting help
04-27-2007, 09:00 AM,
#11
 
Quote:Originally posted by InsanitySorrow
If it is attached to a quest then it would not need to be set at every frame, I still wonder why you would need a timer for a quest, if you want it to player once do something like this:
The code you attached works, the quest will be stopped after 5 seconds, that's the same as having no quest at all. I mean why create a quest, if it can't be used.

The timer.
Perhaps TID wants to give the Player a choice to start with that quest, if he doesn't continue within time X the quest is stopped.

@
TID?
Dum loquor, hora fugit  - While I speak the time flies



Ovid 43 BC - 17 AD
Reply
04-27-2007, 09:09 AM,
#12
 
It was purely and example of how the DoOnce should be used, i guess the timer could work for that purpose, but if he sets it up where the stopquest is and then put else, then stop quest it should work

what about this

Code:
scriptname [Name Here]

float timer
short DoOnce

Begin Gamemode ; This is used for quests mainly

Set timer to 1

If ( timer > 0 ) && ( DoOnce == o)
  set timer to timer - GetSecondsPassed

else

StopQuest [Quest Name]

endif

set DoOnce to 1

end
[color="#9ACD32"]How do you Skyrim? Show Us in TES Alliance's [url="http://tesalliance.org/forums/index.php?/forum/112-official-skyrim-contest/"]Salute to Skyrim Contest[/url]![/color]
Reply
04-27-2007, 09:24 AM,
#13
 
Set timer to 1/set DoOnce to 1 are not within an if block.
GetSecondsPassed (frame based) can't be used on a quest.
Dum loquor, hora fugit  - While I speak the time flies



Ovid 43 BC - 17 AD
Reply
04-27-2007, 09:32 AM,
#14
 
It works better if they are in an IF statment, as for the getseconds passed, i took the wrong infomtation down, was supposed to be a modified version fo your bit of script, anyway just make sure the DoOnce starts at o then when finished set it to 1 or in the middle of the script you could set it to 1 and at the end set it to 2. I have tried something along these lines before.

Also timer does not have to be in an IF statment and setting DoOnce should always be last, even if it is outside the statment it works.
[color="#9ACD32"]How do you Skyrim? Show Us in TES Alliance's [url="http://tesalliance.org/forums/index.php?/forum/112-official-skyrim-contest/"]Salute to Skyrim Contest[/url]![/color]
Reply
04-27-2007, 04:06 PM,
#15
 
Script example.
Code:
scriptname [Name Here]

float timer
short DoOnce

Begin Gamemode ; This is used for quests mainly

Set timer to 1

If ( timer > 0 ) && ( DoOnce == o)
  set timer to timer - GetSecondsPassed

else

StopQuest [Quest Name]

endif

set DoOnce to 1

end


Quote:From the CS Wiki
How Object scripts are executed

Every script that is attached to an object or an NPC (Object script) is executed every frame the game displays on screen while the cell with the object is active (when indoors only the cell the PC is currently in is active, when outdoors the PC?s cell and all adjacent cells are active). So the complete script (not just one line of it) is executed 10-60 times a second or however fast your computer runs the game! It is best to imagine every local script wrapped in a big "whileloop":

You use GetSecondsPassed in your script, so it has to be attached to an object.

Your script doesn't work because Set timer to 1/set DoOnce to 1 are not within an if block.

After the first frame the timer is set to 1, the if block is executed and finally DoOnce is set to 1. The second frame sets the timer to 1, ignores the if block (DoOnce == 1) and sets DoOnce to one etc. Conclusion the if block is ignored after the first frame and the timer doesn't work.
Dum loquor, hora fugit  - While I speak the time flies



Ovid 43 BC - 17 AD
Reply
04-27-2007, 10:09 PM,
#16
 
You know what... I don't think anything was wrong with my script, other than the fact it only ran once every five seconds. :O The reason? I realized that I mixed up quests when I was doing the dialogue, so instead of StartQuest [name1], I started [name2] which had a very similar name. Oopsie... Big Grin Great things happen when you wake up refreshed.

I actually used a lot more information in the script than you might think - from both you (sandor) and you (InsanitySorrow). For one, I readjusted a spell effect and got rid of the timer. Thanks for the help. Big Grin The script works now.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)