Jump to content

Placeatme lights and timers


mazakala

Recommended Posts

In my campfire mod, Mazas portable campfires, I have an item which when on the ground and activated spawns a carryable light object which looks like a campfire, no problem there. When activated the campfire has a menu that lets you put it out (disable + markfordelete) No problem there either. Then someone requested a third option to let the fire burn out in 12 hours, no big deal right? The problem is I can't seem to make a working 12 h timer. I've done many timers in the past, in fact the fire already has another timer for the crackling campfire sound.

I made a timer which used gamedayspassed and gamehour, but when it should've ran out nothing happened. Then I made one which used only gamedayspassed but that didn't work either, I even tried to make one that counted the seconds... No luck.

I don't have the scripts anymore, so I'm just asking for an example script for a 12 hour timer.

I know that the blocks ran just fine, but the countdown never finished. If there's something which makes longer timers impossible for lights created with placeatme please enlighten me :D

Link to comment
Share on other sites

There's nothing to prevent references created via PlaceAtMe from running timers. Here is an example of a timer that uses GameDaysPassed to delay an event by 12 in-game hours:

float fEndTime

Begin GameMode

; Initialise the timer with a "set" command like this
if <Initialise Timer>
	set fEndTime to GameDaysPassed + 1 ; 1 day in the future
endif

; GameDaysPassed counts up by itself, so just use a condition like this for your timer
if GameDaysPassed > fEndTime
	; Time up - 1 day in-game has passed since the timer was initialised
endif

End

Let me know if you have any questions about using a GameDaysPassed timer (or any other type of timer).

 

Cipscis

Link to comment
Share on other sites

There's nothing to prevent references created via PlaceAtMe from running timers. Here is an example of a timer that uses GameDaysPassed to delay an event by 12 in-game hours:

 

My script looked quite similar... I'll attempt to reconstruct it from what I remember:

 

scn mzcftestscript

float stoptime
short timeractive

begin onactivate
showmessage mzcampfireactivateMSG;shows the menu
end

begin gamemode
if getbuttonpressed == 0
;removes the campfire 
disable
markfordelete
elseif getbuttonpressed == 1
; activates the timer
set timeractive to 1 
set stoptime to gamedayspassed + 0.5 ;12 hours forward in time 
elseif getbuttonpressed == 2
; do nothing
endif
end

begin gamemode
if timeractive == 1 && stoptime < gamedayspassed
disable
markfordelete
endif
end

 

Complications of using multiple gamemode blocks maybe? haven't had problems with that in the past... I'm clueless. :(

Link to comment
Share on other sites

  • Recently Browsing   0 members

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