Jump to content

Help adding timer code to an activator script


Deleted2746547User

Recommended Posts

What I need to do is add a timer code to this script (which I don't know why it formats incorrectly here but anyway) that once the check for items passes and the player activates, it will count down X number of days before enabling the construction (ref). I'd also need to post a new 'completed' message once the timer counted down and enabled the REF. Any suggestions?

 

 

 

scn BlackbriarNorthRedoubtBuildScript

short AwaitingInput
short buttonVar

begin OnActivate

      ShowMessage BlackbriarWashoeNorthRedoubtChoiceMesg
  set awaitingInput to 1
end

begin gamemode
if awaitingInput == 1
	set buttonVar to getbuttonpressed

	if buttonVar > -1
		set awaitingInput to 0

		if buttonVar == 0
			If Player.GetItemCount BlackbriarHammer >= 1 && player.GetItemCount BlackbriarSandbag >= 18 && player.GetItemCount BlackbriarMetalResource >= 6 && player.GetItemCount BlackbriarResourceWood >= 8                    
               		player.removeitem BlackbriarSandbag 18
				player.removeitem BlackbriarMetalResource 6
               		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 BlackbriarConstructionUnderwayMsg; tells player construction is underway
				setobjectivecompleted BlackbriarOpFire 20 1
				setstage BlackbriarOPFire 30
			else BlackbriarWashoeBuildingMaterialsMsg; not enough materials message <-not activating for some reason
		endif
		
	elseif buttonVar == 1
			ShowMessage BlackbriarNextTimeMsg
		endif
	endif
endif
end

Edited by Guest
Link to comment
Share on other sites

  • Replies 86
  • Created
  • Last Reply

Top Posters In This Topic

The way this script is laid out it looks like it works with a message with buttons? am i right...If so could you post a pic of the message.

 

 

strange thing though, if you don't have the materials, you don't get the else BlackbriarWashoeBuildingMaterialsMsg error message...

 

 

Edited by Guest
Link to comment
Share on other sites

Ok now that i have had a chance to see the message i will fix the script for you. I see some ways to also make it better,

 

In the message on Button 0 you should put in the Item conditions box

 


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

This will make the button not show unless the player has all of these items

Edited by Capt Mitch
Link to comment
Share on other sites

Ok now that i have had a chance to see the message i will fix the script for you. I see some ways to also make it better,

 

In the message on Button 0 you should put in the Item conditions box

 


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

This will make the button not show unless the player has all of these items

 

Question though, how would the player know (off hand) that he simply doesn't have the materials to build it but that when he does, the button will show? That was kind of what the follow up message was supposed to do (the one about materials)?

 

Thoughts?

Link to comment
Share on other sites

Ok now that i have had a chance to see the message i will fix the script for you. I see some ways to also make it better,

 

In the message on Button 0 you should put in the Item conditions box

 


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

This will make the button not show unless the player has all of these items

 

Question though, how would the player know (off hand) that he simply doesn't have the materials to build it but that when he does, the button will show? That was kind of what the follow up message was supposed to do (the one about materials)?

 

Thoughts?

 

You already have in the message the required items. Simply put int the message THE BUTTON WILL NOT SHOW UNLESS YOU HAVE THE REQUIRED ITEMS and or you can add another button that says missing materials and if you click it, it will show what items are missing.

 

Now about the timer you want in this script?

Edited by Capt Mitch
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

I really think your going to like this!!!!!

 

How this will go is IF the player has enough materials the build button will be displayed.

Reguardless of the material the 2nd button will show him how much of each of the 4 diffrent materials he currently has AND how many is still needed ;)

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...