• 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] Getting when somone Presses "Build"

Status
Not open for further replies.
Hi, i'm just wondering, is there a way of making spellbook, or build have an abilitycode so you can tell when you access them? i dont mean pressing anything inside of the spellbook, or build key, but them themselves, As in,
"Unit - A unit finishes casting an ability"
"Ability being cast equal to (Spellbook)"
"call BJDebugMsg("Rofltesting")"
Thanks for the time and effort.
 
Level 14
Joined
Mar 4, 2009
Messages
1,156
make wind walk ability
ICON - build structure
mana required - 0
hotkey - B

when it is used

replace you builder with real builder

make player select last replaced unit

for player to press B (witch is for building)

now you can do anything with owner of last replaced unit witch is the player that pressed the fake wind walk
 
Level 14
Joined
Jul 26, 2008
Messages
1,009
Alright ikill, going back to what Reaper2008 said, you can use JASS. If you have all GUI, then use custom script to implement this.

First you'll need to get the rawcode of the Spellbook. The rawcode is a 4 character long string you can find by going to abilities in the object manager, hitting ctrl+d and looking to the left of the spells name in the lefthand panel. Most start with an A, though it's not a hard and fast rule, more a tool for organization.

What you do now is take the JASS code
JASS:
GetSpellAbilityId()
and do this
JASS:
If GetSpellAbilityId() == 'spellbookrawcodeherewithsinglequotationsaroundit' then
. That if statement says that if the spell used has the unique spell rawcode you put in the quotations, it will do everything below it up to endif.

Make sure you put the custom script endif after the stuff you want done. If you're not using GUI then you can just put endif.
 
Level 5
Joined
Nov 22, 2009
Messages
181
ok, im not exactly sure what you guys are trying to achieve. can someone please explain this in a clear and concise way?

ps: some of you should work on grammar.
 
Level 14
Joined
Mar 4, 2009
Messages
1,156
Actually, i want to set a boolean when somone presses build <-- finished
and i want to set it false when they press the esc thing in the build menu <-- need help
You would need one more triggers for that because you can only detect when player presses ESC not if player presses the icon

make channel ability - put its time to 0.01 and put hotkey "X" (I MEAN RELLY X not x as and hotkey you want)

put his base order id to raiseddeadoff

ok so....
you should make one more trigger

FORCE PLAYERS -initially on = false

EVENTS
every 0.0X seconds of game
CONDITIONS...
ACTIONS
pick every player in all player and do action
-game- force picked player to press a key X



unit clicks on fake building (wind walk ability)

replace (unit) with (your unit that has real building ability)...

turn on FORCE PLAYERS

--------------------------------

now if someone presses ESC key or presses the button he will active channel ability with hotkey X

---------------------------------

PLAYER PRESSED ESC OR LEFT CLICK ON ESC BUTTON

EVENT
unit is ordered with no target
CONDITION
issued order equal to raiseddeadoff
ACTIONS
replace triggering unit with (your unit with fake build ability)
...

PLAYER DESELECTS A (your unit with real build ability)


EVENT
player 1 deselects a unit
...
CONDITION
unit type of triggering unit equal to unit of type (your unit with real build ability)
ACTION
replace triggering unit with unit of type (unit with fake building)
pick every unit of type (fake builder)
IF
if random unit from unit group is alive
THAN...
ELSE
turn off FORCE PLAYERS

so here is what you do

you make a channel ability that will not be casted while your building "screen" is opened

than if you close it the FORCE PLAYER trigger will force you to cast channel

---> channel casting is detecting the closed building "screen"
 
Last edited:
Status
Not open for further replies.
Top