How to: Create a Creep Revival System

Tinki3

Special Member
Post your current code. It is most likely a typo.

Keep in mind that when referencing global variables in JASS, or with Custom Script,
you must use the correct syntax, with everything being case sensitive:

'udg_' is always put before any global variable in JASS/CS.
'_' is used instead of spaces in variable names.

So..

Creep X, would become: udg_Creep_X, in JASS/CS.
 
A

Awestruck

Guest
An alternative to saving the unit location as coordinates would be creating a region for each unit and refering to it with an arrey variable in much the same way. This should counter the problem that arises when changing map boundaries.

I suggest, for the second trigger, putting the actions in an if/then/else and adding a condition checking for nearby units. If the condition returns false the unit wont be respawned obviously, that's why you add a "run this trigger" in the else-actions. This way the unit will be respawned almost as soon as no one is nearby to be ambushed by creeps magically apearing out of nowhere.

Just a few optional additions :)
 

The Pigeon

Cool Member
That's an impressive looking trigger. Getting creeps to respawn where they first appeared has been a thorn in my side for years (that and I didn't know the purpose of the custom unit value thing). One question though, at the bottom it says "This tutorial also includes a demo map: ". Where's the demo map?

UPDATE: Wait, never mind, I see it. It just doesn't show on the tutorials site.
(http://world-editor-tutorials.thehelper.net/cat_usersubmit.php?view=55581)

UPDATE: Just thought I'd mention how much I like the fact that the trigger's so LITTLE. My work around would have been as large as a map's worth of triggers.
 

NetherHawk

New Member
amazing as always Tinki3, but i have a question. When u revive the units, u put in a wait function of 5 sec, if 2 units die 1 after another, will the wait functions overlapp and only repsawn the unit that died later?
 

Magentix

if (OP.statement == false) postCount++;
Add a point variable array named tempPoint

Code:
Revive Creeps 1 by 1
    Events
        Unit - A unit Dies
    Conditions
        ((Owner of (Triggering unit)) Equal to Neutral Hostile) and (((Triggering unit) is Summoned) Not equal to True)
    Actions
        Wait 5.00 game-time seconds
        Unit - Create 1 (Unit-type of (Triggering unit)) for Neutral Hostile at ((Center of (Entire map)) offset by (Creep_X[(Custom value of (Triggering unit))], Creep_Y[(Custom value of (Triggering unit))])) facing (Random angle) degrees
        Unit - Set the custom value of (Last created unit) to (Custom value of (Triggering unit))
Can then be made leakless like this:

Code:
Revive Creeps 1 by 1
    Events
        Unit - A unit Dies
    Conditions
        ((Owner of (Triggering unit)) Equal to Neutral Hostile) and (((Triggering unit) is Summoned) Not equal to True)
    Actions
        Wait 5.00 game-time seconds
        Set tempPoint[1] = (Center of (Entire map))
        Set tempPoint[2] = tempPoint[1] offset by (Creep_X[(Custom value of (Triggering unit))], Creep_Y[(Custom value of (Triggering unit))])
        Unit - Create 1 (Unit-type of (Triggering unit)) for Neutral Hostile at tempPoint[2] facing (Random angle) degrees
        Unit - Set the custom value of (Last created unit) to (Custom value of (Triggering unit))
        Custom Script: call RemoveLocation(udg_tempPoint[1])
        Custom Script: call RemoveLocation(udg_tempPoint[2])
Assuming Center of Entire map doesn't leak and you'd want the trigger leakless
 

chewett

New Member
An alternative to saving the unit location as coordinates would be creating a region for each unit and refering to it with an arrey variable in much the same way. This should counter the problem that arises when changing map boundaries.

I suggest, for the second trigger, putting the actions in an if/then/else and adding a condition checking for nearby units. If the condition returns false the unit wont be respawned obviously, that's why you add a "run this trigger" in the else-actions. This way the unit will be respawned almost as soon as no one is nearby to be ambushed by creeps magically apearing out of nowhere.

Just a few optional additions :)
but this is exatly what i dont want to do as i dont want 100+ regions just for units

therefore i use point 0 0
 

Tinki3

Special Member
> if 2 units die 1 after another, will the wait functions overlapp and only repsawn the unit that died later?

No, as "Triggering unit" is used as reference to the dying unit, thus it is "MUI".
Triggering unit is not overwritten either.

In saying this, you can increase the wait interval to a large(r) number and the dying unit will still "revive".
 
X

ximbabwe0228

Guest
There is a much simpler way to do this for people who suk at variables (moi). Simply create a region where the creeps start. Text in braces {} represents individually-defined values. Text in brackets [] represents the trigger. Text in parentheses () represents underlined blue or red text in the editor.
*events*
-Unit - player owned unit event.
[a unit owned by (neutral hostile) (dies).]
*conditions*
-boolean -
[(event response - dying unit) is (a summoned unit) (equal to) (false).]
*actions*
-Unit - create
[Create (1) (event response - unit type of dying unit) at ({your region}) facing ({whatever}) angle.

I am not trying to degrade you in any way, Tinki3, and I appreciate your contribution.

also if u wanted only 1 res: either a) give it an ankh or b) as 1 last action do
-trigger - turn off
[Turn off (this trigger)].

Also +rep tinki3.
 

chango

New Member
Problem with the wait...

Hello,

Thanks for the tutorial i learn a lot of it, but it wont work fine for me :confused:. I have a problem with the wait action, if i put 4 sec or less works fine but if i use 5 sec or more the creep does not respawn.

Yes i have only one creep in my map :D

Here is the code of my trigger:

Code:
ReviveCreep
    Events
        Unit - A unit owned by Neutral Hostile Dies
    Conditions
        ((Triggering unit) is Summoned) Equal to False
    Actions
        Wait 4.00 game-time seconds
        Set tempPoint[1] = (Center of (Entire map))
        Set tempPoint[2] = (tempPoint[1] offset by (Creep_X[(Custom value of (Triggering unit))], Creep_Y[(Custom value of (Triggering unit))]))
        Unit - Create 1 (Unit-type of (Triggering unit)) for Neutral Hostile at tempPoint[2] facing (Random angle) degrees
        Unit - Set the custom value of (Last created unit) to (Custom value of (Triggering unit))
        Custom script:   call RemoveLocation(udg_tempPoint[1])
        Custom script:   call RemoveLocation(udg_tempPoint[2])
Also i have a item in the creep and i don't know how to make it to drop every time.

Any ideas ??

Thanks :D
 

Attachments

B

bakerpresent

Guest
this was really helpful.. im totally new to the WE and this helped me get to know it a little
i loaded the lost temple map for TFT and used this tutorial to make the creeps respawn. It took me a little while cause i had to search through all the triggers-events-conditions-actions menus.

was cool though thx

- bakerpresents
 
D

Dromm

Guest
expected a name?

Whenever I use this trigger and try to test/save my map it comes up with errors for the two customscript codes and says "Error: Expected a name"

can I get some help please?
 

Ynklig

New Member
If I got an items on the creep that dies, will the one that respawn have the same items? Or should it be more triggers for that?

Great tut anyway! :)
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Varine Varine:
    They aren't cutting my responsibilities or interjecting in my management abilities or anything, it's just stupid shit that comes up. And they don't exactly have people lining up for my job, there's not that many people applying for the positions I hire
  • Varine Varine:
    Eh, whatever. Thanks for listening guys
  • jonas jonas:
    Sure :) Let us know how it ends
  • Varine Varine:
    All of these things will end happily, they're just stressful. And I still lack many good friends that I can go to, and the ones I can are preoccupied with similar things. Thus general chit chat, cuz for some reason TH and Ghan and Tom all actively keep it up.
  • Varine Varine:
    Just gotta keep Miss Mazie up through the week until her shock wears off and she realizes that she still has family all around her, and bossman will do whatever he's going to do and I'll respond appropriately when it happens. Thank you all for the support, I do very much appreciate everyone being here for me through the years
    +3
  • vypur85 vypur85:
    Best of luck Varine!
  • vypur85 vypur85:
    I just gotten myself an offer to work in China. The pay quadruples my current one. Damn.... Not really ready to start a new life there in China.
  • The Helper The Helper:
    I have heard that they pay pretty good to English teachers in China - you would be an expat
  • jonas jonas:
    Cool, what kind of job?
  • Accname Accname:
    I would be careful with jobs in China. They can be hit and miss depending on where in China you go. Places like hong kong / Shengzen / Beijing can be neat. Other places not so much.
  • Accname Accname:
    I would recommend searching for some first person experiences for the city you got the offer in. Especially now when the political situation in China is deteriorating.
  • jonas jonas:
    Accname, long time no see
  • jonas jonas:
    What have you been up to
  • tom_mai78101 tom_mai78101:
    Hey Accname, welcome back.
  • Accname Accname:
    Not much. Working in the Renewable Energy Sector as an IT Consultant. Its okay, but I think I preferred working at the university. It was more relaxed and you met all kinds of crazy people there.
  • vypur85 vypur85:
    I gotten a teaching position for Biology in a college in Wuhan (yes, there)... I suppose it should be fine there (I hope). Many of my ex colleagues are teaching in China as well currently (none in Wuhan though)
  • vypur85 vypur85:
    And I signed the contract already. I guess there's no turning back....
  • jonas jonas:
    @Accname how many hours do you work? I heard in some sectors IT consultants rack up insane hours
  • jonas jonas:
    @vypur85 sounds nice, have fun : )
  • Accname Accname:
    I am supposed to work 40 hrs a week, but I can work more if I like and I will be paid for those hours (as long as I don't go too far, there are laws and company policies, etc)
  • Accname Accname:
    In practice its basically work as much as you like, as long as the job gets done in time.
  • jonas jonas:
    Haha, my job is like that as well... that usually means I have a few 70-80 hours weeks a year, and lots of 20 hours weeks...
  • jonas jonas:
    a few weeks ago, one of my friends basically said "jonas, I received an invitation to submit something to conference X but I'm too lazy to do it and also the conference isn't advanced enough for my high level of research*, why don't you write something? Oh by the way, the deadline is in two weeks. Enjoy!" so I got two 80 hour weeks out of that kind offer. (*of course he didn't say those parts, but it's a better story this way)
  • jonas jonas:
    now I'll have next week off to make up for overtime :p and I'll play some good old gothic 2
  • The Helper The Helper:
    Hope you are enjoying that gothic 2~

    Members online

    No members online now.

    Affiliates

    Hive Workshop NUON Dome
    Top