I have this code here to check if my Ghost fires his regular gun, but I need to make it realistic. I don't know how to make a condition to check if any unit in the unit group Enemy Units, is within the distance of 18 when the gun is shot. Also, how do you do the <<Code>> or whatever it is?
GhostShootGun?
Events
Unit - Any Unit takes Fatal or Non-Fatal Any damage (from Any effects)
Unit Group - Pick each unit in (Any units in (Entire map) owned by player 2 matching Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
Actions
Unit - Order (Picked unit) to ( Attack targeting (Position of (Killing unit))) (Replace Existing Orders)
To make a distance check u can use the "distance between points" trigger passing the position of the shooter and of the picked unit u want to check.
Else make something better and instead of using Entire Map create a circle region with the radius u need centered on the shooter
I personally would use data for this. Make a set type effect with the damage and a search area. Make the search area search for the enemies and then apply a behavior or use issue order.
Thank you very much Bibendus, this really helps. I've been trying to wrap my head around it for days, haha. I didn't come here until yesterday figuring I could sort it out. >_>
One more question, I know simple Item setup (Create the unit, actor, etc). I made weapon items, armor items, etc. But I don't know how to create consumables. I have an entirely trigger based Hunger System, and I've already got the code to restore it:
HungerSearchEventsEnvironment-PlayerAnyPlayerusesEffectApplyEatingLocalVariablesConditionsActionsUnitGroup-Pickeachunitin(Anyunitsin(Entiremap)ownedbyplayer(Triggeringplayer)matchingRequired:Heroic;Excluded:Missile,Dead,Hidden,withatmost1)anddo(Actions)ActionsUI-Display((Nameofplayer(Triggeringplayer))+": Your Survivor is eating.")for(Playergroup((Triggeringplayer)))toChatareaSound-PlayCrunchyChipsfor(Allplayers)on(Pickedunit)withZoffset0.0(at100.0%volume,skipthefirst0.0seconds)Unit-Pause(Pickedunit)General-Wait2.0GameTimesecondsUnit-Unpause(Pickedunit)UI-Display((Nameofplayer(Triggeringplayer))+": Your Survivor has finished eating...")for(Playergroup((Triggeringplayer)))toChatareaVariable-ModifyHunger[(Triggeringplayer)]:+20UI-Setbossbar(Triggeringplayer)currentvaluetoHunger[(Triggeringplayer)](Dorefreshthebossbar)
I just need to create an item which will be consumed on use, and will create an effect which I can recall here.
look in the item type fields, there will be a effect, target effect, etc. then you can mark death on use i think is what the field is, something like that though.
One more question, I know simple Item setup (Create the unit, actor, etc). I made weapon items, armor items, etc. But I don't know how to create consumables. I have an entirely trigger based Hunger System, and I've already got the code to restore it:
I just need to create an item which will be consumed on use, and will create an effect which I can recall here.
Consumables are units of type item, check for other ingame consumables you find in campaign like pickable resources.
They just trigger an effect on pickup.
Consumables are units of type item, check for other ingame consumables you find in campaign like pickable resources.
They just trigger an effect on pickup.
I meant such as a Potion from Diablo, I need to have it in the Hero Inventory "Bag" and trigger an effect upon use. Anyone have a tutorial for making items in general? I wish to better myself in this field anyways.
I meant such as a Potion from Diablo, I need to have it in the Hero Inventory "Bag" and trigger an effect upon use. Anyone have a tutorial for making items in general? I wish to better myself in this field anyways.
I don't have a tutorial, but I do know that setting up items can be a bit frustrating at times. For creating a consumable item you need to set the "Destroy when depleted" flag to True (checked.) In the effect cost+ field you will need to set up the number of charges, the charges consumed per use (typically 1,) and any cooldowns you want. For effect you will need, at minimum, a dummy instant effect (such as damage with a value of 0.) This isn't even necessary to link the item to a trigger (you can use the Unit Manipulates Inventory event.) It is necessary for the item to be usable though.
You will also need a unit to represent the item when it's dropped on the ground. A generic unit type will do. Set the Stats - Item field to the consumable item you just made. Also make sure Radius is set to either 0 or low enough that other units can actually pick it up. Oh, and don't forget to give it an appropriate actor! Crates or barrel models work nicely as starting points.
At this point I recommend you try placing the item in the map and running a test to make sure it can be picked up and consumed. Rinse and repeat until you get it to work.
Once you're ready for triggers, use the Unit Manipulates Inventory event and set the appropriate event parameters/conditions. You can use the Effect Used event if you insist, though if you're using a single dummy effect for multiple items it can be difficult to get the right item used. Set the actions to your heart's content... you don't need to worry about removing the item.
Right, I just realized this; I have two maps that need/can use the same system... but in different ways.
Ghost Infiltration: That's perfect.
City of Horrors: I just need to check if any Infected are within a radius of 36, and have them attack the last position of the player (If the player doesn't have a Behavior on them.) Plus set a Ping on that position to all other players within a radius of 36, lasting for three seconds.
How can I change up that trigger Bibendus made, and turn it into the City of Horrors version.
I'd use a compare trigger to check if the unit does not have the behavior so instead of == use !=. And then I'd use a ping trigger on location of triggering unit. Might be easier to use my data method for this, that I listed above.
Just take bibendus's trigger and make it so that instead of finding the closest unit it cause all infested units (whom I assume belong to player 15) to attack the guy. And then just check for each player to see if their units are within 36 radii of the triggering unit and ping him if they are.
I have this code here to check if my Ghost fires his regular gun, but I need to make it realistic. I don't know how to make a condition to check if any unit in the unit group Enemy Units, is within the distance of 18 when the gun is shot. Also, how do you do the
<<Code>>
or whatever it is?GhostShootGun?
Events
Unit - Any Unit takes Fatal or Non-Fatal Any damage (from Any effects)
Local Variables
Conditions
(Damaging effect) == Ghost - C-10 Canister Rifle (Damage)
Actions
Unit Group - Pick each unit in (Any units in (Entire map) owned by player 2 matching Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
Actions
Unit - Order (Picked unit) to ( Attack targeting (Position of (Killing unit))) (Replace Existing Orders)
To make a distance check u can use the "distance between points" trigger passing the position of the shooter and of the picked unit u want to check.
Else make something better and instead of using Entire Map create a circle region with the radius u need centered on the shooter
The Entire Map part is the Sound the Alarm part, every unit goes and attacks the ghost.
I need to something like this:
Check if there is ANY unit in Enemy unit within 12 distance of Ghost upon the damaging effect.
(Distance between (Position of (Unit 1 from Enemy Units)) and (Position of Ghost [18.10, 14.10])) == 12.0
That's what I've gotten so far, now I just need to make it:
Change Unit 1 to the first unit within a distance of 12, while making sure that unit is in Enemy units.
And then be able to store the unit in a Variable...
I have no clue how to find the unit.
I personally would use data for this. Make a set type effect with the damage and a search area. Make the search area search for the enemies and then apply a behavior or use issue order.
Nah, using data for closest unit sorting in range is too tedious and complex for non data experts so advise against it
You can use a simple trigger like this (there are different ways of doing it)
@Bibendus: Go That's how i'd do it, only i like to do for each instead of picked unit, but to each their own preference.
@Alnatair: Go
it's
<<code>> and <</code>>
more info found here http://www.sc2mapster.com/wiki/knowledge-base/markup-types/
Still alive and kicking, just busy.
My guide to the trigger editor (still a work in progress)
Thank you very much Bibendus, this really helps. I've been trying to wrap my head around it for days, haha. I didn't come here until yesterday figuring I could sort it out. >_>
One more question, I know simple Item setup (Create the unit, actor, etc). I made weapon items, armor items, etc. But I don't know how to create consumables. I have an entirely trigger based Hunger System, and I've already got the code to restore it:
I just need to create an item which will be consumed on use, and will create an effect which I can recall here.
look in the item type fields, there will be a effect, target effect, etc. then you can mark death on use i think is what the field is, something like that though.
Still alive and kicking, just busy.
My guide to the trigger editor (still a work in progress)
I prefer to use "for each" too because using multiple innested "pick" triggers will cause an index error, I just used pick to make it simpler ;)
Consumables are units of type item, check for other ingame consumables you find in campaign like pickable resources.
They just trigger an effect on pickup.
I meant such as a Potion from Diablo, I need to have it in the Hero Inventory "Bag" and trigger an effect upon use. Anyone have a tutorial for making items in general? I wish to better myself in this field anyways.
I don't have a tutorial, but I do know that setting up items can be a bit frustrating at times. For creating a consumable item you need to set the "Destroy when depleted" flag to True (checked.) In the effect cost+ field you will need to set up the number of charges, the charges consumed per use (typically 1,) and any cooldowns you want. For effect you will need, at minimum, a dummy instant effect (such as damage with a value of 0.) This isn't even necessary to link the item to a trigger (you can use the Unit Manipulates Inventory event.) It is necessary for the item to be usable though.
You will also need a unit to represent the item when it's dropped on the ground. A generic unit type will do. Set the Stats - Item field to the consumable item you just made. Also make sure Radius is set to either 0 or low enough that other units can actually pick it up. Oh, and don't forget to give it an appropriate actor! Crates or barrel models work nicely as starting points.
At this point I recommend you try placing the item in the map and running a test to make sure it can be picked up and consumed. Rinse and repeat until you get it to work.
Once you're ready for triggers, use the Unit Manipulates Inventory event and set the appropriate event parameters/conditions. You can use the Effect Used event if you insist, though if you're using a single dummy effect for multiple items it can be difficult to get the right item used. Set the actions to your heart's content... you don't need to worry about removing the item.
That, at least, is how I do it. More or less.
@BasharTeg: Go
Thank you very much, I'll try it.
Right, I just realized this; I have two maps that need/can use the same system... but in different ways.
Ghost Infiltration: That's perfect.
City of Horrors: I just need to check if any Infected are within a radius of 36, and have them attack the last position of the player (If the player doesn't have a Behavior on them.) Plus set a Ping on that position to all other players within a radius of 36, lasting for three seconds.
How can I change up that trigger Bibendus made, and turn it into the City of Horrors version.
I'd use a compare trigger to check if the unit does not have the behavior so instead of == use !=. And then I'd use a ping trigger on location of triggering unit. Might be easier to use my data method for this, that I listed above.
Make up your mind! :P
http://www.sc2mapster.com/forums/development/triggers/52069-day-z-style-attack/
Yea that's what I meant for you to do.
@Alnatair: Go
Just take bibendus's trigger and make it so that instead of finding the closest unit it cause all infested units (whom I assume belong to player 15) to attack the guy. And then just check for each player to see if their units are within 36 radii of the triggering unit and ping him if they are.
Still alive and kicking, just busy.
My guide to the trigger editor (still a work in progress)