Jump to content

Help adding timer code to an activator script


Deleted2746547User

Recommended Posts

Im almost done writing the script

 

You are going to have to make some modifications to that message and also change the missing material message. I will tell you what to change it to once i have this script done.

But i need to know how you want the timmer to work. I'm guessing a cool down timer correct. if so how long.

 

Well, whatever you think is best. I had figured each project (because there are at least 40 others) / script would take 1 - 7 game days. So, the redoubt might take 4 while building a command tent might take 1

 

So the script im rewriting should have a cool-down of 4 days?

All i have left with this script is the timer.

I need you to modify the Material List Message (the message that displayed if the player did not have enough materials)

Edited by Capt Mitch
Link to comment
Share on other sites

  • Replies 86
  • Created
  • Last Reply

Top Posters In This Topic

Ok this is VERY important!

 

the BlackbriarWashoeBuildingMaterialsMsg message text needs to read

 

I can say whatever you want here.

You have (%.0f) Blackbriar Hammers 1 is required, Leaving you (%.0f)
you have (%.0f) Blackbriar Sandbags 18 is required, Leaving you (%.0f)
You have (%.0f) Blackbriar Metal Resources 6 is required, Leaving you (%.0f)
You have (%.0f) Blackbriar Resource Wood 8 is required, Leaving you (%.0f)

 

There needs to be 2 buttons in this message also

Button 0 is a back button

Button 1 is a nevermind button

Edited by Capt Mitch
Link to comment
Share on other sites

Here is your new Advanced production script

 


scn BlackbriarNorthRedoubtBuildScript

float CoolDownTimer

int AwaitingInput
int MenuLvl
int buttonVar1
int ButtonVar2

int BBHammerCount
int BBHammerTotal
int BBSandbagCount
int BBSandbagTotal
int MetalResourceCount
int MetalResourceTotal
int ResourceWoodCount
int ResourceWoodTotal

Begin OnActivate
if (CoolDownTimer > 0)
	ShowMessage BlackbriarWashoeNorthRedoubtCoolDown CoolDownTimer
else
	ShowMessage BlackbriarWashoeNorthRedoubtChoiceMesg
	set MenuLvl to 1
	set awaitingInput to 1
endif
End

Begin GameMode
if (awaitingInput == 1)

	if (MenuLvl == 1)
		set buttonVar1 to GetButtonPressed

		if (buttonVar1 == -1)
			Return

		elseif (buttonVar1 == 0)                                   ;=======================================================
			player.RemoveItem BlackbriarSandbag 18             ;                                                      |
			player.RemoveItem BlackbriarMetalResource 6        ;           Removes items for construction             |
			player.RemoveItem BlackbriarResourceWood 8         ;                                                      |

			BlackbriarNorthernRedoubtActivatorRef.Enable       ; enables x marker to build firebase                   |
			BlackbriarNorthRedoubtActivatorRef.Disable         ; removes the anvil build base activator item from area|
			BlackbriarNorthRedoubtActivatorRef.markfordelete   ;                                                      |
			BlackbriarNorthRedoubtMapMarker.Enable             ;                                                      |
			BlackbriarPowderGangerMapMarker.Disable            ;                                                      |
			;                                                                                                         |
			ShowMessage BlackbriarConstructionUnderwayMs       ; tells player construction is underway                |
			;                                                                                                         |
			setobjectivecompleted BlackbriarOpFire 20 1        ;                                                      |
			SetStage BlackbriarOPFire 30                       ;=======================================================
			set CoolDownTimer to 4

		elseif (buttonVar1 == 1)
			set BBHammerCount to Player.GetItemCount BlackbriarHammer
			set BBSandbagCount to player.GetItemCount BlackbriarSandbag
			set MetalResourceCount to player.GetItemCount BlackbriarMetalResource
			set ResourceWoodCount to player.GetItemCount BlackbriarResourceWood
			set BBHammerTotal to (BBHammerCount - 1)
			set BBSandbagTotal to (BBSandbagCount - 18)
			set MetalResourceTotal to (MetalResourceCount - 6)
			set ResourceWoodTotal to (ResourceWoodCount - 8)

			set MenuLvl to 2
			ShowMessage BlackbriarWashoeBuildingMaterialsMsg BBHammerCount BBSandbagCount MetalResourceCount ResourceWoodCount BBHammerTotal BBSandbagTotal MetalResourceTotal ResourceWoodTotal

		elseif (buttonVar1 == 2)
			set awaitingInput to 0
			ShowMessage BlackbriarNextTimeMsg
		endif

	elseif (MenuLvl == 2)
		set buttonVar2 to GetButtonPressed

		if (buttonVar2 == -1)
			Return
		elseif (buttonVar2 == 0)
			set MenuLvl to 1
			ShowMessage BlackbriarWashoeNorthRedoubtChoiceMesg

		elseif (buttonVar2 == 1)
			set awaitingInput to 0
			ShowMessage BlackbriarNextTimeMsg
		endif
	endif
endif

if (CoolDownTimer > 0)
	set CoolDownTimer to CoolDownTimer - GetDaysPassed
endif
End

 

Link to comment
Share on other sites

Ok you need to make another message with a ID BlackbriarWashoeNorthRedoubtCoolDown

And it can say whatever you want but it MUST have this in the message.

 

You must wait (%.0f) Days before you can start the Redoubt project again.

 

Just curious.... what does this do? I mean... just so I understand. Does this reflect the building time?

Link to comment
Share on other sites

ok so a recap

 

You need to make a message with the ID BlackbriarWashoeNorthRedoubtCoolDown

that has:

You must wait (%.0f) Days before you can start the Redoubt project again.

This message tells the player how many days he must wait before he can start the Redoubt project again

 

the BlackbriarWashoeNorthRedoubtChoiceMesg MESSAGE needs to have 3 buttons

 

Button 0 Build button with the conditions:


Condition Function   	Function Parameters       	Value        Run On
GetItemCount         	BlackbriarHammer              == 1     	Refrence == Player
GetItemCount         	BlackbriarSandbag         	>= 18        Refrence == Player
GetItemCount         	BlackbriarMetalResource   	>= 6     	Refrence == Player
GetItemCount         	BlackbriarResourceWood        >= 8     	Refrence == Player

 

 

Button 1 Material list Button

Button 2 Nevermind

 

And you need the BlackbriarWashoeBuildingMaterialsMsg

to have this in the message:


You have (%.0f) Blackbriar Hammers 1 is required, Leaving you (%.0f)
you have (%.0f) Blackbriar Sandbags 18 is required, Leaving you (%.0f)
You have (%.0f) Blackbriar Metal Resources 6 is required, Leaving you (%.0f)
You have (%.0f) Blackbriar Resource Wood 8 is required, Leaving you (%.0f)

This Message tells the player how many of each item he has, how many is needed and how many he will have left after the project is started.

 

This Message has 2 buttons

Button 0 is a BACK button that will take you back to the BlackbriarWashoeNorthRedoubtChoiceMesg (Already programmed just make the button)

Button 1 is a nevermind button

 

Edited by Capt Mitch
Link to comment
Share on other sites

Ok you need to make another message with a ID BlackbriarWashoeNorthRedoubtCoolDown

And it can say whatever you want but it MUST have this in the message.

 

You must wait (%.0f) Days before you can start the Redoubt project again.

 

Just curious.... what does this do? I mean... just so I understand. Does this reflect the building time?

 

This tells the player how many DAYS he has left before he can start the project again ;)

Link to comment
Share on other sites

getting an error on Line 94 ?

 

 

Here is your new Advanced production script

 


scn BlackbriarNorthRedoubtBuildScript

float CoolDownTimer

int AwaitingInput
int MenuLvl
int buttonVar1
int ButtonVar2

int BBHammerCount
int BBHammerTotal
int BBSandbagCount
int BBSandbagTotal
int MetalResourceCount
int MetalResourceTotal
int ResourceWoodCount
int ResourceWoodTotal

Begin OnActivate
if (CoolDownTimer > 0)
	ShowMessage BlackbriarWashoeNorthRedoubtCoolDown CoolDownTimer
else
	ShowMessage BlackbriarWashoeNorthRedoubtChoiceMesg
	set MenuLvl to 1
	set awaitingInput to 1
endif
End

Begin GameMode
if (awaitingInput == 1)

	if (MenuLvl == 1)
		set buttonVar1 to GetButtonPressed

		if (buttonVar1 == -1)
			Return

		elseif (buttonVar1 == 0)                                   ;=======================================================
			player.RemoveItem BlackbriarSandbag 18             ;                                                      |
			player.RemoveItem BlackbriarMetalResource 6        ;           Removes items for construction             |
			player.RemoveItem BlackbriarResourceWood 8         ;                                                      |

			BlackbriarNorthernRedoubtActivatorRef.Enable       ; enables x marker to build firebase                   |
			BlackbriarNorthRedoubtActivatorRef.Disable         ; removes the anvil build base activator item from area|
			BlackbriarNorthRedoubtActivatorRef.markfordelete   ;                                                      |
			BlackbriarNorthRedoubtMapMarker.Enable             ;                                                      |
			BlackbriarPowderGangerMapMarker.Disable            ;                                                      |
			;                                                                                                         |
			ShowMessage BlackbriarConstructionUnderwayMs       ; tells player construction is underway                |
			;                                                                                                         |
			setobjectivecompleted BlackbriarOpFire 20 1        ;                                                      |
			SetStage BlackbriarOPFire 30                       ;=======================================================
			set CoolDownTimer to 4

		elseif (buttonVar1 == 1)
			set BBHammerCount to Player.GetItemCount BlackbriarHammer
			set BBSandbagCount to player.GetItemCount BlackbriarSandbag
			set MetalResourceCount to player.GetItemCount BlackbriarMetalResource
			set ResourceWoodCount to player.GetItemCount BlackbriarResourceWood
			set BBHammerTotal to (BBHammerCount - 1)
			set BBSandbagTotal to (BBSandbagCount - 18)
			set MetalResourceTotal to (MetalResourceCount - 6)
			set ResourceWoodTotal to (ResourceWoodCount - 8)

			set MenuLvl to 2
			ShowMessage BlackbriarWashoeBuildingMaterialsMsg BBHammerCount BBSandbagCount MetalResourceCount ResourceWoodCount BBHammerTotal BBSandbagTotal MetalResourceTotal ResourceWoodTotal

		elseif (buttonVar1 == 2)
			set awaitingInput to 0
			ShowMessage BlackbriarNextTimeMsg
		endif

	elseif (MenuLvl == 2)
		set buttonVar2 to GetButtonPressed

		if (buttonVar2 == -1)
			Return
		elseif (buttonVar2 == 0)
			set MenuLvl to 1
			ShowMessage BlackbriarWashoeNorthRedoubtChoiceMesg

		elseif (buttonVar2 == 1)
			set awaitingInput to 0
			ShowMessage BlackbriarNextTimeMsg
		endif
	endif
endif

if (CoolDownTimer > 0)
	set CoolDownTimer to CoolDownTimer - GetDaysPassed
endif
End

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...