• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Chance to Revive

Status
Not open for further replies.
Level 17
Joined
Jan 21, 2007
Messages
2,014
I think something like this would work...

Events - A unit dies
Conditions - Unit-type of (triggering unit) is equal to skeleton
Random number between 1 and 100 less than or equal to 10
Actions - wait 5 seconds
Create 1 unit of unit-type of (triggering unit) for (owner of (triggering unit)) at position of (triggering unit).
(to remove corpse, but skeletons don't usually leave corpses)
Remove (triggering unit)


I'm not sure about this, i'm tired and away from WE, so i can't test it.
 
Level 17
Joined
Jan 21, 2007
Messages
2,014
I think it has something to do with the wait action then, i don't know why the trigger wouldn't work otherwise.

Maybe u could create a dummy spell based on ressurection with 10 range and 5 seconds casting time? just place the dummy at top of the dead unit.

This would bug if someone dies right ahead of your dead unit though :bored:
 
that wont work unless you hide the reincarnation ability, since then you would see which units will ressurect. No, i don't think a preset ability will do it.
but i'm too tired to make up a solution to go around the wait :confused:

plus i don't think u would need 2 triggers for that

Without 2 triggers it won't recognize the random number plus I just tested it and it is working quite well. All you need to do is 2 abilities with the same name and tooltip, make one do nothing and the other the reincarnation ability. It will be impossible to tell which ones will revive until they do it.

Infact here is an example of it.
 
Last edited:
Level 17
Joined
Jan 21, 2007
Messages
2,014
It may work, but then u would have to remove the reincarnation directly after it is used, and i don't think reincarnating count's as dying(tried it sometime)

And it is still preset, it may not be noticeable in-game, but i still think that it is a big no,no, as with using custom values for simple things.

Hey!!1! Got an idea!
If ur not currently using custom values, we could maybe use that as a timer by creating a periodic event that will pick all matching units and decrease their custom value?
 
Level 7
Joined
Jun 16, 2008
Messages
327
This should maybe work:

Events: Unit - A Unit Dies
Conditions: Unit-Type - Unit-type of (Dying Unit) equal to Skeleton
Actions: Set <Integer> = Random integer number between 1 and 100
Wait - Wait 5 Seconds
If (All Conditions Are True) Then Do (Then Actions) Else do (Else Actions)
- IF - CONDITIONS
<Integer> Less than or Equal To 10
- THEN - ACTIONS
Turn Off trigger - (This Trigger)
Create 1 Unit-Type of (Dying Unit) for (Owner of (Dying Unit)) at (Position of (Dying Unit)) facing Default Building Degrees
Remove (Dying Unit) from game
- ELSE - ACTIONS
Do Nothing


This is basically a guess, but try it.
 
Last edited:
Level 7
Joined
Jun 16, 2008
Messages
327
You didn't use a If/then/Else action, nor did you use the set variable action.

Also, the integer has a chance of being set to a number over 10 (Maximum 100), and its on the same scale as percentage, so you got a 90% chance he WON'T revive, hence the Else Action. (100 (Maximum) - 10 (Required) = 90)

Please remember I am not trying to argue, I am simply observing and I can understand your point of view. No offense ,okay?
 
Level 17
Joined
Jan 21, 2007
Messages
2,014
Lol good, u changed it to less than or equal to 10 instead of more than 10. that was what i meant with 90%.

Also, i don't think that's the problem, u don't need the variable and if/then/else thingie for it to work, that's basically the same thing as an condition if you set else to (do nothing)

It's the same, confused if it should work now :xxd:

though it could be dying unit instead of triggering unit.
 
Level 7
Joined
Jun 16, 2008
Messages
327
Lol good, u changed it to less than or equal to 10 instead of more than 10. that was what i meant with 90%.

Also, i don't think that's the problem, u don't need the variable and if/then/else thingie for it to work, that's basically the same thing as an condition if you set else to (do nothing)

It's the same, confused if it should work now :xxd:

We need the "set variable" action because the integer IS a variable. If you don't set it, then the 90% chance is gone and he'll either respawn ALL the time or NEVER respawn.

You need the If/Then/Else action to support a secondary condition (The integer, which would'nt be there if the set variable action wasn't issued... :wink: )
The Then action would then execute the revival and the Else Action is the only thing we don't need, but still put it in to make it more accurate.

EDIT: WOOPS! I forgot an important action: TURN OFF TRIGGER, since Ghost wants it to revive only once. Put the Turn Off action in the Else and Then Section.
 
Last edited:
Level 17
Joined
Jan 21, 2007
Messages
2,014
the thing i'm saying is that you don't need to check that in the actions:bored:
My condition checks if the random number between 1 and 100 is less than or equal to 10 as well, just i don't have to use a variable for it. This works, believe me, i've done it millions of times, and that is not the problem of my trigger.
The problem is the wait. But as i said earlier i might have found a solution to it. I'll check it tomorrow.

Else...Good Night. I need to work tomorrow.
 
Level 22
Joined
Jun 23, 2007
Messages
3,242
uhhhhh.
Mepehstrials system doesnt seem to work. i place abunch of skeleton warriors around and went about killing em, they just died. none of them revived. ill try out elites method and report back
i agree with terra, the problem is the wait. but i dont see a solution to it...
 
Level 7
Joined
Mar 16, 2008
Messages
348
Dude there's an easy solution
you dont mind jass right? turn that trigger into jass and post here, ill modify it.
 
uhhhhh.
Mepehstrials system doesnt seem to work. i place abunch of skeleton warriors around and went about killing em, they just died. none of them revived. ill try out elites method and report back
i agree with terra, the problem is the wait. but i dont see a solution to it...

The reason is because you pre-placed them on the map, they were not summoned, so the trigger doesn't detect.
 
Level 5
Joined
Aug 27, 2007
Messages
138
JASS:
scope reviveunit

private function c takes nothing returns boolean
    return GetUnitTypeId(GetDyingUnit()) == 'uske' //Replace 'uske' with the UnitTypeId of your unit (Ctrl + D in object editor)
endfunction

private function b takes nothing returns nothing
    local unit u = GetDyingUnit()
    local integer i2 = GetRandomInt(1, 10)
    if i2 == 1 then
        call TriggerSleepAction(5)  
        set bj_lastCreatedUnit = CreateUnit(GetOwningPlayer(u), GetUnitTypeId(u), GetUnitX(u), GetUnitY(u), GetUnitFacing(u))
        call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Undead\\AnimateDead\\AnimateDeadTarget.mdl", GetUnitX(u), GetUnitY(u)))
        call SetUnitAnimation(bj_lastCreatedUnit, "birth")
    endif
    set u = null
endfunction

function InitTrig_stuff takes nothing returns nothing
    local trigger t = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddCondition(t, Condition(function c))
    call TriggerAddAction( t, function b )
    set t = null
endfunction

endscope

Added some eyecandy and crap too. Feel free to remove it if you want.

Edit: I just reread your first post. Do you want it to have that chance only in its first death? If so, I'll have to revise some.
 
Status
Not open for further replies.
Top