Hello once more Hivers! I've came here now to ask for some advice.
I have an ability called "Call of the Tribes", that each 1.5 seconds, summons a group of trolls at random places inside a region. The spell is working fine, but, sometimes, the owner of the summoned units changes to another allied player. Mechanically, there is no problem, since my project is a teamplay game, but summoned units must be owned by the casting player. Below, I'll put the spell:
I don't know what is happening, since I think that when we define the casting player via "Temp_Player", it can track who is the owner of the summoned units. Maybe the logic of the spell is wrong and I've just missplaced something, or something is missing here... I don't know. What I've checked so far:
And another small question for you who is reading: I'm noticing that my project is getting a certain number of triggered spells using "Temp_Location", "Temp_Point", and so on. Is it good to change these temporary variables into arrays (6 in total), and set them via "Triggering Player"? I think this will prevent some bugs to occur, when two or more players cast spells that use these temporary variables.
Curiosity: "Why didn't you use Dark Portal casted by dummies instead of this trigger?" Because the idea behind this spell, is to create groups that can self-sustain themselves. With the trigger, I can set a minimum of 1 unit of each type (4 types total), not possible with the standard Dark Portal, that summon the units from the list randomly.
I have an ability called "Call of the Tribes", that each 1.5 seconds, summons a group of trolls at random places inside a region. The spell is working fine, but, sometimes, the owner of the summoned units changes to another allied player. Mechanically, there is no problem, since my project is a teamplay game, but summoned units must be owned by the casting player. Below, I'll put the spell:
- This trigger is the setup, when the player casts the spell:
-
Call of the Tribes
-
Events
-
Unit - A unit Starts the effect of an ability
-
-
Conditions
-
(Ability being cast) Equal to Call of the Tribes (Tier 3)
-
-
Actions
-
Set VariableSet Temp_Player = (Owner of (Casting unit))
-
Set VariableSet Trapper_Ability_Level = (Level of (Ability being cast) for (Casting unit))
-
Sound - Play UltimateTrapper <gen>
-
Floating Text - Create floating text that reads ((Name of (Ability being cast)) + !) above (Triggering unit) with Z offset 0.00, using font size 12.00, color (100.00%, 100.00%, 0.00%), and 0.00% transparency
-
Floating Text - Change (Last created floating text): Disable permanence
-
Floating Text - Set the velocity of (Last created floating text) to 128.00 towards 90.00 degrees
-
Floating Text - Change the fading age of (Last created floating text) to 1.20 seconds
-
Floating Text - Change the lifespan of (Last created floating text) to 3.60 seconds
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Level of (Ability being cast) for (Casting unit)) Equal to 1
-
-
Then - Actions
-
Set VariableSet Trapper_Units[1] = Troll Warlord (1)
-
Set VariableSet Trapper_Units[2] = Troll Hunter (1)
-
Set VariableSet Trapper_Units[3] = Troll Priest (1)
-
Set VariableSet Trapper_Units[4] = Troll Sorcerer (1)
-
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Level of (Ability being cast) for (Casting unit)) Equal to 2
-
-
Then - Actions
-
Set VariableSet Trapper_Units[1] = Troll Warlord (2)
-
Set VariableSet Trapper_Units[2] = Troll Hunter (2)
-
Set VariableSet Trapper_Units[3] = Troll Priest (2)
-
Set VariableSet Trapper_Units[4] = Troll Sorcerer (2)
-
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Level of (Ability being cast) for (Casting unit)) Equal to 3
-
-
Then - Actions
-
Set VariableSet Trapper_Units[1] = Troll Warlord (3)
-
Set VariableSet Trapper_Units[2] = Troll Hunter (3)
-
Set VariableSet Trapper_Units[3] = Troll Priest (3)
-
Set VariableSet Trapper_Units[4] = Troll Sorcerer (3)
-
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Level of (Ability being cast) for (Casting unit)) Equal to 4
-
-
Then - Actions
-
Set VariableSet Trapper_Units[1] = Troll Warlord (4)
-
Set VariableSet Trapper_Units[2] = Troll Hunter (4)
-
Set VariableSet Trapper_Units[3] = Troll Priest (4)
-
Set VariableSet Trapper_Units[4] = Troll Sorcerer (4)
-
-
Else - Actions
-
-
-
-
-
-
-
-
Trigger - Turn on Trapper Summons <gen>
-
-
- This trigger is the looped effect, that occurs every 1.5 seconds:
-
Trapper Summons
-
Events
-
Time - Every 1.50 seconds of game time
-
-
Conditions
-
Actions
-
Set VariableSet Trapper_Counter = (Trapper_Counter + 1)
-
Set VariableSet Temp_Spell_Location = (Random point in Player Arena Spawn <gen>)
-
For each (Integer A) from 1 to 4, do (Actions)
-
Loop - Actions
-
Unit - Create (Random integer number between 1 and Trapper_Ability_Level) Trapper_Units[(Integer A)] for Temp_Player at Temp_Spell_Location facing Default building facing degrees
-
Special Effect - Create a special effect at Temp_Spell_Location using Flamestrike Dark Void I.mdx
-
Special Effect - Destroy (Last created special effect)
-
-
-
Custom script: call RemoveLocation( udg_Temp_Spell_Location )
-
Trigger - Run Summon Condition <gen> (checking conditions)
-
-
- And this one is the condition to make the loop stop, and turn off the looping trigger:
-
Summon Condition
-
Events
-
Conditions
-
Trapper_Counter Equal to 5
-
-
Actions
-
Set VariableSet Trapper_Counter = 0
-
Trigger - Turn off Trapper Summons <gen>
-
-
I don't know what is happening, since I think that when we define the casting player via "Temp_Player", it can track who is the owner of the summoned units. Maybe the logic of the spell is wrong and I've just missplaced something, or something is missing here... I don't know. What I've checked so far:
- Temp_Player was only used by the troll hero, on all noticed times that units changed their owner;
- The spell is unique, so there is no chance that it can be casted twice, since the hero that have this spell is unique, as well all other abilities in the project;
- Temp_Spell_Location is only being used in this trigger, nowhere else;
And another small question for you who is reading: I'm noticing that my project is getting a certain number of triggered spells using "Temp_Location", "Temp_Point", and so on. Is it good to change these temporary variables into arrays (6 in total), and set them via "Triggering Player"? I think this will prevent some bugs to occur, when two or more players cast spells that use these temporary variables.
Curiosity: "Why didn't you use Dark Portal casted by dummies instead of this trigger?" Because the idea behind this spell, is to create groups that can self-sustain themselves. With the trigger, I can set a minimum of 1 unit of each type (4 types total), not possible with the standard Dark Portal, that summon the units from the list randomly.