• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Revive-Help

Status
Not open for further replies.
Level 3
Joined
Jan 3, 2012
Messages
39
Hello Community, here I am again (asking me, if I start to get annoying... ;))

So, I', still working on my map and I reached the point, where I need to make the revive System.

But I find myself stucking at this position...
Here is what I want to do:

A Hero dies -> The Player goes to a "ReviveStone" (Based on the tavern) -> The Player revives the Unit via the "ReviveStone" -> Insted of being revived at the position of the "ReviveStone" the unit will be teleportet to a Spawnpoint, that was already set.

Sounds simple and I#m pretty sure that it is simple but I can't find a way. Can you please help me?

(I still don't use Jass, only the normal trigger editior)
 
Level 3
Joined
Jan 3, 2012
Messages
39
Ok, I see I explained it unclear... so let me correct myself:

"A Hero dies -> The Player goes to a "ReviveStone" "
It's an RPG Map and the Player's only have the Hero as Unit. With on little exception:
There is a "ReviveStone" (neutral passiv) based on the tavern (which also is neutral passiv) and around this "Stone" are ... well... they are basicly only units without any real sence, exept than revive Hero's in the tavern. So I think, you can call them dummys. (And only these dummys are the exception, not the ReviveStone, it is neutral)

And with "The Player GOES to an "ReviveStone"" I only meant, that the player who lost his hero will pan his camera to the "ReviveStone" and... basicly click on it and revive his Hero. But this is the point: The ReviveStone is apart from the basic map so that there is no way for the revived unit to get back into it. And that's what I want to fix with an ... well.. I think I could call it an teleporttrigger or something like that. Or with a trigger that will revive the hero directly on the point set in map, without leting him spawn beside the "ReviveStone" and than teleporting him to the point...

Hope it is a bit clearer now. Otherwise I will upload an Screenshot.
 
Level 17
Joined
Jul 17, 2011
Messages
1,864
ok i think i see what u mean
you want the hero to revive at the location where he died so i dont think you need a revive stone if you want the hero to be revived at the location where he died
there is a simple trigger you could use hopefully you are familiar with variables
1. Just make 2 real array variable titled x and y
then make a unit variable

2. whenever a hero dies set x[Player number of owner of dying unit] = x position of dying unit and then do the same thing for y except y would equal y position of dying unit and set your unit variable to the dying unit
after you have set these two variables make a one shot timer that will expire in lets say 20 seconds

3. Finally make a trigger which will detect when this timer expires and will revive the dying unit at your x and y variables OR instead of a timer you could simply use a wait function
i hope this is what u meant
 
Level 3
Joined
Jan 3, 2012
Messages
39
Well... no... sorry, that isn't what I meant too... I made a little collagé to show it ingame.
 

Attachments

  • Revive.jpg
    Revive.jpg
    1.6 MB · Views: 63
Level 2
Joined
Dec 18, 2011
Messages
17
If I'm understanding everything, then your looking for something like this...?

  • Events
    • Unit - A unit Finishes reviving
  • Conditions
  • Actions
    • For each (Integer A) from 1 to 12, do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Owner of (Triggering unit)) Equal to (Player((Integer A)))
          • Then - Actions
            • Unit - Move (Triggering unit) instantly to (Center of START_POS[(Integer A)])
            • Camera - Pan camera for (Player((Integer A))) to (Center of START_POS[(Integer A)]) over 0.00 seconds
          • Else - Actions
 
Level 13
Joined
May 11, 2008
Messages
1,198
the 'center of' is a location which could leak. you can either use custom text to remove the leak, or use custom text to move the unit in a leakless way. leakless way would be to define the point using coordinates. so, 2 real variables, according to the terran editor. you would need a custom text function call for moving the unit...i think you would use SetUnitX and one more call which is SetUnitY. i don't use the remove leak method, but others do and could show you it, i suppose.
 
Level 2
Joined
Dec 18, 2011
Messages
17
Unless I'm missing something, you can actually create a variable which has an X co-ordinates and a Y co-ordinates.... it's a variable type called 'point'... you can use it like this;
  • Events
    • Unit - A unit Finishes reviving
  • Conditions
  • Actions
    • For each (Integer A) from 1 to 12, do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Owner of (Triggering unit)) Equal to (Player((Integer A)))
          • Then - Actions
            • Unit - Move (Triggering unit) instantly to START_POS[(Integer A)]
            • Camera - Pan camera for (Player((Integer A))) to START_POS[(Integer A)] over 0.00 seconds
          • Else - Actions
I'm sorry, I didn't know there was any problem with the 'Move unit to centre of (Region)' command... I actually using it in several of the maps I'm working on... could you explain this 'leak'...? It seems as if I'll end up with game lag if you don't tell me...:\
 
Level 13
Joined
May 11, 2008
Messages
1,198
Unless I'm missing something, you can actually create a variable which has an X co-ordinates and a Y co-ordinates.... it's a variable type called 'point'... you can use it like this;
............
I'm sorry, I didn't know there was any problem with the 'Move unit to centre of (Region)' command... I actually using it in several of the maps I'm working on... could you explain this 'leak'...? It seems as if I'll end up with game lag if you don't tell me...:\

yes, that might work...but i don't think so...

at any rate, what COULD happen, is that if you have enough memory leaks in the map built up, the game will crash on you.

i guess i used to try doing what you suggested above...
but i think you still have to use the remove location function.

anyway, if you use real x and real y variables, you can use those freely without worrying about how to clean the leaks. otherwise, i just hope you know what you're doing to clean the leaks. since i'm not a leak cleaner guy, it's too much trouble to remember to clean them, you know? it's hard enough getting the if then loop stuff down right, heh heh......

here's an example of a function that leaves no room for leaking:
CreateUnit(Player(0), 'efdr', 4836.9, - 6058.9, 202.890)
the 4836.9 and -6058.9 are the x and y variables. but in this case, i did not even use variables, but i did input the numbers manually.
what i did, to make sure i had the EXACT numbers, was run code to display what the numbers were, in the game.

you could do something like BJDebugMsg(R2S(GetLocationX(center of region))+","+R2S(GetLocationY(center of region)))
the debug msg thing just shows a message for 60 seconds, r2s is the real to string function, and you can probably figure out the rest.
display messages in testing can be pretty useful. i'm not sure what the 'center of region' looks like in custom text, but to find out, you can copy the trigger and convert the copy to custom text to view that.

here's a function i used to move units:
call SetUnitPosition(GetEnumUnit(), (GetRandomReal(-480.00, 0.00)), (GetRandomReal(9191.00, 10101.00)))
but, i'm not sure if it's leakless or whatever, since i used it at the end of the game.
i could've also done this:
JASS:
call SetUnitX(GetEnumUnit(), GetRandomReal(-480.0, 0.0))
call SetUnitY(GetEnumUnit(), GetRandomReal(9191.0, 10101.0)
those two functions are all you need. of course, as you could see, my above functions were something like, random point in region, rather than center of region.
obviously, you don't need a random real if you're just wanting the center.

JASS:
call SetUnitX(GetEnumUnit(), -240.0)
call SetUnitY(GetEnumUnit(), 9646.0)
that would be making it the center of a region.

also, you can ignore using regions almost entirely if you manually set the 4 reals...the bottom left 2 reals, and the top right 2 reals are all you need.
 
Last edited:
Level 2
Joined
Dec 18, 2011
Messages
17
Yeah, okay, now I see what your getting at... considering though that I know some programming languages, I don't actually know JASS, which means I can basically tell what it's doing by reading through it, but I wouldn't be able to write it for the life of me...

So I think I'll stick to my current functions, considering they work, and.... if my game crashes, then I'll go running to someone to fix my map up... but I have yet to encounter that problem...>.>
(Oh yeah, and subjectshadow quite plainly said that he didn't want custom script, so, leak or not, that was what he was looking for...)
 
Level 13
Joined
May 11, 2008
Messages
1,198
well, with JNGP, the functions you type have an autocomplete feature, complete with a display of what a lot of the functions do. also, you can use copy+paste with jass code(which can be used in gui as custom text), something you can't do in gui. although you CAN convert the gui to custom text and then copy+paste that. but that's not generally what people do, since that makes it so you can't use gui for that trigger. that's why i make copies of triggers when i want to compare gui with the custom text of the gui.
 
Status
Not open for further replies.
Top