Tower Defence REINCARNATE Pathing

BlackRose

Forum User
If a unit with REINCARNATE died, then came back to life, how would I set it back on course?

And what does "set bj_wantDestroyGroup = true" mean, I know a little bit about JASS, but what's it do?
 

Frozenwind

System maker
JassCode
That removes a the memory leak of an unitgroup which you create AFTER this script.
Example:
Code:
Custom Script: (set bj_wantDestroyGroup = true)
unitgroup - pick every unit in units of type (footman) and do (kill picked unit)
You don't got a memory leak then (less lag and less chance for memory split (sync the game)).

Reincarnation
Code:
If a unit with REINCARNATE died, then came back to life, how would I set it back on course?
Use custom values.
First set the regions where he should go to like this:
Code:
set region[0] = region001
set region[1] = region002
etc.
And then:
Code:
Unit enters region[0]
set custom value of unit to custom value of unit +1

Unit enters region[1]
set custom value of unit to custom value of unit +1
etc.
And now the final thing:
Code:
Events:
    unit dies
Condition:
    unittype of dying unit is equal to (REINCARNATOR)
Action:
    Custom Script: (local unit a = GetTriggerUnit ())
    wait >>revivetime<<
    Custom Script: (set udg_TempUnit = a)
    Order (TempUnit (variable)) to move to region[customvalue of unit...)
Get it?

frozenwind.
 

N2o)

Retired.
Why not just localise the temp unit:
Code:
Events:
    unit dies
Condition:
    unittype of dying unit is equal to (REINCARNATOR)
Action:
    Custom Script: (local unit udg_TempUnit = GetTriggerUnit ())
    wait >>revivetime<<
    Order (TempUnit) to move to region[customvalue of (TempUnit)]
 

Shadow14l

New Member
set bj_wantDestroyGroup = true

After the next group's use (as a function), it automatically removes it.

=================================

Set the unit a bit back so it won't die again when it starts reincarnating:

Variable: TempPoint (Point)

 

Flare

Stops copies me!
Staff member
as far as i know, you cant detect when a passive ability triggers, so starts the effect of an ability would do nothing? also, when a unit 'dies' while reincarnation is ready to activate, does the 'Unit dies' event apply? if it doesnt, you could use 'Unit's life becomes less than 1'. since that event only allows preplaced units, you'll have to add the event through the action 'Trigger - Add New Event'
 

Shadow14l

New Member
He wouldnt want to move instantly
It wouldn't be too noticeable, and the unit wouldn't die when respawning. - the point of this thread!

"Order dying unit to move to point"
That would not work due to some obvious reasons:

1. Dead units can't move
2. It's using reincarnation, so technically it's not dead
3. While using reincarnation, you can't move
4. What point?
5. If that point were to be similair to mine, then it still wouldn't work, as unit would respawn on 'death terrain', then immediately die again before it had the chance to move away.

as far as i know, you cant detect when a passive ability triggers
You can't, but for this special abillity, the chieftain 'uses' reincarnation, whenever it dies, since it also has a cooldown.

So technically it really wouldn't be that much of a passive abillity.
 

Drunken_God

Hopes to get back into Mapmaking with SC2 :)
maybe trigger the ability?
Code:
Events - A unit dies
Conditions - 
triggering unit is not in unitgroup
unit-type of triggering unit equal to BLah
Actions
add triggering unit to unitgroup
set temppoint = position of triggering unit
create 1 (unit-type of triggering unit) at temppoint
Custom script call RemoveLocation(udg_temppoint)
 

Ghan

Administrator - Servers are fun
Staff member
I often set up a system for pathing based on units' custom values.
Each region that the unit enters increases it's custom value by 1.
All the regions are stored in a region array, so you simply order the unit to move to the center of RegionArrayVariable[Custom Value of Triggering Unit].

Then, I usually do a simple periodic (every 2 seconds or so) trigger that picks every unit owned by the proper player, and If the Current Order of Picked Unit is equal to "none", then order the unit to move to the next region from the system above.

If you want to do that, make sure that you clear all leaks.
 

BlackRose

Forum User
Well, I did that with arrays and custom values. But I wasn't sure how to move it after it reincarnated, I tried "A Unit Starts the Effect of An Ability (or whatever it is)".

So how would it work?
 

emootootoo

Top Banana
You could go

Events
A unit dies

Conditions
Level of Reincarnation for triggering unit > 0
Level of DummyAbility for triggering unit < 1

Actions
Add DummyAbility to triggering unit
Wait <a tiny bit longer than it takes the reincarnate> seconds
order triggering unit to move to <point>

Adding the dummy ability would make it so the unit can only reincarnate once
 
General chit-chat
Help Users
  • No one is chatting at the moment.

    Staff online

    • Ghan
      Administrator - Servers are fun

    Members online

    Affiliates

    Hive Workshop NUON Dome World Editor Tutorials

    Network Sponsors

    Apex Steel Pipe - Buys and sells Steel Pipe.
    Top