- Joined
- Jul 19, 2007
- Messages
- 857
I need Tinker's "Pocket Factory" ability to be triggered because I want both the factory and it's summoned units to have hitpoints based on the casting Hero's level. Could anyone please help?
Well your triggers is only for the factory building but I also want the units summoned by the factory to have hit points based on casting hero's level.
Here is how I made the pocket factory. This is not exactly the same as what you need but it might help to inspire you.
In my project, I am mimicking Warcraft 3 from a different game engine so that editing the abilities will be easy or whatever.. But because of that, this ability code is not directly applicable to Warcraft 3. But you could implement a parallel concept.
Or, if you find it easier, you could make a trigger like:
The trigger solution will be a lot less customizable than the crazy in my video, but it would solve your problem pretty quickly I assume.
Events
Unit - A unit spawns a summoned unit
Conditions
Comparison - Unit type of (Summoned unit) equal to Pocket Factory
Action
Unit - Set the max hit points of (Summoned unit) equal to ((Max hit points of (Summoned unit)) + ((Level of (Summoning unit)) * 100))
I know how to do the HP scaling of Hero's level but I tried to test the spellpack you added on the thread you posted but nothing happened, no factory were summoned at all and what does the "Check Goblin's leash range" mean? Does it mean it will kill the summoned units if they are to far from the factory? I don't want it like that btw...[General] - How do you detect a Pocket Factory summon?
Detect Summoned Unit Events Unit - A unit Spawns a summoned unit Conditions Actions Game - Display to (All players) the text: (Name of (Summoned unit)) You can see here that it properly detects the water elemental. However, the pocket factory is not detected when...www.hiveworkshop.com
I'm sure you can figure out the scaling hit points, there's an Action to set a unit's Max HP and there's an Action to get the level of a unit's ability.
I still don't get how to do it... Please fix the spellpack you made in that thread because it's not working at all and I also use different spawn units in every level (4 levels).[General] - How do you detect a Pocket Factory summon?
Detect Summoned Unit Events Unit - A unit Spawns a summoned unit Conditions Actions Game - Display to (All players) the text: (Name of (Summoned unit)) You can see here that it properly detects the water elemental. However, the pocket factory is not detected when...www.hiveworkshop.com
I'm sure you can figure out the scaling hit points, there's an Action to set a unit's Max HP and there's an Action to get the level of a unit's ability.
I updated that post, there's a little mistake in the creation action:I still don't get how to do it... Please fix the spellpack you made in that thread because it's not working at all and I also use different spawn units in every level (4 levels).
Still not working. No factory is created...I updated that post, there's a little mistake in the creation action:
You need to create the factory at PF_Point[0]. Also, that's where you can modify the Factory unit.
Unit - Create 1 Pocket Factory (Level 1) for (Triggering player) at PF_Point[0] facing Default building facing degrees
To modify the spawned goblins you would change this line:
So get the level of the ability being cast and modify those two Actions to use different Unit-Types based on the level.
Set VariableSet PF_Goblin[PF_Index] = Clockwerk Goblin
Ok now it's working but I still don't know how to make it spawn different unit-types in each level of the ability.Worked for me, are you sure you're referencing the correct point?
It's a simple fix:
Set it to PF_Point[0] instead of PF_Point[PF_Index].
Unit - Create 1 Pocket Factory (Level 1) for (Triggering player) at PF_Point[0] facing Default building facing degrees
What level is the ability?
Ok I think I got it working now. I made it like this.I recommend learning how to make and modify basic triggers, this is a very easy one to do yourself. Try to break it down into simple steps:
First you need to figure out the level of the ability being cast. I imagine you may already know how to do this.
I recommend storing this information in an Integer variable so that you can easily reference it throughout the trigger"
Now since we want to spawn different unit-types based on the Ability Level we need to ask an important question:
Set Variable AbilityLevel = (Level of (Ability being cast) for (Triggering unit))
So how do you ask this question in the trigger? Simple, you use Conditions.
And how do you use Conditions inside of the Actions section of the trigger? Simple, you use an If Then Else action:
Now the logic is very simple, if the Ability Level is Equal to 1 then we want to spawn Pocket Factory (Level 1):
Events
Conditions
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Then - Actions
Else - Actions
If the Ability Level is Equal to 2 then we want to spawn Pocket Factory (Level 2):
If - Conditions
AbilityLevel Equal to 1
Then - Actions
Unit - Create 1 Pocket Factory (Level 1) for (Triggering player) at PF_Point[0] facing Default building facing degrees
This pattern continues for as many Levels as you'd like.
If - Conditions
AbilityLevel Equal to 2
Then - Actions
Unit - Create 1 Pocket Factory (Level 2) for (Triggering player) at PF_Point[0] facing Default building facing degrees
You can use this same logic on the goblin which is spawned using this variable:
Set VariableSet PF_Goblin[PF_Index] = Clockwerk Goblin
Another nice method is to setup and use an Array variable with the [index] representing the different levels of the ability:
Set Variable GoblinType[1] = Clockwerk Goblin (Level 1)
Set Variable GoblinType[2] = Clockwerk Goblin (Level 2)
Set Variable GoblinType[3] = Clockwerk Goblin (Level 3)
Set Variable PF_Goblin[PF_Index] = GoblinType[AbilityLevel]