wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Resources > Code Resources > Samples
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 04-19-2008, 05:40 PM   #1
emjlr3
Rehabbing
 
emjlr3's Avatar
 
Join Date: Jun 2005
Posts: 1,386

Submissions (14)

emjlr3 is a jewel in the rough (151)emjlr3 is a jewel in the rough (151)

Mapping Contest First Place

Send a message via AIM to emjlr3 Send a message via MSN to emjlr3
Default Hero Selection System 1.30

Hero Selection System 1.30



A dynamic, completely customizable Hero Selection System!

Had originally been using Vex's system for a map I have been playing around with, and finally got fed up with players not being able to view the same hero simultaneously. So, with a little inspiration and minor coding help from Vexs system, and after some discussion with Fulla, this system was born.

Credits to Vexorian for his original system and the GetPlayerNameColored function, and to Fulla for our hero selection discussions. Credits also to Acehart for the original demo map he made, of which its terrain I used as a template for this map.


Read Me - Basic:
Hidden information:
Hero Selection System 1.30 - By: emjlr3

The basic steps to setup the system in your map
*Copy the Select Hero and Random Hero units to your map
*Copy the HSS and GetPlayerNameColored(if not already there) triggers to your map
*Configure he options you can(everything but Choose/RandomHeroOrder)
*Save, if that works, then everything is good, if not, start over and try again from the beginning

*Type -HSSGetOrders while in single player to determine the order ids for selling your selection units
This will create a hero at Player 1s start location. You can select choose hero or random hero on this hero, and it will display the correct order id for that selection. Write these two order ids down, and move to the next step
*Configure the order id options in HSS (ChooseHeroOrder and RandomHeroOrder)
*Add heroes to your map, owned by neutral passive, set their level and abilities learned to whatever you want, add a rect around your hero gallery
*Copy HSSSetup to yor map
*Look through HSSSetup, this is the trigger that will start and setup the system for you. You can have this run after X seconds, as I do, You can execute the trigger later, among many other things. Read through this and configure it to match your maps needs
*Save, if that works, yo are good to go, if not, look through HSSSetup again and see where your syntax went wrong


Read Me - Advanced
Hidden information:
Hero Selection System 1.30 - By: emjlr3

The more advanced configuration required for the system to function, or to be further customized
*All system used global arrays are stored as the id of the player they are for, ex. HSS_HeroSelection = GetPlayerId(unit)
*As seen in HSSSetup in this map, you must store the Hero Selection Gallery Rect and Hero Creation Loc for every player in your map, else the system does not know where they are
HSS_HeroSelection in a rect array used for the hero gallery
HSS_HeroCreation is a location array use for the creation of heroes
*The global trigger HSS_CreatedHeroTrigger will run once a hero is created, if set as a trigger. The created hero can be retrieved as "bj_lastCreatedUnit"
*The global unit array HSS_Heroes refers to heroes selected using the system
*The global group HSS_SelectableHeroes contains to all those heroes initialy selectable using the system
*Since players are given control of Player 15s units, the bong sound is played(unavoidable), and a message is displayed(also unavoidable)
However, in the gameplay constants you can edit this displayed message, as seen in this map
*Selecting the random hero flag before the map is loaded creates random heroes for all players
*You can edit the fields in HSSSetup to load the system when you want, or even completely scratch that trigger and do it yourself some place else, though this is not recommended


Systems Code:
Expand JASS:

Setup Code:
Expand JASS:

Version History:
  • 1.30 - Several new config. options
    Added a function to GetPlayerNameColored Library, to allow for colored hero names
    Minor coding updates/optimizations
    Errors messages now display in red
    Now reports an error if your max computer hero selection time is greater then your total selection time
    Improved the way hero selection messages were displayed
    Minor test map updates
  • 1.20 - Setup and readme completely redone
    HSS is now a library that contains the GetSelectionOrders system
    HSSSetup now sets up the systems variables and starts the HSS
    A few minor coding enhancements per Vexorians advice
    New option for max computer hero selection time
  • 1.10 - Users no longer need to manually input the number of players
    Added error messages in case the map runs out of heroes
    Slight updates/additions to readme
    Slight code updates and optimizations
    A few minor bug fixes(nothing related to system functionality)
  • 1.00 - Initial Release

Please report any and all bugs, and please leave comments and thoughts. Thanks and enjoy!!
Attached Images
File Type: jpg HSS.jpg (296.7 KB, 423 views)
Attached Files
File Type: w3x Hero Selection System 1.30 - emjlr3.w3x (76.5 KB, 409 views)
__________________

Last edited by emjlr3 : 05-01-2008 at 12:25 AM.
emjlr3 is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 04-19-2008, 09:40 PM   #2
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


Technical Director
 
Join Date: Apr 2003
Posts: 14,898

Submissions (37)

Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)

Hero Contest #3 - 2nd Place

Default

It's a scope with no initializer?

How are people supposed to use it?

Edit: I see, that's lame.

This is a vJass map so I demand vJass to be exploited.

1. Use this, instead of your custom script section, have it in some trigger.

Collapse JASS:
library GetPlayerNameColored

function GetPlayerNameColored takes player id returns string
 local playercolor col=GetPlayerColor(id)
 local string r=GetPlayerName(id)
    if col == PLAYER_COLOR_RED then
        set r="|cffff0000"+r+"|r"
    elseif col == PLAYER_COLOR_BLUE then
        set r="|cff0000ff"+r+"|r"
    elseif col == PLAYER_COLOR_CYAN then
        set r="|cff93ffc9"+r+"|r"
    elseif col == PLAYER_COLOR_PURPLE then
        set r="|cff400080"+r+"|r"
    elseif col == PLAYER_COLOR_YELLOW then
        set r="|cffffff00"+r+"|r"
    elseif col == PLAYER_COLOR_ORANGE then
        set r="|cffff8000"+r+"|r"
    elseif col == PLAYER_COLOR_GREEN then
        set r="|cff00c400"+r+"|r"
    elseif col == PLAYER_COLOR_PINK then
        set r="|cffff80c0"+r+"|r"
    elseif col == PLAYER_COLOR_LIGHT_GRAY then
        set r="|cff808080"+r+"|r"
    elseif col == PLAYER_COLOR_LIGHT_BLUE then
        set r="|cffc1c1ff"+r+"|r"
    elseif col == PLAYER_COLOR_AQUA then
        set r="|cff5e5e2f"+r+"|r"
    elseif col == PLAYER_COLOR_BROWN then
        set r="|cff004000"+r+"|r"
    else
        set r="|cff000000"+r+"|r"
    endif
 return r
endfunction

endlibrary



1. Make HSS a library that requires it and also a library called HSS_setup, also make start begin automatically (an initializer)

2. Is the trigger that begins with GetSelectionOrders_Effects part of your HSS? Then include that in the library or make a library required by it.

3. Regarding the contents of HSS_setup, it should replace this:

Collapse JASS:
    local integer i = 0
    
    // Loop through players in map, setting up their hero selection rects and hero creation locs
    loop
        exitwhen i > 3
        set HSS_HeroSelection[i] = gg_rct_HeroSelection
        set HSS_HeroCreation[i] = GetStartLocationLoc(GetPlayerStartLocation(Player(i)))
        set i = i + 1
    endloop
    // Store the trigger to be ran when a hero is created
    set HSS_CreatedHeroTrigger = gg_trg_PostHeroCreation
With what? you may ask, I dunno, you can use a function that returns that stuff, you can also use an initializer, be creative there.

So, in other words your users will just need to modify the setup library and just include your HSS instead of messing with when and how to call ExecuteFunc("Start_HSS") , btw, I should advice against ever ExecuteFunc, if necessary use .execute() this time it was not necessary.

The reasoning is that jasshelper will some day integrate the map optimizer's capabilities but taking advantage of the higher level syntax, so if we just use alternatives to ExecuteFunc the optimization will be much better than with the optimizer, .execute() is faster anyways.

4. Oh yes, if you make a function public, make sure to document what it does.

...
I don't like this, don't worry, the reason I don't like it is that my old hero system code has a lot of messy stuff, and yours has inherited most of the bad things old hss had. Can you try fixing them? Will save me the time of having to update it, for example it is way too liberal about dynamic triggers.
__________________
Zoom (requires log in)Wc3 map optimizer 5.0
Someone should fix .wav sound in this thing.
Zoom (requires log in)JassHelper 0.A.2.A
Turns your simple code into something that is complicated enough to work.
Faster != more useful
Vexorian is offline   Reply With Quote
Old 04-20-2008, 02:23 PM   #3
emjlr3
Rehabbing
 
emjlr3's Avatar
 
Join Date: Jun 2005
Posts: 1,386

Submissions (14)

emjlr3 is a jewel in the rough (151)emjlr3 is a jewel in the rough (151)

Mapping Contest First Place

Send a message via AIM to emjlr3 Send a message via MSN to emjlr3
Default

updated

if there is anything you don't agree with or still have problems accepting, let me know and I will happily explain the reasoning behind my madness
__________________

Last edited by emjlr3 : 04-20-2008 at 03:38 PM.
emjlr3 is offline   Reply With Quote
Old 04-20-2008, 04:24 PM   #4
Rising_Dusk
Obscurity, the Art


Projects Director
Project Leader: OD
 
Join Date: Feb 2006
Posts: 9,729

Submissions (27)

Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)

Hero Contest #3 - 1st PlaceApproved Map: Desert of ExileApproved Map: Advent of the ZenithHero Contest #2 - 1st PlaceHero Contest - Third place>

Send a message via AIM to Rising_Dusk Send a message via MSN to Rising_Dusk
Default

Collapse JASS:
private function SinglePlayer takes nothing returns boolean
    return bj_isSinglePlayer
endfunction
That's totally unnecessary, just stick that BJ in the system wherever it's needed.
__________________
Rising_Dusk is offline   Reply With Quote
Old 04-20-2008, 05:18 PM   #5
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


Technical Director
 
Join Date: Apr 2003
Posts: 14,898

Submissions (37)

Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)

Hero Contest #3 - 2nd Place

Default

Anyways, it needs big cleanup specially the part that's from my system, why did you base it from my system anyways? I think the final result is too different from mine so I doubt you really needed my code if it isn't for just making the system messier.

If you are blocking orders like I did in the old system using DisableTrigger, etc. Change it to a 0. seconds timeout timer to order stop ASAP.
__________________
Zoom (requires log in)Wc3 map optimizer 5.0
Someone should fix .wav sound in this thing.
Zoom (requires log in)JassHelper 0.A.2.A
Turns your simple code into something that is complicated enough to work.
Faster != more useful
Vexorian is offline   Reply With Quote
Old 04-20-2008, 06:38 PM   #6
Soki
User
 
Join Date: Mar 2008
Posts: 13

Soki has little to show at this moment (0)

Default

As both are different approaches, your HSS should be updated anyway Vexorian. Especially fixing that damn bug that desyncs Mac users.

Last edited by Soki : 04-20-2008 at 06:41 PM.
Soki is offline   Reply With Quote
Old 04-20-2008, 06:54 PM   #7
emjlr3
Rehabbing
 
emjlr3's Avatar
 
Join Date: Jun 2005
Posts: 1,386

Submissions (14)

emjlr3 is a jewel in the rough (151)emjlr3 is a jewel in the rough (151)

Mapping Contest First Place

Send a message via AIM to emjlr3 Send a message via MSN to emjlr3
Default

@Dusk - was going to do that, but ended up adding a condition function, dont remember why
*now i remember - did not feeling like having to declare all my locals, then check if single player, then set them all up, that was it

@Vex - I based it on yours because it worked like I wanted this one to, minus the multi-player-selecting 1 unit part
I dont really see how it is "messy", or needs all this "cleanup"
I do disable the trigger, if it is a huge performance gain by using a timer as opposed to disabling and enabling the trigger, I would change it, but as it is now, i cant really justify doing so

@Soki - this really is not much different then Vexs (the approach is exactly the same), other then the fact that I think its cleaner, more optimized, and allows multiple players to select and view the same hero (which is why the install/setup requires an extra step)
then down part is you do not get the selection arrow when viewing a hero, but then that is a product of the system
__________________

Last edited by emjlr3 : 04-20-2008 at 07:01 PM.
emjlr3 is offline   Reply With Quote
Old 04-20-2008, 07:16 PM   #8
Rising_Dusk
Obscurity, the Art


Projects Director
Project Leader: OD
 
Join Date: Feb 2006
Posts: 9,729

Submissions (27)

Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)

Hero Contest #3 - 1st PlaceApproved Map: Desert of ExileApproved Map: Advent of the ZenithHero Contest #2 - 1st PlaceHero Contest - Third place>

Send a message via AIM to Rising_Dusk Send a message via MSN to Rising_Dusk
Default

This makes me want to package the system I've had in DoE and AotZ for years and release it, it's shorter, easier to read, and does all of the same stuff as this one. (Just without the config, hence the need to package)

EDIT:
Actually, looking at your code mine does some stuff yours does not. Hrm.
__________________
Rising_Dusk is offline   Reply With Quote
Old 04-20-2008, 07:25 PM   #9
emjlr3
Rehabbing
 
emjlr3's Avatar
 
Join Date: Jun 2005
Posts: 1,386

Submissions (14)

emjlr3 is a jewel in the rough (151)emjlr3 is a jewel in the rough (151)

Mapping Contest First Place

Send a message via AIM to emjlr3 Send a message via MSN to emjlr3
Default

whats stopping you?

the fact there were no real good updated ones out is what made me make this for myself, and eventually release it
__________________

Last edited by emjlr3 : 04-20-2008 at 07:25 PM.
emjlr3 is offline   Reply With Quote
Old 04-20-2008, 07:31 PM   #10
Rising_Dusk
Obscurity, the Art


Projects Director
Project Leader: OD
 
Join Date: Feb 2006
Posts: 9,729

Submissions (27)

Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)

Hero Contest #3 - 1st PlaceApproved Map: Desert of ExileApproved Map: Advent of the ZenithHero Contest #2 - 1st PlaceHero Contest - Third place>

Send a message via AIM to Rising_Dusk Send a message via MSN to Rising_Dusk
Default

Quote:
Originally Posted by emjlr3
whats stopping you?
Well, you did all of this work, I'd feel bad just storming in and taking over. I never released it before because I wasn't sure that there was even a need for a new one, people seemed content with Vex's.
__________________
Rising_Dusk is offline   Reply With Quote
Old 04-20-2008, 08:12 PM   #11
emjlr3
Rehabbing
 
emjlr3's Avatar
 
Join Date: Jun 2005
Posts: 1,386

Submissions (14)

emjlr3 is a jewel in the rough (151)emjlr3 is a jewel in the rough (151)

Mapping Contest First Place

Send a message via AIM to emjlr3 Send a message via MSN to emjlr3
Default

Quote:
Originally Posted by Rising_Dusk
Well, you did all of this work, I'd feel bad just storming in and taking over. I never released it before because I wasn't sure that there was even a need for a new one, people seemed content with Vex's.

i needed to do the work anyhow, because Vexs was not quite what I wanted anymore, the work was already done, uploading it here and adding a readme was simply all the extra work needed

how you would render this obsolete i cannot guess, if i remember correctly, you dont even let players view skills. Other then perhaps flamboyant effects, which i dont remember in DoE or AotZ, im at a loss for all these featuers yours contains that I seem to have overlooked, and the fact that you may save a few line somewhere I don't see as being anything special

other then the fact that your name is Rising_Dusk, i can't say people would like it any better, but who am I too judge, I'm not the one with two succesful maps at WC3C ;)
__________________

Last edited by emjlr3 : 04-20-2008 at 08:15 PM.
emjlr3 is offline   Reply With Quote
Old 04-20-2008, 08:15 PM   #12
Rising_Dusk
Obscurity, the Art


Projects Director
Project Leader: OD
 
Join Date: Feb 2006
Posts: 9,729

Submissions (27)

Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)

Hero Contest #3 - 1st PlaceApproved Map: Desert of ExileApproved Map: Advent of the ZenithHero Contest #2 - 1st PlaceHero Contest - Third place>

Send a message via AIM to Rising_Dusk Send a message via MSN to Rising_Dusk
Default

Quote:
Originally Posted by emjlr3
how you would render this obsolete i cannot guess, if i remember correctly, you dont even let players view skills, other then perhps flamboyant effects, which i dont remember on DoE or AotZ, im at a loss for all these featuers yours contains that I seem to have overlooked
All of those options are just a boolean away, though. I removed them from DoE because of a problem with auras and stuff. Otherwise, it's mostly the same thing just written to be shorter and easier to understand.
__________________
Rising_Dusk is offline   Reply With Quote
Old 04-20-2008, 08:21 PM   #13
emjlr3
Rehabbing
 
emjlr3's Avatar
 
Join Date: Jun 2005
Posts: 1,386

Submissions (14)

emjlr3 is a jewel in the rough (151)emjlr3 is a jewel in the rough (151)

Mapping Contest First Place

Send a message via AIM to emjlr3 Send a message via MSN to emjlr3
Default

o well, can't say I'd lament people deciding against the use of my system

all the usage I care about I'm getting, the rest is merely superfluous

obsolete away all mighty sun setting one :), just keep me updated, so I can avoid catering to Vexs needs :)
__________________

Last edited by emjlr3 : 04-20-2008 at 08:25 PM.
emjlr3 is offline   Reply With Quote
Old 04-21-2008, 11:30 AM   #14
Malf
I LIKE PIZZA! | >
 
Malf's Avatar
 
Join Date: Sep 2007
Posts: 625

Submissions (2)

Malf has a spectacular aura about (92)Malf has a spectacular aura about (92)Malf has a spectacular aura about (92)Malf has a spectacular aura about (92)

Send a message via AIM to Malf
Default

Dusk has his own selection system?? I thought you were using Vex's system, with little modifications by adding the stories
__________________

Last edited by Malf : 04-21-2008 at 11:30 AM.
Malf is offline   Reply With Quote
Old 04-21-2008, 12:01 PM   #15
Belphegor666
User
 
Belphegor666's Avatar
 
Join Date: Jul 2004
Posts: 787

Submissions (1)

Belphegor666 is on a distinguished road (16)

Default

Interesting. Does this system supports remaking maps? Also completely hiding units is way better than making them transparent. I sometimes try to click on the transparent unit (don't ask why).
Belphegor666 is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 06:39 AM.


Affiliates
The Hubb The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2019, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services