Poll | | What game does everyone play now? | Starcraft 2 | | 26% | [ 8 ] | Warcraft 3 | | 35% | [ 11 ] | League of Legends | | 19% | [ 6 ] | World of Warcraft | | 0% | [ 0 ] | Diablo 2 | | 0% | [ 0 ] | No games at all | | 10% | [ 3 ] | Other game not listed | | 10% | [ 3 ] |
| Total Votes : 31 |
|
| | Jass Help | |
| | Author | Message |
---|
AmAzIn[G] Commander
| Subject: Jass Help Wed Aug 17, 2011 8:39 pm | |
| I'm making random unit and this is the trigger that dark created for me that did not work. - Spoiler:
//TESH.scrollpos=0 http://TESH.alwaysfold=0function makeRandomUnitForPlayer takes integer p, rect r returns nothing local integer i = 0 local unit u local real x = GetRectCenterX(r) local real y = GetRectCenterY(r) set i = GetRandomInt(1, 45) set u = CreateUnit(Player(p-1), udg_u[i], x, y, 270) set u = null endfunction function setUnits takes nothing returns nothing set udg_u[1] = 'n00E' set udg_u[2] = 'n00M' set udg_u[3] = 'n00F' set udg_u[4] = 'n00Q' set udg_u[5] = 'n00O' set udg_u[6] = 'nOOI' set udg_u[7] = 'n005' set udg_u[8] = 'n00L' set udg_u[9] = 'n00C' set udg_u[10] = 'n00J' set udg_u[11] = 'n00D' set udg_u[12] = 'n00A' set udg_u[13] = 'n00N' set udg_u[14] = 'n00B' set udg_u[15] = 'n007' set udg_u[16] = 'n00H' set udg_u[17] = 'n004' set udg_u[18] = 'n00U' set udg_u[19] = 'n00V' set udg_u[20] = 'n006' set udg_u[21] = 'n002' set udg_u[22] = 'n008' set udg_u[23] = 'n009' set udg_u[24] = 'n00P' set udg_u[25] = 'n00R' set udg_u[26] = 'n00K' set udg_u[27] = 'n003' set udg_u[28] = 'e000' set udg_u[29] = 'e001' set udg_u[30] = 'o000' set udg_u[31] = 'u001' set udg_u[32] = 'z000' set udg_u[33] = 'z001' set udg_u[34] = 'z002' set udg_u[35] = 'n00G' set udg_u[36] = 'n000' set udg_u[37] = 'n001' set udg_u[38] = 'n010' set udg_u[39] = 'n00Y' set udg_u[40] = 'n00W' set udg_u[41] = 'n00Z' set udg_u[42] = 'n00X' set udg_u[43] = 'n00S' set udg_u[44] = 'n00T' set udg_u[45] = 'o002' endfunction
And this was the trigger that was to be run when I wanted new units to be created. Ex. Round 1 I would run the trigger, Round 2 I would again run the trigger. - Spoiler:
//TESH.scrollpos=0 http://TESH.alwaysfold=0function Trig_makeRandomUnitsForAllPlayers takes nothing returns nothing call makeRandomUnitForPlayer(1, gg_rct_PUT REGION FOR PLAYER HERE) call makeRandomUnitForPlayer(2, gg_rct_PUT REGION FOR PLAYER HERE) call makeRandomUnitForPlayer(3, gg_rct_PUT REGION FOR PLAYER HERE) call makeRandomUnitForPlayer(4, gg_rct_PUT REGION FOR PLAYER HERE) call makeRandomUnitForPlayer(5, gg_rct_PUT REGION FOR PLAYER HERE) call makeRandomUnitForPlayer(6, gg_rct_PUT REGION FOR PLAYER HERE) call makeRandomUnitForPlayer(7, gg_rct_PUT REGION FOR PLAYER HERE) call makeRandomUnitForPlayer(8, gg_rct_PUT REGION FOR PLAYER HERE) call makeRandomUnitForPlayer(9, gg_rct_PUT REGION FOR PLAYER HERE) call makeRandomUnitForPlayer(10, gg_rct_PUT REGION FOR PLAYER HERE) call makeRandomUnitForPlayer(11, gg_rct_PUT REGION FOR PLAYER HERE) call makeRandomUnitForPlayer(12, gg_rct_PUT REGION FOR PLAYER HERE) endfunction function InitTrig_makeRandomUnitsForAllPlayers takes nothing returns nothing set gg_trg_makeRandomUnitsForAllPlayers=CreateTrigger() call TriggerAddAction(gg_trg_makeRandomUnitsForAllPlayers,function Trig_makeRandomUnitsForAllPlayers) endfunction
The info that needs to be added was added and the trigger did not work. Basically I think it's missing a variable, but yeah, this is what I have. The trigger needs to be able to give a person a NEW random unit each round so that it is balanced (Kinda, but not really). And it also needs to be aware of teams, there are 3 teams of 4 players. And the round should end after a time period of 5-10mins (I can test and decide whats best) or after a certain team kills off the other teams. Ex. Team A and B are dead and one player from Team C is left, team C wins that round and the round is thus restarted. (I want it to end after one team reaches 20 wins.) Honestly I would do it on my own, but it is just too complicated (I don't program and the only people who can help me only want to use jass, and I already have a limited knowledge of GUI :/) | |
| | | Serenity09 Moderator
| Subject: Re: Jass Help Wed Aug 17, 2011 9:06 pm | |
| read chat
(ill edit this with the solution after you respond) | |
| | | AmAzIn[G] Commander
| Subject: Re: Jass Help Wed Aug 17, 2011 10:08 pm | |
| I posted a pic of what it was you asked on the chat.
Apparently you guys talked for 10+ pages since I talked to you at 9pm, so just post here if you need anything else lol. | |
| | | Serenity09 Moderator
| Subject: Re: Jass Help Wed Aug 17, 2011 10:16 pm | |
| step 1a: make a trigger called RandomUnitLibrary step 1b: convert that trigger to custom text step 2: copy and paste this into that trigger step 3: delete the stuff you have in your map header (the stuff that i'm redoing) - Code:
-
function makeRandomUnitForPlayer takes integer p, rect r returns nothing local integer i = GetRandomInt(1, 45)
call CreateUnit(Player(p-1), udg_u[i], GetRectCenterX(r), GetRectCenterY(r), 270) endfunction
function InitTrig_RandomUnitLibrary takes nothing returns nothing
set udg_u[1] = 'n00E' set udg_u[2] = 'n00M' set udg_u[3] = 'n00F' set udg_u[4] = 'n00Q' set udg_u[5] = 'n00O' set udg_u[6] = 'nOOI' set udg_u[7] = 'n005' set udg_u[8] = 'n00L' set udg_u[9] = 'n00C' set udg_u[10] = 'n00J' set udg_u[11] = 'n00D' set udg_u[12] = 'n00A' set udg_u[13] = 'n00N' set udg_u[14] = 'n00B' set udg_u[15] = 'n007' set udg_u[16] = 'n00H' set udg_u[17] = 'n004' set udg_u[18] = 'n00U' set udg_u[19] = 'n00V' set udg_u[20] = 'n006' set udg_u[21] = 'n002' set udg_u[22] = 'n008' set udg_u[23] = 'n009' set udg_u[24] = 'n00P' set udg_u[25] = 'n00R' set udg_u[26] = 'n00K' set udg_u[27] = 'n003' set udg_u[28] = 'e000' set udg_u[29] = 'e001' set udg_u[30] = 'o000' set udg_u[31] = 'u001' set udg_u[32] = 'z000' set udg_u[33] = 'z001' set udg_u[34] = 'z002' set udg_u[35] = 'n00G' set udg_u[36] = 'n000' set udg_u[37] = 'n001' set udg_u[38] = 'n010' set udg_u[39] = 'n00Y' set udg_u[40] = 'n00W' set udg_u[41] = 'n00Z' set udg_u[42] = 'n00X' set udg_u[43] = 'n00S' set udg_u[44] = 'n00T' set udg_u[45] = 'o002' endfunction this should work for the basic stuff you want to do as for the rest: making each random unit ~balanced the easiest way to do it is in how you setup the array for example udg_u[1] - udg_u[10] will be about equal in strength and then udg_u[11] - udg_u[20] etc if you setup the array to be like that (or in sets of 5 or 3 or whatever) ill rewrite the trigger why does this trigger need to be aware of teams? the rest is a whole separate deal it won't be too hard, but just get this working first | |
| | | Pat1487 Moderator
| Subject: Re: Jass Help Wed Aug 17, 2011 10:58 pm | |
| Serens code does the same things as Darks, seren just cleaned it up and made it more efficient So, as dirty and inefficient as what dark gave you is, it shouldve worked
You mustve used it wrong somewhere, or copied it literally (keeping the "gg_rct_PUT REGION FOR PLAYER HERE" with it as well, which i wouldnt be surprised if thats what you did)
As for giving a player a new unit on a new round You can save the unit they had last round to a variable, and if the number thats randomly generated is associated to that unit then generate another random number until it generates a different unit So on round 1 it generates 12 and gives w/e unit 12 is, save that to a var, when round 2 starts generate another number, if it happens to be 12 generate another number, if that number is 12 again, generate another number, until it generates a different number, lets say 15, and gives them w/e that unit is Then round 3 wont give you w/e unit 15 is by the same process (though it will let you get 12 again) | |
| | | Serenity09 Moderator
| Subject: Re: Jass Help Wed Aug 17, 2011 11:29 pm | |
| does everything in the map header run at map init?
I thought that the function which sets the array up wouldnt run until called, which it wouldn't be unless amaz specifically told it to | |
| | | AmAzIn[G] Commander
| Subject: Re: Jass Help Wed Aug 17, 2011 11:36 pm | |
| - Pat1487 wrote:
- You mustve used it wrong somewhere, or copied it literally (keeping the "gg_rct_PUT REGION FOR PLAYER HERE" with it as well, which i wouldnt be surprised if thats what you did)
Anywho, I did it right because I've had to use jass before, but I'll put this shit in tomorrow morning and see if it works. I'm too tired right now and it's late. | |
| | | Pat1487 Moderator
| Subject: Re: Jass Help Thu Aug 18, 2011 8:51 am | |
| - Serenity09 wrote:
- I thought that the function which sets the array up wouldnt run until called, which it wouldn't be unless amaz specifically told it to
- Pat1487 wrote:
- Amaz mustve used it wrong somewhere
I was including your InitTrig as being more efficient since you dont need to call any function to set up the unit array, but it still does the same thing | |
| | | Serenity09 Moderator
| Subject: Re: Jass Help Thu Aug 18, 2011 4:23 pm | |
| i really doubt he called the function which is kinda funny because originally he said he didn't think the units were being added to the array right - Quote :
- Basically I think it's missing a variable, but yeah, this is what I have
and thats exactly what was wrong | |
| | | AmAzIn[G] Commander
| Subject: Re: Jass Help Thu Aug 18, 2011 5:51 pm | |
| - Serenity09 wrote:
- i really doubt he called the function
which is kinda funny because originally he said he didn't think the units were being added to the array right - Quote :
- Basically I think it's missing a variable, but yeah, this is what I have
and thats exactly what was wrong Back when I was working on it I knew what variable type was missing and I had told dark to add it in there and he said "Oh yeah that could make it work". But then he never logged on again and I wasn't able to do it myself so I abandoned the map. + I didn't have time for it. | |
| | | Pat1487 Moderator
| Subject: Re: Jass Help Thu Aug 18, 2011 7:00 pm | |
| - Serenity09 wrote:
- i really doubt he called the function
Thats what i meant when i said he used it wrong The part where i said i wouldnt be surprised if he didnt change the regions was a joke | |
| | | AmAzIn[G] Commander
| Subject: Re: Jass Help Thu Aug 18, 2011 7:31 pm | |
| And you guys are right I didn't call the function. I didn't know really how to call the function because it isn't really a trigger? but it is a trigger? I don't know what that spot is used for lol. edit: I put your stuff in seren and I got an error | |
| | | Serenity09 Moderator
| Subject: Re: Jass Help Thu Aug 18, 2011 8:39 pm | |
| i cant really tell but if you have anything in your map header delete it dont use the map header its just super sloppy and i dont understand exactly how it works the map header is where you click the scroll with the name of your map and it opens up the space where all of dark's script is delete everything in there - Quote :
- I didn't know really how to call the function because it isn't really a trigger? but it is a trigger?
its a function a function is a piece of code which you can call and then it will do whatever it should (not necessarily what you want though) a trigger has a few components it has an event a condition and an action... action is another word for a function which takes no arguments ie. function test1 takes nothing returns nothing ... endfunction the event and condition component are exactly what you'd imagine them to be so to call a function you just type call <function name>(<arguments>) so to use test1 (from above it'd be call test1() there's nothing in the parenthesis because test1 "takes nothing" if you're using gui and want to call a jass function you need to make a custom script action which does exactly whats above | |
| | | AmAzIn[G] Commander
| Subject: Re: Jass Help Thu Aug 18, 2011 10:36 pm | |
| Ok this helps.
When I said "I didn't know really how to call the function because it isn't really a trigger? but it is a trigger?"
I was talking about the map header. I had no idea how to make that work as a trigger. I didn't know if it ran on map initialization or if I had to use a trigger to start it. And yeah I didn't think using the map header was a good idea at all ffs it's just confusing.
Thanks though. That tid bit of info you gave me actually helps me understand jass a lot more. | |
| | | The_Chosen_Oreo Corporal
| Subject: Re: Jass Help Thu Aug 18, 2011 11:28 pm | |
| anything that is in the map header is just placed above the rest of the triggers | |
| | | Serenity09 Moderator
| Subject: Re: Jass Help Sat Aug 20, 2011 3:28 pm | |
| including libraries with no requirements and initializers?
better question: why would that be better than using libraries with requirements?
| |
| | | The_Chosen_Oreo Corporal
| Subject: Re: Jass Help Sat Aug 20, 2011 3:36 pm | |
| | |
| | | Serenity09 Moderator
| Subject: Re: Jass Help Sat Aug 20, 2011 3:39 pm | |
| all libraries are placed above other scripts automatically also you can manually order the placement of these libraries using library xyz requires a, b, c where a, b, c are also libraries and because xyz requires all of them, they (a, b, c) will be placed above xyz | |
| | | The_Chosen_Oreo Corporal
| Subject: Re: Jass Help Sat Aug 20, 2011 5:34 pm | |
| i know that lol i just didnt understand your question xD | |
| | | Sponsored content
| Subject: Re: Jass Help | |
| |
| | | | Jass Help | |
|
| Permissions in this forum: | You cannot reply to topics in this forum
| |
| |
| |