slylok
  • slylok
  • 54.5% (Neutral)
  • Private Topic Starter
15 years ago
I can't figure out how to create a Timer. There are scripts that try to reference a counter, but im assuming that I first need to create one so I can point to it.

Does anyone know how to do this?

Here is what i have so far:

*** IF ***
Player '' has entered building named Unit 'Objective Building'
*** THEN ***
Set timer '???' to expire in 300 frames.
Sponsor
Annihilationzh
15 years ago
*** IF ***
Player 'player0' has entered building named Unit 'Objective Building'
*** THEN ***
Set timer '???' to expire in 10 seconds

IIRC, the seconds countdown timer should be near the frames countdown timer in the scripts.

player0 is the host of the game. You'll need to make another script with: player1, player2, player3, etc to refer to the other players.
If you need help, post in the forum. You'll get help a lot faster than if you send me a PM.

I reject all buddy requests. I don't think 'buddy' needs to be made official. It's not like you're marrying me.
slylok
  • slylok
  • 54.5% (Neutral)
  • Private Topic Starter
15 years ago
Thank you Annihilationzh, but how do I create a timer for the script to reference? when I click the '???' there are no options to select and if I type something in I get a warning saying that it doesn't exist.

It makes me think that I need to first create a named timer, but I have no clue where to do that.

My goal is for a timer to start counting down once the building is captured by a player on a multiplayer skirmish. once the timer expires that player wins. if another player captures it before the timer runs out then the timer restarts. I basically want a multiplayer skirmish where everyone is fighting to control one building.

slylok
  • slylok
  • 54.5% (Neutral)
  • Private Topic Starter
15 years ago
i think i have resolved the timer issue, however i cant test my map...I have saved the map in the user maps, but it doesn't show up under the unofficial maps when i try to start a game. did i miss a step?
Drummin
15 years ago
Annihilationzh basically laid it out for you. Just name the timer where the three ??? marks are. You'll find the script under Scripting/Timer. Obviously you'll need to work out stopping the timer if the player doesn't own the building.

As far as not seeing your map; be sure you haven't entered a name under Edit/Edit Map Settings/Name. That spot should be left blank for custom maps.
slylok
  • slylok
  • 54.5% (Neutral)
  • Private Topic Starter
15 years ago
Thank you guys. your advice has worked for the timer and seeing the map in game.

now i cant for the life of me get the timer to start counting down or display itself in the game. This is what i have so far for the code.

*** IF ***
Unit 'Objective Building' is owned by Player 'player0'
*** THEN ***
Run Subroutine 'Countdown'.

//subroutine 'Countdown'
*** IF ***
True.
*** THEN ***
Set timer 'EndGame' to expire in 30.00 seconds.
Show 'EndGame' with text Localized String: 'SCRIPT:CHI02xReinforcementTimer'

*** IF ***
Timer 'EndGame' has expired.
*** THEN ***
The screen will shake with Shake Intensity: Normal
Show 'Victorious' window and end game


When i test it, i send a guy to capture the building, but when he captures it nothing is displayed and nothing happens after 30 seconds. Any suggestions?
Drummin
15 years ago
Change it to a standard script and have it in the PlyrCivilian folder if it isn't already.
slylok
  • slylok
  • 54.5% (Neutral)
  • Private Topic Starter
15 years ago
Thanks Drummin 🙂 It worked when i put all of them in the PlyrCivilian folder. What are the rules for what goes in which folder?

Also i cant get the sequential scripts to work correctly. I want the camera to snap to the center of the map and rotate around a waypoint when the timer expires, but it will only do one or the other. I can't get it to do both. They are both in the PlyrCivilian folder.

*** IF ***
Timer 'EndGame' has expired.
*** THEN ***
Team 'teamPlyrCivilian' executes Script 'gameOver' sequentially.

//gameOver Subroutine
*** IF ***
True.
*** THEN ***
Move camera to Waypoint 'endView' in 0.00 seconds, camera shutter 0.00 seconds, ease-in 0.00 seconds, ease-out 0.00 seconds.
Rotate 1.00 times, taking 30.00 seconds, ease-in 0.00 seconds, ease-out 0.00 seconds.
Disable mouse and keyboard input.
Idle all units for all players.


i've been reading the Zero Hour: Worldbuilder PDF and following what it says, but it seems that it leaves alot to trial and error. Thank you for all of your help so far.
Drummin
15 years ago
I believe for any scripting related to the interface needs to be in the PlyrCivilian folder, such at showing timers, briefings and camera actions.

It's been some time sense I worked with Generals/ZeroHour WB but I believe it would be easier to break this into standard scripts with timers, as camera actions don't play nice with subroutines. Not that it can't be done with a sequential subroutine's it's just I don't recall what would make it work. I would do something like this.
*** IF ***
    Timer 'EndGame' has expired.
*** THEN ***
  Disable mouse and keyboard input.
  Start letterbox mode (hide UI, add border).
  Fade (1-0) from 1.00 to 0.00 multiplying toward black. Take  30  frames to increase, hold for  2  fames, and decrease  30  frames.
  Set timer 'camera1' to expire in  31  frames.
  Set timer 'camera2' to expire in  32  frames.
  Set timer 'TestingRestoreMouse' to expire in 31.00 seconds.
*** IF ***
    Timer 'camera1' has expired.
*** THEN ***
  Idle all units for all players.
  Move camera to Waypoint 'endView' in 0.00 seconds, camera shutter 0.00 seconds, ease-in 0.00 seconds, ease-out 0.00 seconds.
*** IF ***
    Timer 'camera2' has expired.
*** THEN ***
  Rotate 1.00 times, taking 30.00 seconds, ease-in 0.00 seconds, ease-out 0.00 seconds.
Added for testing
*** IF ***
    Timer 'TestingRestoreMouse' has expired.
*** THEN ***
  Enable mouse and keyboard input.