| 02-08-2004, 01:01 AM | #1 |
Okay, I have a hero with an ability that summons a wisp dummy that lasts .01 of a second. A trigger, Familiar Red Events Unit - A unit Finishes casting an ability Conditions (Owner of (Casting unit)) Equal to Player 1 (Red) (Unit-type of (Casting unit)) Equal to Wraith (Ability being cast) Equal to Summon Shade Actions If (All Conditions are True) then do (Then Actions) else do (Else Actions) If - Conditions ShadeBoolean[0] Equal to False Then - Actions Unit - Create 1 Shade (Wraith Familiar) for Player 1 (Red) at (Target point of ability being cast) facing Default building facing degrees Special Effect - Create a special effect attached to the origin of (Last created unit) using Objects\Spawnmodels\Undead\UDeathSmall\UDeathSmall.mdl Set ShadeFamiliar[0] = (Last created unit) Set ShadeBoolean[0] = True Else - Actions Do nothing If (All Conditions are True) then do (Then Actions) else do (Else Actions) If - Conditions ShadeBoolean[0] Equal to True Then - Actions Unit - Create 1 Shade (Wraith Familiar) for Player 1 (Red) at (Target point of ability being cast) facing Default building facing degrees Special Effect - Create a special effect attached to the origin of (Last created unit) using Objects\Spawnmodels\Undead\UDeathSmall\UDeathSmall.mdl Set ShadeFamiliar[0] = (Last created unit) Else - Actions Do nothing --- Checks for when the hero casts the spell, then it checks to see if the hero has casted it before (ShadeBoolean[0] Equal to False). If the hero hasn't casted the spell before, it creates a Shade Familiar at the target point of casted spell (200 range in front of the hero, I think), and sets a Unit Variable (ShadeFamiliar[0]) to equal the Shade Familiar ("last created unit"). We'll get back to this trigger in a moment, for now, let's look at the second trigger: Familiar Red Die Events Unit - A unit Dies Conditions (Owner of (Dying unit)) Equal to Player 1 (Red) (Unit-type of (Dying unit)) Equal to Shade (Wraith Familiar) Actions Set ShadeFamiliar[0] = (Dying unit) --- This trigger checks for when the Shade Familiar (now set to ShadeFamiliar[0]) dies, and re-sets it to the variable (ShadeFamiliar[0]). Now, back to the first trigger. This is to make the unit variable (ShadeFamiliar[0]) contain the dying units stats. The second part of the first trigger, the underlined part, I have some questions on. Unit - Create 1 Shade (Wraith Familiar) for Player 1 (Red) at (Target point of ability being cast) facing Default building facing degrees How do I make it so it creates the previously created shade (with the same experiance, level, abilities, ect)? In the Variables drop-down menu, it doesn't show my Unit (ShadeFamiliar[0]) Variable; so I can't! Please help me on this, my goal is to make a fully functional Familiar Summoning spell that summons a familiar that retains all of it's stats, levels, ect, when it dies and is resummoned. Thanks! |
| 02-08-2004, 01:07 AM | #2 |
Thats because it creates a unit from a type, It can't create a unit from an already existing unit. If it is a hero unit like your suggest by having levels and the sort why don't you use the hero-revive hero trigger. That probably what you want. |
| 02-08-2004, 01:22 AM | #3 |
...Heh, I knew there was probably an easy work-around. I'll see what I can come up with using that function. Thanks... |
| 02-08-2004, 02:58 AM | #4 |
Trigger 1, the summoning trigger that checks if the player has summoned before. If not, then this trigger activates: Code:
Familiar Cast Red
Events
Unit - A unit Finishes casting an ability
Conditions
(Unit-type of (Casting unit)) Equal to Wraith
(Ability being cast) Equal to Summon Shade
ShadeBoolean[(Integer((String((Player number of (Owner of (Casting unit)))))))] Equal to False
Actions
Game - Display to (All players) the text: Summon Shade Shade...
Unit - Create 1 Shade (Wraith Familiar) for (Owner of (Casting unit)) at ((Owner of (Casting unit)) start location) facing Default building facing degrees
Special Effect - Create a special effect attached to the origin of (Last created unit) using Objects\Spawnmodels\Undead\UDeathSmall\UDeathSmall.mdl
Set ShadeBoolean[(Integer((String((Player number of (Owner of (Casting unit)))))))] = TrueDid I do the "Set ShadeBoolean[(Integer((String((Player number of (Owner of (Casting unit)))))))] = True" correctly? That may be the whole problem if I didn't. This trigger DOES summon the Shade Familiar, so I guess it works (and it displays the Test Text.) Trigger 2, the 2nd summoning trigger that checks if the player has summoned before. If yes, then this trigger activates: Code:
Familiar Cast Red 2
Events
Unit - A unit Spawns a summoned unit
Conditions
(Unit-type of (Summoning unit)) Equal to Wraith
(Ability being cast) Equal to Summon Shade
(Unit-type of (Summoned unit)) Equal to (??) Dummy Unit (CMB)
ShadeBoolean[(Integer((String((Player number of (Owner of (Casting unit)))))))] Equal to True
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to Shade (Wraith Familiar)) and (((Matching unit) is alive) Equal to True)))) Greater than or equal to 1
Then - Actions
Game - Display to (All players) the text: Summon Shade Shade...
Unit - Set mana of (Summoning unit) to ((Mana of (Summoning unit)) + 125.00)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to Shade (Wraith Familiar)) and (((Matching unit) is dead) Equal to True)))) Greater than or equal to 1
Then - Actions
Hero - Instantly revive (Picked unit) at (Position of (Summoning unit)), Hide revival graphics
Else - ActionsThis trigger detects if, when the spell is cast (and the dummy unit enters the map), the Shade Familiar is still alive. If it is, then it gives the caster his mana back, to simulate a failed casting. If the Shade Familiar is dead (look to the next trigger for the Death functions), then it instantly resurrects it at the players start location. However, this does NOT work! Trigger 3, the death trigger. This should suspend the Shades corpse decay (preventing it from being ressurectable, right?), and allow it to be 'recalled' when the hero casts the spell again. Code:
Familiar Red Die 2
Events
Unit - A unit Dies
Conditions
(Unit-type of (Attacked unit)) Equal to Shade (Wraith Familiar)
Actions
Unit - Suspend corpse decay for (Dying unit)However, this trigger doesn't work either! Please help! |
