Need help for scripting

Post » Sun Aug 08, 2010 8:46 pm

Hi i have created a new quest. A man making bets, you give him 200 caps, you wait 1 day, and he gibe you 500 caps back.
I encounter problems with the f****** timer lol, i am not skilled in scripting (neither in english lol i am french)

i try many scripts but i reach only 2 results

no effect
or unlimited display of the timer ending message.

the script ou produce no effect is :

SCN MalouBetmanTimerScript

float BetmanTimer
float fQuestDelayTime

begin GameMode
if getstage MalouBetmanQst == 20
set fQuestDelayTime to 0.001

set BetmanTimer to 15

if BetmanTimer > 0
set BetmanTimer to (BetmanTimer - getSecondsPassed)
else
ShowMessage MalouBetmanGetMoney
Setstage MalouBetmanQst 25
endif
endif
end

this is a quest script. Actually my problem is to create a timer wich starts when I give to Betman 200 caps. i want it to disable before and i want it to restart, because player can make another bet after the first has ended (allow multiple stages quest). i want it to start at quest stage 20 and i want it to stop and RESET at quest stage 25.

I have try another method, i have attached the script on a trigger, i have disable the trigger and make a trigger.enable at my stage 20 but with this method, the message display infinite times. I have try a "doOnce" thing too, i am lost.

Can someone help me please. i am newbie at scripting but i learn and understand well.
Thank you for reading. :flamethrower:
User avatar
Hella Beast
 
Posts: 3434
Joined: Mon Jul 16, 2007 2:50 am

Post » Sun Aug 08, 2010 6:55 pm

of course the "15" was to make a test with 15 seconds :brokencomputer:
User avatar
Syaza Ramali
 
Posts: 3466
Joined: Wed Jan 24, 2007 10:46 am

Post » Sun Aug 08, 2010 12:51 pm

Try...
scn MalouBetmanTimerScriptfloat fBetmanTimerfloat fQuestDelayTimeInt bDoOnceBegin GameMode	If (GetStage MalouBetmanQst == 20)		If bDoOnce			If (fBetmanTimer <= 0)				ShowMessage MalouBetmanGetMoney				SetStage MalouBetmanQst 25				Set fQuestDelayTime to 0			Else				Set fBetmanTimer to (fBetmanTimer - GetSecondsPassed)			EndIf		Else				Set bDoOnce to 1			Set BetmanTimer to 15			Set fQuestDelayTime to 0.01		EndIf	EndIfEnd


The problem was the 'Set fBetmanTimer to 15' right before the 'If (fBetmanTimer > 0)/Else' as fBetmanTimer would always have a value of 15 so the 'Else' wouldn't fire with your message.
User avatar
Andrew Tarango
 
Posts: 3454
Joined: Wed Oct 17, 2007 10:07 am

Post » Sun Aug 08, 2010 10:25 am

Oh my god you are a genius ! it worked well.
I link the script to a trigger instead of the quest but it worked.
I have some questions for you :)

What is the little "f" you put on you floats or integrers ? is it important ?
the phrase "if bdoOnce" means "if bdoonce == 0" ??
and a little last question, do you know how much seconds i have to set for fbetmantimer to wait 1 day in fallout ? i ask that because with the fQuestDelayTime i guess 86400 real seconds mean a few days in fallout.
a real hour maybe ? 3600 ?

Thank you very much JustinOther :vaultboy: :celebration:
User avatar
Elisha KIng
 
Posts: 3285
Joined: Sat Aug 18, 2007 12:18 am

Post » Sun Aug 08, 2010 11:03 am

Oh my god you are a genius ! it worked well.
I link the script to a trigger instead of the quest but it worked.
I have some questions for you :)

What is the little "f" you put on you floats or integrers ? is it important ?
the phrase "if bdoOnce" means "if bdoonce == 0" ??
and a little last question, do you know how much seconds i have to set for fbetmantimer to wait 1 day in fallout ? i ask that because with the fQuestDelayTime i guess 86400 real seconds mean a few days in fallout.
a real hour maybe ? 3600 ?

Thank you very much JustinOther :vaultboy: :celebration:
Glad to help you pull some stops :)

The lower case variable prefixes are visual indicators showing what types of variables they are.

bBoolean
fFloat
iInteger
sShort
rReference

It just helps one when keeping track of variables to be able to see, for instance, if a Short/Long/Int is a boolean or not or to allow groups of variables to be similarly named. All of the game settings and .ini settings follow this nomenclature, so some carry it into their scripts.


***
bDoOnce:

If bDoOnce    DoStuffEndIf
...is the same as...
If (bDoOnce != 0)    DoStuffEndIf
...while...
If (bDoOnce == 0)    DoStuffEndIf
...is also expressable as...
If bDoOnceElse    DoStuffEndIf

***

fBetManTimer: You could use the built in and maintained float global, GameDaysPassed.

fBetManTimerStartfBetManTimerEndBegin GameMode	If bDoOnce		If (GameDaysPassed >= fBetManTimer)			DoStuff		EndIf 	ElseIf Criterion		Set bDoOnce to 1		Set fBetManTimer to (GameDaysPassed + 1)	EndIfEnd

I'm not sure about the seconds in a game day, but I think the above should work... :shrug:
User avatar
dav
 
Posts: 3338
Joined: Mon Jul 30, 2007 3:46 pm


Return to Fallout 3