• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Solved] vJass Duel System crashing and I don't know why

Status
Not open for further replies.
Level 3
Joined
Sep 9, 2019
Messages
15
The map below has a sweet duel system and I want it in my map. I copied it and gives me a crash with something about an "i".
1692981865083.png


Any help is appreciated!
 

Attachments

  • EDS_1.0.w3x
    75.3 KB · Views: 2
Last edited:

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,877
As far as I understand, Jass doesn't support For Loops using that syntax. It should look like this:
vJASS:
public method getHeroId takes integer whichHero returns integer
    local integer i = 0
    loop
        if heroes[i] == whichHero then
            return i
        endif
        set i = i + 1
        exitwhen i > count
    endloop
    return i
endmethod
Or maybe try giving i a default value of 0 and keeping everything else the same.
 
Last edited:

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,877
Same thing again. You need to adjust the For Loop to use the syntax I provided.
vJASS:
local integer i = 0
loop
 // put important code here
 set i = i + 1
 exitwhen i >= this.teams.getSize()
endloop
That one has two For Loops so you need to do it twice (a loop within a loop). The second loop uses the integer j instead of i but the same rules apply.
 
Level 3
Joined
Sep 9, 2019
Messages
15
I don't seem to have an end to this. I tried to modify it, but it gives me other errors. Probably I didn't understand correctly.

Edit: I give up on this.. is too complicated. I will try to find another duel system.
 
Last edited:

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,877
It's a lot of work, the code is 1500 lines long.

Anyway, here's a very basic duel system I threw together that allows for 1v1 duels and could be expanded to allow for team duels and other stuff like that. It's really just to give you an idea of how you could create this yourself. Type -duel # (player number, 1->24) to challenge someone to a 1v1. They need to type -duel # using your number for the duel to start. Only one duel can occur at a time. A duel ends when a hero dies. You can cancel a duel request by typing -cancel.
 

Attachments

  • Basic Duel System 1.w3m
    29.3 KB · Views: 3
Last edited:
Status
Not open for further replies.
Top