• 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.

[Trigger] Dota Hero Choosing

Status
Not open for further replies.
Level 3
Joined
Jan 31, 2008
Messages
66
is there any way to create triggers like dota's hero choosing trigger? the trigger when u can select a hero from the tavern at the starting of the game... it's very hard to do it myself, so can any pros care to teach mi? :grin:
 
Level 3
Joined
Jan 31, 2008
Messages
66
dots? are u even answering my post? i said how to create the choose hero trigger, as in the function of the taverns and how to put the heroes in the tavern... -.-
 
Level 15
Joined
Jan 16, 2008
Messages
1,244
lala, accept the criticism, it's constructive. This post was supposed to bury the war axe but you don't seem to want that. Yes, i have read your post and explained the best way i know what you could do. The fact that you wanna cheat wasn't supposed to stay in the way but now i see you didn't really want me to help... Anyway, don't expect my help again.
 
Level 3
Joined
Jan 31, 2008
Messages
66
what? firstly it's because of the post that u made in my other thread that pissed mi off... and secondly, i didn't mean to say that u didn't help mi at all, i was just saying that u didn't get what i meant that's all... what i want is that what can u do to make the heros icon show up in the tavern and how to spawn them out when u click on the icon... sorry if i was offensive in anyway..
 
Level 15
Joined
Jan 16, 2008
Messages
1,244
Oh, okay then. Tn the object editor, your tavern should have a field that says:units sold. There you put your heroes and player will be able to buy them. Remember to remove any tech requirements form heroes if you want more than one chosen. Now if you want your hero to spawn somewhere else, just add a trigger like this:
Events:
Unit sells a unit
Conditions:
You probably won't need any but you can add them
Actions:
Move (sold unit) instantly to position (center of (YourRegion))
this should work just fine, you can add some special effects as well if you want to.
 
Level 3
Joined
Jan 31, 2008
Messages
66
oooh ok tnks a lot :grin: so there isn't any triggers involed? what if i want to include a deathmatch mode just like dota? how will the triggers be? because in deathmatch u must make it so that everytime one player selects a hero from the tavern, the hero icon will be removed from the tavern, how can this be done?
:grin:
 
Level 5
Joined
Aug 16, 2007
Messages
149
do the following to remove a hero icon from a tavern when it is bought:
  • Buy Unit
    • Events
      • Unit - A unit Sells a unit
    • Conditions
      • (Selling unit) Equal to My Tavern
    • Actions
      • Unit - Move (Sold unit) instantly to (Center of (My Region))
      • Custom script: call RemoveUnitFromAllStock(GetUnitTypeId(GetSoldUnit()))
I don't know if there's a GUI function to remove unit from all stock so I did it in Custom Script.
this includes moving the bought unit as well as removing the icon.
 
I don't know if there's a GUI function to remove unit from all stock so I did it in Custom Script.
this includes moving the bought unit as well as removing the icon.

There is:
  • Buy Unit
    • Events
      • Unit - A unit Sells a unit
    • Conditions
      • (Selling unit) Equal to My Tavern
    • Actions
      • Unit - Move (Sold unit) instantly to (Center of (My Region))
      • Neutral Building - Remove (Unit-type of (Sold unit)) from all marketplaces
But if I remember correctly you first have to add the heroes to the tavern via triggers. Or else you can't remove them:
  • Neutral Building - Add Paladin to My Tavern with 1 in stock and a max stock of 1
 
Level 5
Joined
Aug 16, 2007
Messages
149
well JASS function doesn't need u to add units first so just use JASS. And lala, yes I am good at JASS, but just because someone knows that function it doesn't necessarily make them good at JASS... but wtever I am good at JASS.
 
Level 3
Joined
Jan 31, 2008
Messages
66
one hard function for example is the pick every unit in group and do actions.... and some of the functions , for example, S2R(SubstringBJ(GetEventPlayerChatString(),?,?)) is slow because it's using Blizzard jass function and not native, when i tried to change it to native, it doesn't work for the real value... any help on this? :grin:
 
Level 15
Joined
Jan 16, 2008
Messages
1,244
If you're using jasscraft, in the lower part of the IDE you can see the code of functions, if they are native, the code won't be displayed, only their takes and returns lines. Check those lines for differences between native and bj, maybe the native uses integer instead of real or something.
 
Level 3
Joined
Jan 31, 2008
Messages
66
oooh so is there any jass to substitue the substringbj? because bj will lag when the trigger is run... :cry:
 
Level 3
Joined
Jan 31, 2008
Messages
66
what do u mean by feed the function? :eek: by the way is there any jass script to remove the minimap icon of a unit? i dun wan to let my unit's icon be shown on the minimap...
 
Last edited:
Level 5
Joined
Aug 16, 2007
Messages
149
>oooh so is there any jass to substitue the substringbj? because bj will lag when the trigger is run...
yes you could use SubString

>by the way is there any jass script to remove the minimap icon of a unit?
not that I know of. You might be able to remove the unit in a local block, but I'd have to ask someone such as earthfury or purplepoot about that.
 
Level 15
Joined
Jan 16, 2008
Messages
1,244
you have the show icon field in the editor, just set it to false and no minimap icon will be displayed. To feed the function, i referred to the values a function must get in order to do something(eg. ...takes integer ID, unit u, boolean b returns...) my idea was to convert your real number into integer, then give it to the function
 
Level 3
Joined
Jan 31, 2008
Messages
66
bubba: but substringbj doesn't take real values, how to solve it?
volvox: is there any way to do it in the form of triggers? how do u convert into integer and give it to the function?? :grin:
 
Level 15
Joined
Jan 16, 2008
Messages
1,244
When you're working with numbers, there is an option group called conversion.
In that option group, you can find say convert real to integer or convert integer to real. That is for the trigger part, in jass it is a lot easier. R2I means real2integer, I2R, you can guess. Just write set (your integer) = R2I(your real) and it will round your real to the closest(eg. 5.56 - 6) or the smallest integer that fits in(eg. 5.56 - 5), not sure but you can try and see for yourself.
 
Level 3
Joined
Jan 31, 2008
Messages
66
oooh sorry volvox but if it isn't too much, can u teach mi how to do it by making an example? for example:
JASS:
set Temp_ItemCode[GetPlayerId(p)]=GetItemTypeId(UnitItemInSlot(u,S2I(SubString(s,10,11))))
 
Level 15
Joined
Jan 16, 2008
Messages
1,244
Ok, this is an example of using R2I, i complicated it so it looks useful dough it's relatively useless except for seeing how R2I works.
JASS:
// i complicated this as much as i could   //
// hope that will help :P                    //


function example takes real r returns integer    // this entire function does what most bj functions do(nothing) //
    return R2I(r)                               // this line converts given real into integer. it could be standing alone but where's the fun in that?  //
endfunction

function example_init takes unit u, player p returns nothing
    local real x = GetUnitX(u)                               // we define real coordinates here //
    local real y = GetUnitY(u)
    local integer inx = example(x)                     // here we pass our real coordinates to example which returns integers //
    local integer iny = example(y)
    call CreateTextTagUnitBJ(I2S(inx), u, 100, 50, 255, 0, 0, 20) // we write the integer coordnates on their true location in the map  //
    call CreateTextTagUnitBJ(I2S(iny), u, 50, 50, 255, 0, 0, 20)
endfunction
 
Level 3
Joined
Jan 31, 2008
Messages
66
ok tnks i get it... so is there any way to hide a unit's minimap icon display using jass script instead of inside world editor? :grin:
 
Level 5
Joined
Aug 16, 2007
Messages
149
no, there's no way of removing minimap icon with JASS as far as I know (have browsed all of common.j)
 
Level 3
Joined
Jan 31, 2008
Messages
66
ooh because when a unit is given the "ghost" ability, the enemy players cannot see it's minimap icon on their minimap...so i was thinking is there any way to make the unit undetectable using jass script to stop it's minimap icon from showing.... i saw these two functions: IsUnitInvisible and IsUnitDetected... is there any way to make use of these two to make the unit permanently invisible? :grin:
 
Level 5
Joined
Aug 16, 2007
Messages
149
I suppose you could give it the ghost ability then. Just do
JASS:
call UnitAddAbility(MyUnit, 'Agho')
And then to remove it:
JASS:
call UnitRemoveAbility(MyUnit, 'Agho')
 
Level 3
Joined
Jan 31, 2008
Messages
66
oooooh but that i already knew i was just asking around if there's any way to make the unit with "ghost" ability undetected..... :grin:
 
Level 3
Joined
Jan 31, 2008
Messages
66
is there such a way that u can add fog to a player's unit so that it's minimap icon will be fogged and masked and not be visible on enemy's minimap? :grin:
 
Level 15
Joined
Jan 16, 2008
Messages
1,244
Generally, you must create invisibility emitter for all players except you at the place of your hero and move it periodically. But players would start wondering what that black dot means... Besides, wouldn't it be weird if you'd come to their town and they couldn't see their own buildings? If you make the modifier very small, that would do good but players would still see a black dot on the map and in the game screen where your hero would be.
 
Level 3
Joined
Jan 31, 2008
Messages
66
oooh haha that's funny.... so there isn't anyway to make the modifier fixed to a unit instead of needing to move it periodically? by the way can help answer my other post regarding the removal of items in shops in dota in the jass section? tnks! :grin:
 
Status
Not open for further replies.
Top