Okay so in my map each of my heros have 2 weapon slots, a left one and a right one, every weapon has a "Special" attached to it, and when a player presses the left or right mouse button the hero uses the special of the weapon in the corresponding slot. For exampol, one of my items is a "Photon Barrel" and the Photon barrel's special is Photonic Overcharge an ability that deals 100 damage. So i made this Trigger in order to accomplish that,
Set Special
Events
UI - Player Any Player clicks Left mouse button Down.
Local Variables
Conditions
Actions
General - Pick each integer from 1 to 14, and do (Actions)
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
(Unit type of (Item carried by IMMORTALS[(Picked integer)] in slot 1)) == Photon Berral
Then
Unit - Order (Triggering unit) to ( Photonic Overcharge Target[(Picked integer)]) (Replace Existing Orders)
Else
And then another one for item slot 2 with the right mouse. But it dose not work, it only works sometimes, i think the "Item In slot X" part is my problem, any idea how to fix this?
Look into how a ghost can launch a nuke, and check what's required for it.
Once you see it, try to see if you can implement the item to have the same effect as the Ghost Academy.
So in this case, it's not about you as a player owning a ghost academy with nuke researched. It's a item that MAKES your nuke researched. You'd probably have to modify it so once the ability is used, the item either disappears, or if not, consumes charges or energy.
Since it seems like you'd prefer the latter, I'm guessing the item doesn't disappear, kinda like needing a sword to be able to slash (when your normally unarmed).
A way to make this simpler and easier and as plus use no triggers may be to use a behavior. From what I read your trying to make a specific item being 'carried' by the unit enable or disable an ability? Alright if thats correct heres how you can do that using a behavior. First create a behavior of type buff that works well and I use i all the time, only change you need is under the behavior flags make sure to change it to have hidden checked. All done with the behavior, next goto your item. Under the Carry Behaviors field add the new behavior we just created to it. All done with that, and now the final step, to make this work we will need a new requirement, so create a new requirement then double click the requirement+ field, under the Use folder right cick and select Add New Requirment Node, next select the newly added And and in the drop-down change it to Less-Than in the tool-tip put in some text like Hero must be Carying 'some' item. for example, next right click on the Less-Than back in the tree view, and click add requirment node again, make sure the new And is slected and from the drop-down change it to Count Behavior.
Now for the Alias find the behavior we created and added to our item, after that change the State Drop-down to Completed at Unit, with that done in the upper left change the view from tree view to Expression, don't panic just follow along, after the < sign delete the two parantheses () and type in a 1 with that done change it back to tree view and you should now see and added node that says Constant 1 now click ok. Congrats you created a brand new requirment! Now goto your ability that you want and Double click the Commands+ field for the ability. Select the Execute Command and down bellow under requirments change the view change it from button to tree (make it easier to find you requirment this way and also to fix a bug that can happen where you dont see anything in the requirment selection view) Find your requirment you just created and select it, as soon as you do that you will see the requirment in both the command Execute field and also the Requirement: field.
Click ok and save, and thats it your done! Make sure you delete or disable your old trigger to prevent any issues/interfernce. Now when you go in game if the unit dosn't have the item on them, the ability should be greyed out and when you mouse over the ability it will show under the Required: field the text we entered, go pick up the item and now the ability should be avalible for use! Hope that helps.
Unfortunately my problem cannot be fixed with a simple requirement/behavior )= Let me try to explain this allitle better. The "Hero" has 2 Weapon Slots in his inventory, One for his Left hand, And the other for his Right hand. Every weapon in the game has an ability "Attached" to it, (via the requirements that were explained above, but the buttons for all these abilities on the hero are hidden and not seen on the command card) When the owner of the hero clicks the left mouse button, the hero will be commanded to use the ability attached to whatever item is in his left weapon slot. and when the owner presses the right button the hero will use the ability attached to the item in the right slot.
Here is my example...
First im going to define a few objects in my map to you- Item1- Laser Gun - Fires a pulse of energy at your target that deals 100 damage Item2- Flame thrower - Shoots a pule of fire at your target dealing 200 damage Ability 1- Laser burst (the ability that deals 100 damage) Ability 2- Flame burst (the ability that deals 200 damage) Global Variables Left Weapon (Ability command var) Right Weapon (ability command var) Hero (unit var that is set to the hero the player controls) Target (a unit var that i have set up in order to specify the hero's current "Target") I will need 3 triggers, I already know what the first 2 are going to look like (unless anyone here on mapster can give me a better solution than what i am aiming for) Known triggers:
I will need 3 triggers, I already know what the first 2 are going to look like (unless anyone here on mapster can give me a better solution than what i am aiming for)
Known triggers:
So after that is set up it is just a matter of setting the variabols, Left Weapon and Right Weapon, the the correct abilitys when thir corrosponding item is in the heros Left or Right Weapon Slot
The trigger i am looking for will look somthing like this (I put the "Broken" parts in "<>", or the actions or trigger functions that dont really exist)
That "weapon Slot 1/2" is what i need, i need a way to referance a spacific inventory slot in triggers. or if someone else out there has a better idea on how i can accomplish this? i REALLY need help with this one.
(Btw when i use the condition "(Unit type of (Item carried by Hero in slot 1)) == whatever item" it dose not work right at all when i just set an interger value for the slot value)
Ive really been working hard on this. Going to call it a night for now, if anyone out there has any useful info on how i might go about making this work it would be greatly appreciated.
Okay well, there is no way to do what i am asking as of now apparently... /sigh i spent a few hours working on this new solution and i got it right.
What this solution dose is, i made a new Item Class, now i have 2 completely differant slot types, a Left Cannon Slot, and a Right Cannon Slot. I made duplicates of each item, (the items i will be using in my examples below) Left Photon Berral, Right Photon Berral, Left Photon Gun, Right Photon Gun, Left photon Cannon, Right Photon Cannon, Left Photon Blasters and Right Photon blasters. The Left and Right of each item are identicle Except for 2 things a- they only fit in to the Left/Right Slot type, AND The Left Weapons Give the Buff, Wep1, Wep2 etc... While the Right Versions of the weapon give Rwep1, Rwep2 the buffs have the same effect. (Left Photon Berral gives Wep1, Right Photon Berral gives Rwep1)
The main challange then presented itself...How to be able to switch these weapons around between each other, (Because i did not want a person to be forced to put a weapon he origionally buys for the left slot to be forced to keep it there, expecially because the side in witch the weapon is on determans witch mouse button you click in order to use it) I made this LOOOOOOONNNNNGGGGG trigger, but it covers all 14 player's heros and all 8 items above and allows them to be switched between the left and right versions. I gave each hero an ability called "Left To Right" witch is an instant cast ability with no effect that i used to start this trigger, i also made 2 Global Vars- Immortal Right Wep, and Immortal Left Wep, they are size 14 unit arrays. using other triggers i assigned these to whatever Weapon the Hero of each of the player has in the left/right weapon slot. So if player 3's hero had Left Photon Berral and Right Photon Cannon then
Immortal Left Wep [3]= the Left Photon Berral and Immortal Right Wep [3]= The Right Photon Cannon. I also have a Global Var that is a size 14 unit array called IMMORTALS that contains each player's hero. well hope you can understand this trigger below, it is a long one.
replaceleftw/righttestEventsUnit-AnyUnitusesLeftToRightatGeneric3-Executestage(Ignoresharedabilities)LocalVariablesNewLeftWep=NoGameLink<GameLink-Unit[14]>NewRightWep=NoGameLink<GameLink-Unit[14]>ConditionsActionsGeneral-Pickeachintegerfrom1to14,anddo(Actions)ActionsGeneral-If(Conditions)thendo(Actions)elsedo(Actions)If(Triggeringunit)==IMMORTALS[(Pickedinteger)]ThenGeneral-Switch(Actions)dependingon(UnittypeofImmortalRightWep[(Pickedinteger)])CasesGeneral-If(PhotonBarrel(Right))ActionsVariable-SetNewLeftWep[(Pickedinteger)]=PhotonBerral(Left)General-If(PhotonGun(Right))ActionsVariable-SetNewLeftWep[(Pickedinteger)]=PhotonGun(Left)General-If(PhotonCannon(Right))ActionsVariable-SetNewLeftWep[(Pickedinteger)]=PhotonCannon(Left)General-If(PhotonBlasters(Right))ActionsVariable-SetNewLeftWep[(Pickedinteger)]=PhotonBlasters(Left)General-If(NoGameLink)ActionsVariable-SetNewLeftWep[(Pickedinteger)]=NoGameLinkDefaultGeneral-Switch(Actions)dependingon(UnittypeofImmortalLeftWep[(Pickedinteger)])CasesGeneral-If(PhotonBerral(Left))ActionsVariable-SetNewRightWep[(Pickedinteger)]=PhotonBarrel(Right)General-If(PhotonGun(Left))ActionsVariable-SetNewRightWep[(Pickedinteger)]=PhotonGun(Right)General-If(PhotonCannon(Left))ActionsVariable-SetNewRightWep[(Pickedinteger)]=PhotonCannon(Right)General-If(PhotonBlasters(Left))ActionsVariable-SetNewRightWep[(Pickedinteger)]=PhotonBlasters(Right)General-If(NoGameLink)ActionsVariable-SetNewRightWep[(Pickedinteger)]=NoGameLinkDefaultGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfNewLeftWep[(Pickedinteger)]!=NoGameLinkThenUnit-RemoveImmortalRightWep[(Pickedinteger)]fromthegameElseGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfNewRightWep[(Pickedinteger)]!=NoGameLinkThenUnit-RemoveImmortalLeftWep[(Pickedinteger)]fromthegameElseSound-PlayArmory_Whatfor(Playergroup((Pickedinteger)))(at100.0%volume,skipthefirst0.0seconds)UI-Display"Please Stand By, Your Immortal Weap..."for(Playergroup((Pickedinteger)))toSubtitleareaUnit-MakeIMMORTALS[(Pickedinteger)]UncommandableGeneral-Wait3.0GameTimesecondsGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfNewLeftWep[(Pickedinteger)]==PhotonBerral(Left)ThenUnit-CreateonePhotonBerral(Left)itemintheinventoryofIMMORTALS[(Pickedinteger)]Variable-SetImmortalLeftWep[(Pickedinteger)]=(Lastcreatedinventoryitem)ElseGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfNewLeftWep[(Pickedinteger)]==PhotonGun(Left)ThenUnit-CreateonePhotonGun(Left)itemintheinventoryofIMMORTALS[(Pickedinteger)]Variable-SetImmortalLeftWep[(Pickedinteger)]=(Lastcreatedinventoryitem)ElseGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfNewLeftWep[(Pickedinteger)]==PhotonCannon(Left)ThenUnit-CreateonePhotonCannon(Left)itemintheinventoryofIMMORTALS[(Pickedinteger)]Variable-SetImmortalLeftWep[(Pickedinteger)]=(Lastcreatedinventoryitem)ElseGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfNewLeftWep[(Pickedinteger)]==PhotonBlasters(Left)ThenUnit-CreateonePhotonBlasters(Left)itemintheinventoryofIMMORTALS[(Pickedinteger)]Variable-SetImmortalLeftWep[(Pickedinteger)]=(Lastcreatedinventoryitem)ElseGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfNewRightWep[(Pickedinteger)]==PhotonBarrel(Right)ThenUnit-CreateonePhotonBarrel(Right)itemintheinventoryofIMMORTALS[(Pickedinteger)]Variable-SetImmortalRightWep[(Pickedinteger)]=(Lastcreatedinventoryitem)ElseGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfNewRightWep[(Pickedinteger)]==PhotonGun(Right)ThenUnit-CreateonePhotonGun(Right)itemintheinventoryofIMMORTALS[(Pickedinteger)]Variable-SetImmortalRightWep[(Pickedinteger)]=(Lastcreatedinventoryitem)ElseGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfNewRightWep[(Pickedinteger)]==PhotonCannon(Right)ThenUnit-CreateonePhotonCannon(Right)itemintheinventoryofIMMORTALS[(Pickedinteger)]Variable-SetImmortalRightWep[(Pickedinteger)]=(Lastcreatedinventoryitem)ElseGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfNewRightWep[(Pickedinteger)]==PhotonBlasters(Right)ThenUnit-CreateonePhotonBlasters(Right)itemintheinventoryofIMMORTALS[(Pickedinteger)]Variable-SetImmortalRightWep[(Pickedinteger)]=(Lastcreatedinventoryitem)ElseVariable-SetNewLeftWep[(Pickedinteger)]=NoGameLinkVariable-SetNewRightWep[(Pickedinteger)]=NoGameLinkUnit-MakeIMMORTALS[(Pickedinteger)]CommandableUI-Display"Cannon Optimization Complete"for(Playergroup((Pickedinteger)))toSubtitleareaSound-PlayCannonsCompletefor(Playergroup((Pickedinteger)))(at100.0%volume,skipthefirst0.0seconds)Else
So what this trigger dose is basicly Swap the 2 Weapons in the Invantory of the hero and reassign the vars. So now that i had that whole system set up i was able to make some more triggers that assigned the "Weapon Special" to a differant Left and Right Var... and then when the player presses the mouse button the hero is commanded to use the special of the item in its invantory...The Specials are all assigned to the same ability for now, (Photonic Overcharge) but i will be addin in other abilitys later. here are the triggers that made the Left Side work, (i also have mirriors of these triggers that cause the Right Side to work as well)
ExecuteLeftSpecialEventsUI-PlayerAnyPlayerclicksLeftmousebuttonDown.LocalVariablesConditionsActionsGeneral-Pickeachintegerfrom1to14,anddo(Actions)ActionsGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfLeftSpecial[(Pickedinteger)]==NoAbilityCommandThenUI-Display"You do not have a Left Cannon."for(Playergroup((Pickedinteger)))toSubtitleareaElseGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfAndConditions(Triggeringplayer)==(Pickedinteger)Target[(Pickedinteger)]!=NoUnitLeftSpecial[(Pickedinteger)]!=NoAbilityCommandThenUnit-OrderIMMORTALS[(Pickedinteger)]to(LeftSpecial[(Pickedinteger)]Target[(Pickedinteger)])(ReplaceExistingOrders)UI-Display"Overcharging Left Cannons..."for(Playergroup((Pickedinteger)))toSubtitleareaElseUI-Display"Invalid Target"for(Playergroup((Pickedinteger)))toSubtitlearea
Hope all that can help somebody, I hope i explained it alright.
Always a good way to find a work around but this is a nightmare on wheels particlaurly for multiple players. I would HIGHLY recommand learning about custom action defintions and custom condition defitions and functions, not only will you be able to use less triggers, witch is always a good thing, but it will clean up the code and make find issues and bugs and updates to this much easier for you and anyone else, theres some great tutorials on them in the tutorial forums, and despite what some people may belive or think you do NOT have to use galaxy script to make use of them. In fact you may find you can easily bring most if not all the actions you have set into each one.
I'm only suggesting this to make things easier on you, granted it wont be easy to recode a trigger this way (never is) but in the long run its more then worth it, in efficencity, preformance (witch is important particualry for lag concerns) and of course modfications/bug squashing. Ethier way cool stuff :)
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Okay so in my map each of my heros have 2 weapon slots, a left one and a right one, every weapon has a "Special" attached to it, and when a player presses the left or right mouse button the hero uses the special of the weapon in the corresponding slot. For exampol, one of my items is a "Photon Barrel" and the Photon barrel's special is Photonic Overcharge an ability that deals 100 damage. So i made this Trigger in order to accomplish that, Set Special Events UI - Player Any Player clicks Left mouse button Down. Local Variables Conditions Actions General - Pick each integer from 1 to 14, and do (Actions) Actions General - If (Conditions) then do (Actions) else do (Actions) If (Unit type of (Item carried by IMMORTALS[(Picked integer)] in slot 1)) == Photon Berral Then Unit - Order (Triggering unit) to ( Photonic Overcharge Target[(Picked integer)]) (Replace Existing Orders) Else
And then another one for item slot 2 with the right mouse. But it dose not work, it only works sometimes, i think the "Item In slot X" part is my problem, any idea how to fix this?
anyone at all? how do i do a trigger comparison for, specific item type in a specific slot?
@Antimatterthunder: Go bump
Look into how a ghost can launch a nuke, and check what's required for it. Once you see it, try to see if you can implement the item to have the same effect as the Ghost Academy.
So in this case, it's not about you as a player owning a ghost academy with nuke researched. It's a item that MAKES your nuke researched. You'd probably have to modify it so once the ability is used, the item either disappears, or if not, consumes charges or energy.
Since it seems like you'd prefer the latter, I'm guessing the item doesn't disappear, kinda like needing a sword to be able to slash (when your normally unarmed).
@Antimatterthunder: Go
A way to make this simpler and easier and as plus use no triggers may be to use a behavior. From what I read your trying to make a specific item being 'carried' by the unit enable or disable an ability? Alright if thats correct heres how you can do that using a behavior. First create a behavior of type buff that works well and I use i all the time, only change you need is under the behavior flags make sure to change it to have hidden checked. All done with the behavior, next goto your item. Under the Carry Behaviors field add the new behavior we just created to it. All done with that, and now the final step, to make this work we will need a new requirement, so create a new requirement then double click the requirement+ field, under the Use folder right cick and select Add New Requirment Node, next select the newly added And and in the drop-down change it to Less-Than in the tool-tip put in some text like Hero must be Carying 'some' item. for example, next right click on the Less-Than back in the tree view, and click add requirment node again, make sure the new And is slected and from the drop-down change it to Count Behavior.
Now for the Alias find the behavior we created and added to our item, after that change the State Drop-down to Completed at Unit, with that done in the upper left change the view from tree view to Expression, don't panic just follow along, after the < sign delete the two parantheses () and type in a 1 with that done change it back to tree view and you should now see and added node that says Constant 1 now click ok. Congrats you created a brand new requirment! Now goto your ability that you want and Double click the Commands+ field for the ability. Select the Execute Command and down bellow under requirments change the view change it from button to tree (make it easier to find you requirment this way and also to fix a bug that can happen where you dont see anything in the requirment selection view) Find your requirment you just created and select it, as soon as you do that you will see the requirment in both the command Execute field and also the Requirement: field.
Click ok and save, and thats it your done! Make sure you delete or disable your old trigger to prevent any issues/interfernce. Now when you go in game if the unit dosn't have the item on them, the ability should be greyed out and when you mouse over the ability it will show under the Required: field the text we entered, go pick up the item and now the ability should be avalible for use! Hope that helps.
Unfortunately my problem cannot be fixed with a simple requirement/behavior )= Let me try to explain this allitle better. The "Hero" has 2 Weapon Slots in his inventory, One for his Left hand, And the other for his Right hand. Every weapon in the game has an ability "Attached" to it, (via the requirements that were explained above, but the buttons for all these abilities on the hero are hidden and not seen on the command card) When the owner of the hero clicks the left mouse button, the hero will be commanded to use the ability attached to whatever item is in his left weapon slot. and when the owner presses the right button the hero will use the ability attached to the item in the right slot.
Here is my example...
First im going to define a few objects in my map to you- Item1- Laser Gun - Fires a pulse of energy at your target that deals 100 damage Item2- Flame thrower - Shoots a pule of fire at your target dealing 200 damage Ability 1- Laser burst (the ability that deals 100 damage) Ability 2- Flame burst (the ability that deals 200 damage) Global Variables Left Weapon (Ability command var) Right Weapon (ability command var) Hero (unit var that is set to the hero the player controls) Target (a unit var that i have set up in order to specify the hero's current "Target") I will need 3 triggers, I already know what the first 2 are going to look like (unless anyone here on mapster can give me a better solution than what i am aiming for) Known triggers:
I will need 3 triggers, I already know what the first 2 are going to look like (unless anyone here on mapster can give me a better solution than what i am aiming for) Known triggers:
So after that is set up it is just a matter of setting the variabols, Left Weapon and Right Weapon, the the correct abilitys when thir corrosponding item is in the heros Left or Right Weapon Slot
The trigger i am looking for will look somthing like this (I put the "Broken" parts in "<>", or the actions or trigger functions that dont really exist)
That "weapon Slot 1/2" is what i need, i need a way to referance a spacific inventory slot in triggers. or if someone else out there has a better idea on how i can accomplish this? i REALLY need help with this one. (Btw when i use the condition "(Unit type of (Item carried by Hero in slot 1)) == whatever item" it dose not work right at all when i just set an interger value for the slot value)
/bump
Ive really been working hard on this. Going to call it a night for now, if anyone out there has any useful info on how i might go about making this work it would be greatly appreciated.
@Quickshot14: Go
If only you could told me that in my theme... it helped me to hide the ability, when the carrier doesn't have an item.
Big thanks!
Okay well, there is no way to do what i am asking as of now apparently... /sigh i spent a few hours working on this new solution and i got it right. What this solution dose is, i made a new Item Class, now i have 2 completely differant slot types, a Left Cannon Slot, and a Right Cannon Slot. I made duplicates of each item, (the items i will be using in my examples below) Left Photon Berral, Right Photon Berral, Left Photon Gun, Right Photon Gun, Left photon Cannon, Right Photon Cannon, Left Photon Blasters and Right Photon blasters. The Left and Right of each item are identicle Except for 2 things a- they only fit in to the Left/Right Slot type, AND The Left Weapons Give the Buff, Wep1, Wep2 etc... While the Right Versions of the weapon give Rwep1, Rwep2 the buffs have the same effect. (Left Photon Berral gives Wep1, Right Photon Berral gives Rwep1) The main challange then presented itself...How to be able to switch these weapons around between each other, (Because i did not want a person to be forced to put a weapon he origionally buys for the left slot to be forced to keep it there, expecially because the side in witch the weapon is on determans witch mouse button you click in order to use it) I made this LOOOOOOONNNNNGGGGG trigger, but it covers all 14 player's heros and all 8 items above and allows them to be switched between the left and right versions. I gave each hero an ability called "Left To Right" witch is an instant cast ability with no effect that i used to start this trigger, i also made 2 Global Vars- Immortal Right Wep, and Immortal Left Wep, they are size 14 unit arrays. using other triggers i assigned these to whatever Weapon the Hero of each of the player has in the left/right weapon slot. So if player 3's hero had Left Photon Berral and Right Photon Cannon then Immortal Left Wep [3]= the Left Photon Berral and Immortal Right Wep [3]= The Right Photon Cannon. I also have a Global Var that is a size 14 unit array called IMMORTALS that contains each player's hero. well hope you can understand this trigger below, it is a long one.
So what this trigger dose is basicly Swap the 2 Weapons in the Invantory of the hero and reassign the vars. So now that i had that whole system set up i was able to make some more triggers that assigned the "Weapon Special" to a differant Left and Right Var... and then when the player presses the mouse button the hero is commanded to use the special of the item in its invantory...The Specials are all assigned to the same ability for now, (Photonic Overcharge) but i will be addin in other abilitys later. here are the triggers that made the Left Side work, (i also have mirriors of these triggers that cause the Right Side to work as well)
Hope all that can help somebody, I hope i explained it alright.
@Antimatterthunder: Go
Always a good way to find a work around but this is a nightmare on wheels particlaurly for multiple players. I would HIGHLY recommand learning about custom action defintions and custom condition defitions and functions, not only will you be able to use less triggers, witch is always a good thing, but it will clean up the code and make find issues and bugs and updates to this much easier for you and anyone else, theres some great tutorials on them in the tutorial forums, and despite what some people may belive or think you do NOT have to use galaxy script to make use of them. In fact you may find you can easily bring most if not all the actions you have set into each one.
I'm only suggesting this to make things easier on you, granted it wont be easy to recode a trigger this way (never is) but in the long run its more then worth it, in efficencity, preformance (witch is important particualry for lag concerns) and of course modfications/bug squashing. Ethier way cool stuff :)