• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

Day system

Status
Not open for further replies.
Level 2
Joined
Dec 7, 2008
Messages
8
What im trying to do is create a sort of basic day system. the first day is set to monday then when the day is over it increments the day variable and at the start of the day says what day it is based on the number. this is the general layout i have for each day but the problem is that the first day is displayed properly and then tuesday is right but after that it stops giving any messages or doing anything really. any help is appreciated

this is not the entire code, i have not included the rest of the days because they have a repeated format that is the same as the two below
Code:
Game - The in-game time of day becomes Equal to 24.00

If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    If - Conditions
        day Equal to 1
    Then - Actions
        Set day = 2
        Game - Display to (All players) the text: Today is Monday. Pa...
    Else - Actions

If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    If - Conditions
        day Equal to 2
    Then - Actions
        Set day = 3
        Game - Display to (All players) the text: Today is Tuesday. P...
    Else - Actions
 
Level 13
Joined
Sep 14, 2008
Messages
1,407
No please not infinite "ifs".

Go like this:

Game time becomes 24
If(day == 7)
Then: set day = 1
else: set day = day + 1
Display to all players MessageArray[day]

with the messageArray including the messages for the single days (e.g. messageArray[1] = Today is monday. Fuel will be cheap today)
 
Level 10
Joined
Aug 15, 2008
Messages
720
Use this.

  • Variables
    • Events
      • Time - Elapsed game time is 0.01 seconds
    • Conditions
    • Actions
      • Set DMSG_INT = 0
      • Set DayMSG[0] = Today is monday
      • Set DayMSG[1] = Today is tuesday
      • Set DayMSG[2] = Today is wednesday
      • Set DayMSG[3] = Today is thursday
      • Set DayMSG[4] = Today is friday
      • Set DayMSG[5] = Today is saturday
      • Set DayMSG[6] = Today is sunday
      • Set day = 1
  • Example
    • Events
      • Game - The in-game time of day becomes Equal to 24.00
    • Conditions
    • Actions
      • Game - Display to (All players) the text: (DayMSG[DMSG_INT] + ( Day + (String(day))))
      • Set day = (day + 1)
      • Set DMSG_INT = (DMSG_INT + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DMSG_INT Greater than 6
        • Then - Actions
          • Set DMSG_INT = 0
        • Else - Actions
EDIT: Heh. Azazel posted similiar answer already =p
 
Level 2
Joined
Dec 7, 2008
Messages
8
mmkay ive modelled my code after dark's and the problem im having is the days aren't changing, after the first day nothing else is displayed. i have more or less what you have dark and i can't see a problem with how im adding the days or displaying them.

Code:
day
    Events
        Game - The in-game time of day becomes Equal to 24.00
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                day Equal to 6
            Then - Actions
                Set day = 0
            Else - Actions
                Set day = (day + 1)
                Game - Display to (All players) the text: daymess[day]

Melee Initialization
    Events
        Time - Elapsed game time is 0.01 seconds
    Conditions
    Actions
        Set day = 0
        Set daymess[0] = Today is monday. Expenses (Lumber) will be due on sunday night. If you do not have enough gold you will become bankrupt.
        Set daymess[1] = Today is tuesday. Expenses (Lumber) will be due on sunday night. If you do not have enough gold you will become bankrupt.
        Set daymess[2] = Today is wensday. Expenses (Lumber) will be due on sunday night. If you do not have enough gold you will become bankrupt.
        Set daymess[3] = Today is thursday. Expenses (Lumber) will be due on sunday night. If you do not have enough gold you will become bankrupt.
        Set daymess[4] = Today is friday. Expenses (Lumber) will be due on sunday night. If you do not have enough gold you will become bankrupt.
        Set daymess[5] = Today is saturday. Expenses (Lumber) will be due on sunday night. If you do not have enough gold you will become bankrupt.
        Set daymess[6] = Today is Sunday. Expenses (Lumber) will be due on sunday night. If you do not have enough gold you will become bankrupt.
 
Level 2
Joined
Dec 7, 2008
Messages
8
i assume this is what you mean?

Code:
Melee Initialization
    Events
        Time - Elapsed game time is 0.01 seconds
    Conditions
    Actions
        Set day = 0
        Set daymess[0] = Today is monday. Expenses (Lumber) will be due on sunday night. If you do not have enough gold you will become bankrupt.
        Set daymess[1] = Today is tuesday. Expenses (Lumber) will be due on sunday night. If you do not have enough gold you will become bankrupt.
        Set daymess[2] = Today is wensday. Expenses (Lumber) will be due on sunday night. If you do not have enough gold you will become bankrupt.
        Set daymess[3] = Today is thursday. Expenses (Lumber) will be due on sunday night. If you do not have enough gold you will become bankrupt.
        Set daymess[4] = Today is friday. Expenses (Lumber) will be due on sunday night. If you do not have enough gold you will become bankrupt.
        Set daymess[5] = Today is saturday. Expenses (Lumber) will be due on sunday night. If you do not have enough gold you will become bankrupt.
        Set daymess[6] = Today is Sunday. Expenses (Lumber) will be due on sunday night. If you do not have enough gold you will become bankrupt.
        Player Group - Pick every player in (All players) and do (Actions)
            Loop - Actions
                Player - Set (Picked player) Current gold to 1000
                Player - Disable Azula  for (Picked player)
                Player - Disable Aang  for (Picked player)
                Player - Disable Katara  for (Picked player)
                Player - Disable Sokka  for (Picked player)
                Player - Disable Toph  for (Picked player)
                Player - Disable Ty Lee  for (Picked player)
                Player - Disable Zuko  for (Picked player)
with that change i dont get any message at all
 
Status
Not open for further replies.
Top