• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Expected endif error? GUI

Status
Not open for further replies.
Level 11
Joined
Apr 17, 2011
Messages
302
So I was coding some stuff for my WoW III project and it worked until I added basically the same lines with different conditions.

I had it working at Mage, I then added the other classes and it stopped working throwing me the Expected endif errors, hundreds of them with a few others.

I'm hoping one of you more experienced coders will know what the problem is.

Thanks :)

EDIT Code bugs a bit on here at the Shaman (High Elf Male) part.

  • Hero Generation
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Gender Equal to True
          • Race Equal to 0
          • HeroClass Equal to Hunter
        • Then - Actions
          • Unit - Remove Pet from the game
          • Unit - Remove Player from the game
          • Unit - Create 1 Hunter (Human Male) for Player 1 (Red) at (Center of Hero <gen>) facing 270.00 degrees
          • Set Player = (Last created unit)
          • Unit - Create 1 Pet for Player 1 (Red) at (Center of Pet <gen>) facing 270.00 degrees
          • Set Pet = (Last created unit)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Gender Equal to False
              • Race Equal to 0
              • HeroClass Equal to Hunter
            • Then - Actions
              • Unit - Remove Pet from the game
              • Unit - Remove Player from the game
              • Unit - Create 1 Hunter (Human Female) for Player 1 (Red) at (Center of Hero <gen>) facing 270.00 degrees
              • Set Player = (Last created unit)
              • Unit - Create 1 Pet for Player 1 (Red) at (Center of Pet <gen>) facing 270.00 degrees
              • Set Pet = (Last created unit)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Gender Equal to True
                  • Race Equal to 1
                  • HeroClass Equal to Hunter
                • Then - Actions
                  • Unit - Remove Pet from the game
                  • Unit - Remove Player from the game
                  • Unit - Create 1 Hunter (High Elf Male) for Player 1 (Red) at (Center of Hero <gen>) facing 270.00 degrees
                  • Set Player = (Last created unit)
                  • Unit - Create 1 Pet for Player 1 (Red) at (Center of Pet <gen>) facing 270.00 degrees
                  • Set Pet = (Last created unit)
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Gender Equal to False
                      • Race Equal to 1
                      • HeroClass Equal to Hunter
                    • Then - Actions
                      • Unit - Remove Pet from the game
                      • Unit - Remove Player from the game
                      • Unit - Create 1 Hunter (High Elf Female) for Player 1 (Red) at (Center of Hero <gen>) facing 270.00 degrees
                      • Set Player = (Last created unit)
                      • Unit - Create 1 Pet for Player 1 (Red) at (Center of Pet <gen>) facing 270.00 degrees
                      • Set Pet = (Last created unit)
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Gender Equal to True
                          • Race Equal to 0
                          • HeroClass Equal to Druid
                        • Then - Actions
                          • Unit - Remove Pet from the game
                          • Unit - Remove Player from the game
                          • Unit - Create 1 Druid (Human Male) for Player 1 (Red) at (Center of Hero <gen>) facing 270.00 degrees
                          • Set Player = (Last created unit)
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • Gender Equal to False
                              • Race Equal to 0
                              • HeroClass Equal to Druid
                            • Then - Actions
                              • Unit - Remove Pet from the game
                              • Unit - Remove Player from the game
                              • Unit - Create 1 Druid (Human Female) for Player 1 (Red) at (Center of Hero <gen>) facing 270.00 degrees
                              • Set Player = (Last created unit)
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • Gender Equal to True
                                  • Race Equal to 1
                                  • HeroClass Equal to Druid
                                • Then - Actions
                                  • Unit - Remove Pet from the game
                                  • Unit - Remove Player from the game
                                  • Unit - Create 1 Druid (High Elf Male) for Player 1 (Red) at (Center of Hero <gen>) facing 270.00 degrees
                                  • Set Player = (Last created unit)
                                • Else - Actions
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • Gender Equal to False
                                      • Race Equal to 1
                                      • HeroClass Equal to Druid
                                    • Then - Actions
                                      • Unit - Remove Pet from the game
                                      • Unit - Remove Player from the game
                                      • Unit - Create 1 Druid (High Elf Female) for Player 1 (Red) at (Center of Hero <gen>) facing 270.00 degrees
                                      • Set Player = (Last created unit)
                                    • Else - Actions
                                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                        • If - Conditions
                                          • Gender Equal to True
                                          • Race Equal to 0
                                          • HeroClass Equal to Mage
                                        • Then - Actions
                                          • Unit - Remove Pet from the game
                                          • Unit - Remove Player from the game
                                          • Unit - Create 1 Mage (Human Male) for Player 1 (Red) at (Center of Hero <gen>) facing 270.00 degrees
                                          • Set Player = (Last created unit)
                                        • Else - Actions
                                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            • If - Conditions
                                              • Gender Equal to False
                                              • Race Equal to 0
                                              • HeroClass Equal to Mage
                                            • Then - Actions
                                              • Unit - Remove Pet from the game
                                              • Unit - Remove Player from the game
                                              • Unit - Create 1 Mage (Human Female) for Player 1 (Red) at (Center of Hero <gen>) facing 270.00 degrees
                                              • Set Player = (Last created unit)
                                            • Else - Actions
                                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                • If - Conditions
                                                  • Gender Equal to True
                                                  • Race Equal to 1
                                                  • HeroClass Equal to Mage
                                                • Then - Actions
                                                  • Unit - Remove Pet from the game
                                                  • Unit - Remove Player from the game
                                                  • Unit - Create 1 Mage (High Elf Male) for Player 1 (Red) at (Center of Hero <gen>) facing 270.00 degrees
                                                  • Set Player = (Last created unit)
                                                • Else - Actions
                                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                    • If - Conditions
                                                      • Gender Equal to False
                                                      • Race Equal to 1
                                                      • HeroClass Equal to Mage
                                                    • Then - Actions
                                                      • Unit - Remove Pet from the game
                                                      • Unit - Remove Player from the game
                                                      • Unit - Create 1 Mage (High Elf Female) for Player 1 (Red) at (Center of Hero <gen>) facing 270.00 degrees
                                                      • Set Player = (Last created unit)
                                                    • Else - Actions
                                                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                        • If - Conditions
                                                          • Gender Equal to True
                                                          • Race Equal to 0
                                                          • HeroClass Equal to Paladin
                                                        • Then - Actions
                                                          • Unit - Remove Pet from the game
                                                          • Unit - Remove Player from the game
                                                          • Unit - Create 1 Paladin (Human Male) for Player 1 (Red) at (Center of Hero <gen>) facing 270.00 degrees
                                                          • Set Player = (Last created unit)
                                                        • Else - Actions
                                                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                            • If - Conditions
                                                              • Gender Equal to False
                                                              • Race Equal to 0
                                                              • HeroClass Equal to Paladin
                                                            • Then - Actions
                                                              • Unit - Remove Pet from the game
                                                              • Unit - Remove Player from the game
                                                              • Unit - Create 1 Paladin (Human Female) for Player 1 (Red) at (Center of Hero <gen>) facing 270.00 degrees
                                                              • Set Player = (Last created unit)
                                                            • Else - Actions
                                                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                                • If - Conditions
                                                                  • Gender Equal to True
                                                                  • Race Equal to 1
                                                                  • HeroClass Equal to Paladin
                                                                • Then - Actions
                                                                  • Unit - Remove Pet from the game
                                                                  • Unit - Remove Player from the game
                                                                  • Unit - Create 1 Paladin (High Elf Male) for Player 1 (Red) at (Center of Hero <gen>) facing 270.00 degrees
                                                                  • Set Player = (Last created unit)
                                                                • Else - Actions
                                                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                                    • If - Conditions
                                                                      • Gender Equal to False
                                                                      • Race Equal to 1
                                                                      • HeroClass Equal to Paladin
                                                                    • Then - Actions
                                                                      • Unit - Remove Pet from the game
                                                                      • Unit - Remove Player from the game
                                                                      • Unit - Create 1 Paladin (High Elf Female) for Player 1 (Red) at (Center of Hero <gen>) facing 270.00 degrees
                                                                      • Set Player = (Last created unit)
                                                                    • Else - Actions
                                                                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                                        • If - Conditions
                                                                          • Gender Equal to True
                                                                          • Race Equal to 0
                                                                          • HeroClass Equal to Priest
                                                                        • Then - Actions
                                                                          • Unit - Remove Pet from the game
                                                                          • Unit - Remove Player from the game
                                                                          • Unit - Create 1 Priest (Human Male) for Player 1 (Red) at (Center of Hero <gen>) facing 270.00 degrees
                                                                          • Set Player = (Last created unit)
                                                                        • Else - Actions
                                                                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                                            • If - Conditions
                                                                              • Gender Equal to False
                                                                              • Race Equal to 0
                                                                              • HeroClass Equal to Priest
                                                                            • Then - Actions
                                                                              • Unit - Remove Pet from the game
                                                                              • Unit - Remove Player from the game
                                                                              • Unit - Create 1 Priest (Human Female) for Player 1 (Red) at (Center of Hero <gen>) facing 270.00 degrees
                                                                              • Set Player = (Last created unit)
                                                                            • Else - Actions
                                                                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                                                • If - Conditions
                                                                                  • Gender Equal to True
                                                                                  • Race Equal to 1
                                                                                  • HeroClass Equal to Priest
                                                                                • Then - Actions
                                                                                  • Unit - Remove Pet from the game
                                                                                  • Unit - Remove Player from the game
                                                                                  • Unit - Create 1 Priest (High Elf Male) for Player 1 (Red) at (Center of Hero <gen>) facing 270.00 degrees
                                                                                  • Set Player = (Last created unit)
                                                                                • Else - Actions
                                                                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                                                    • If - Conditions
                                                                                      • Gender Equal to False
                                                                                      • Race Equal to 1
                                                                                      • HeroClass Equal to Priest
                                                                                    • Then - Actions
                                                                                      • Unit - Remove Pet from the game
                                                                                      • Unit - Remove Player from the game
                                                                                      • Unit - Create 1 Priest (High Elf Female) for Player 1 (Red) at (Center of Hero <gen>) facing 270.00 degrees
                                                                                      • Set Player = (Last created unit)
                                                                                    • Else - Actions
                                                                                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                                                        • If - Conditions
                                                                                          • Gender Equal to True
                                                                                          • Race Equal to 0
                                                                                          • HeroClass Equal to Rogue
                                                                                        • Then - Actions
                                                                                          • Unit - Remove Pet from the game
                                                                                          • Unit - Remove Player from the game
                                                                                          • Unit - Create 1 Rogue (Human Male) for Player 1 (Red) at (Center of Hero <gen>) facing 270.00 degrees
                                                                                          • Set Player = (Last created unit)
                                                                                        • Else - Actions
                                                                                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                                                            • If - Conditions
                                                                                              • Gender Equal to False
                                                                                              • Race Equal to 0
                                                                                              • HeroClass Equal to Rogue
                                                                                            • Then - Actions
                                                                                              • Unit - Remove Pet from the game
                                                                                              • Unit - Remove Player from the game
                                                                                              • Unit - Create 1 Rogue (Human Female) for Player 1 (Red) at (Center of Hero <gen>) facing 270.00 degrees
                                                                                              • Set Player = (Last created unit)
                                                                                            • Else - Actions
                                                                                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                                                                • If - Conditions
                                                                                                  • Gender Equal to True
                                                                                                  • Race Equal to 1
                                                                                                  • HeroClass Equal to Rogue
                                                                                                • Then - Actions
                                                                                                  • Unit - Remove Pet from the game
                                                                                                  • Unit - Remove Player from the game
                                                                                                  • Unit - Create 1 Rogue (High Elf Male) for Player 1 (Red) at (Center of Hero <gen>) facing 270.00 degrees
                                                                                                  • Set Player = (Last created unit)
                                                                                                • Else - Actions
                                                                                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                                                                    • If - Conditions
                                                                                                      • Gender Equal to False
                                                                                                      • Race Equal to 1
                                                                                                      • HeroClass Equal to Rogue
                                                                                                    • Then - Actions
                                                                                                      • Unit - Remove Pet from the game
                                                                                                      • Unit - Remove Player from the game
                                                                                                      • Unit - Create 1 Rogue (High Elf Female) for Player 1 (Red) at (Center of Hero <gen>) facing 270.00 degrees
                                                                                                      • Set Player = (Last created unit)
                                                                                                    • Else - Actions
                                                                                                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                                                                        • If - Conditions
                                                                                                          • Gender Equal to True
                                                                                                          • Race Equal to 0
                                                                                                          • HeroClass Equal to Shaman
                                                                                                        • Then - Actions
                                                                                                          • Unit - Remove Pet from the game
                                                                                                          • Unit - Remove Player from the game
                                                                                                          • Unit - Create 1 Shaman (Human Male) for Player 1 (Red) at (Center of Hero <gen>) facing 270.00 degrees
                                                                                                          • Set Player = (Last created unit)
                                                                                                        • Else - Actions
                                                                                                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                                                                            • If - Conditions
                                                                                                              • Gender Equal to False
                                                                                                              • Race Equal to 0
                                                                                                              • HeroClass Equal to Shaman
                                                                                                            • Then - Actions
                                                                                                              • Unit - Remove Pet from the game
                                                                                                              • Unit - Remove Player from the game
                                                                                                              • Unit - Create 1 Shaman (Human Female) for Player 1 (Red) at (Center of Hero <gen>) facing 270.00 degrees
                                                                                                              • Set Player = (Last created unit)
                                                                                                            • Else - Actions
                                                                                                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                                                                                • If - Conditions
                                                                                                                  • Gender Equal to True
                                                                                                                  • Race Equal to 1
                                                                                                                  • HeroClass Equal to Shaman
                                                                                                                • Then - Actions
                                                                                                                  • Unit - Remove Pet from the game
                                                                                                                  • Unit - Remove Player from the game
                                                                                                                  • Unit - Create 1 Shaman
  • (High Elf Male) for Player 1 (Red) at (Center of Hero <gen>) facing 270.00 degrees
    • Set Player = (Last created unit)
    • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Gender Equal to False
          • Race Equal to 1
          • HeroClass Equal to Shaman
        • Then - Actions
          • Unit - Remove Pet from the game
          • Unit - Remove Player from the game
          • Unit - Create 1 Shaman (High Elf Female) for Player 1 (Red) at (Center of Hero <gen>) facing 270.00 degrees
          • Set Player = (Last created unit)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Gender Equal to True
              • Race Equal to 0
              • HeroClass Equal to Warlock
            • Then - Actions
              • Unit - Remove Pet from the game
              • Unit - Remove Player from the game
              • Unit - Create 1 Warlock (Human Male) for Player 1 (Red) at (Center of Hero <gen>) facing 270.00 degrees
              • Set Player = (Last created unit)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Gender Equal to False
                  • Race Equal to 0
                  • HeroClass Equal to Warlock
                • Then - Actions
                  • Unit - Remove Pet from the game
                  • Unit - Remove Player from the game
                  • Unit - Create 1 Warlock (Human Female) for Player 1 (Red) at (Center of Hero <gen>) facing 270.00 degrees
                  • Set Player = (Last created unit)
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Gender Equal to True
                      • Race Equal to 1
                      • HeroClass Equal to Warlock
                    • Then - Actions
                      • Unit - Remove Pet from the game
                      • Unit - Remove Player from the game
                      • Unit - Create 1 Warlock (High Elf Male) for Player 1 (Red) at (Center of Hero <gen>) facing 270.00 degrees
                      • Set Player = (Last created unit)
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Gender Equal to False
                          • Race Equal to 1
                          • HeroClass Equal to Warlock
                        • Then - Actions
                          • Unit - Remove Pet from the game
                          • Unit - Remove Player from the game
                          • Unit - Create 1 Warlock (High Elf Female) for Player 1 (Red) at (Center of Hero <gen>) facing 270.00 degrees
                          • Set Player = (Last created unit)
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • Gender Equal to True
                              • Race Equal to 0
                              • HeroClass Equal to Warrior
                            • Then - Actions
                              • Unit - Remove Pet from the game
                              • Unit - Remove Player from the game
                              • Unit - Create 1 Warrior (Human Male) for Player 1 (Red) at (Center of Hero <gen>) facing 270.00 degrees
                              • Set Player = (Last created unit)
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • Gender Equal to False
                                  • Race Equal to 0
                                  • HeroClass Equal to Warrior
                                • Then - Actions
                                  • Unit - Remove Pet from the game
                                  • Unit - Remove Player from the game
                                  • Unit - Create 1 Warrior (Human Female) for Player 1 (Red) at (Center of Hero <gen>) facing 270.00 degrees
                                  • Set Player = (Last created unit)
                                • Else - Actions
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • Gender Equal to True
                                      • Race Equal to 1
                                      • HeroClass Equal to Warrior
                                    • Then - Actions
                                      • Unit - Remove Pet from the game
                                      • Unit - Remove Player from the game
                                      • Unit - Create 1 Warrior (High Elf Male) for Player 1 (Red) at (Center of Hero <gen>) facing 270.00 degrees
                                      • Set Player = (Last created unit)
                                    • Else - Actions
                                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                        • If - Conditions
                                          • Gender Equal to False
                                          • Race Equal to 1
                                          • HeroClass Equal to Warrior
                                        • Then - Actions
                                          • Unit - Remove Pet from the game
                                          • Unit - Remove Player from the game
                                          • Unit - Create 1 Warrior (High Elf Female) for Player 1 (Red) at (Center of Hero <gen>) facing 270.00 degrees
                                          • Set Player = (Last created unit)
                                        • Else - Actions
                                          • Do nothing
 

TKF

TKF

Level 19
Joined
Nov 29, 2006
Messages
1,266
Your if then else chain is way to long, when it converts during saving, some info is being chopped off because it becomes insanely long at JASS rawcode state, thus resulting in endif error or some other errors.

Try to seperate gender or races from each other.
 
Level 8
Joined
Jan 28, 2016
Messages
486
Ok cheers. I'll just split it.

I was going to split but only with the other Races I'm going to add. Guess I'll have to do it now.

Do you happen to know what the limit is?

No idea what the limit is.

You can avoid splitting this and get it to work in a single trigger (sort of) which would be much more efficient. What you would do is store the HeroClass variables into an array at map init and then use a loop to check which class your unit is. Then you can add another loop to check the units's race and finally an ITE statement to check the gender.

It's probably a bit more complicated than that but what I wrote is the general idea.
 
Last edited:
Level 11
Joined
Apr 17, 2011
Messages
302
No idea what the limit is.

You can avoid splitting this and get it to work in a single trigger (sort of) which would be much more efficient. What you would do is store the HeroClass variables into an array at map init and then use a loop to check which class your unit is. Then you can add another loop to check the units's race and finally an ITE statement to check the gender.

It's probably a bit more complicated than that but what I wrote is the general idea.

Yeah, I would've used a for loop to check it but the first solution I thought of was to just create a massive if else lol.
It would be better to use a loop, I might look into it a bit more into the future if I ever get round to optimizing the code.

Moved to Triggers & scripts.

Sorry I always get confused about this sort of thing.
I'm not really sure why either... I think it's just me creating some sort of scenario about what each section is about... I don't know...
 
Level 17
Joined
Mar 21, 2011
Messages
1,597
Sorry I always get confused about this sort of thing.
I'm not really sure why either... I think it's just me creating some sort of scenario about what each section is about... I don't know...
"Triggers & Scripts In this forum you may ask for help on fixing a trigger or script. But if you need help getting started with a trigger, this is not the right place — use the World Editor Help Zone."

;)
 
Level 12
Joined
Mar 17, 2007
Messages
412
Yeah, I would've used a for loop to check it but the first solution I thought of was to just create a massive if else lol.
It would be better to use a loop, I might look into it a bit more into the future if I ever get round to optimizing the code.

If you would've used a loop? Anyone who knows how to use them properly would of used it in the first place. Your first solution is just creating more work on yourself. It would better to use a loop & start now not later. Not optimizing it will lead to problems in the future.

Nobody can fully help you unless you reveal all linked triggers. (No events are shown)

If you need further help on this I suggest you to upload the map & send it.
 
Level 11
Joined
Apr 17, 2011
Messages
302
If you would've used a loop? Anyone who knows how to use them properly would of used it in the first place. Your first solution is just creating more work on yourself. It would better to use a loop & start now not later. Not optimizing it will lead to problems in the future.

Nobody can fully help you unless you reveal all linked triggers. (No events are shown)

If you need further help on this I suggest you to upload the map & send it.

True, I'm not going to argue with you there.
But I know more lazy coders who'd just write it out over and over unless they had to use a loop, which in some cases you do.

I have been fully helped. There is no need to comment on here further, unless I stated it didn't work and continued to ask for more help.

There are no events this code is run by a different trigger.
You don't need the rest of the code, I can't fathom what other triggers would cause such a list of errors. Well... it didn't, the limitations of Warcraft 3 did...

Not optimizing it at this point won't change a thing, as a loop will only digitally write out what I have written out. Albeit not the most efficient way of doing so but, it is the way I have done it and it works.
 
Status
Not open for further replies.
Top