Revive unit?

antre

New Member
Reaction score
0
i created a peon, and gave him inventory slots and everything. i need to know how to revive the peon at a certain region or spawn, and how to make him keep his items. please help.
 

Moridin

Snow Leopard
Reaction score
144
Ok. There isn't any easy way to revive a unit (at least I don't think so), so we'll do it in a slightly longer way.

First, you need a region/location to revive. This can be either next to a building, or a pre-placed region, etc.

Then you can make these triggers.

Variable Declaration:
Items[] -> Item Variable array with a size of 7
Respawn_Point -> Point Variable

Trigger:
  • Respawn
    • Events
      • Unit - A unit dies
    • Condition
      • (Triggering unit) Equal to <Your peon> -> This is unit comparison, not unit type
    • Actions
      • Set Respawn_Point = Center of (Region)
      • For (Integer A) from 1 to 6 do (multiple actions)
        • loop - Actions
          • Set Item[(Integer A)] = Item for (Triggering unit) in slot (Integer A)
      • Unit - Create 1 Peon for (Triggering Player) at Respawn_Point facing default facing west
      • For (Integer A) from 1 to 6 do (multiple actions)
        • loop - Actions
          • Item - Create Item[(Integer A)] at Respawn_Point
          • Hero - Give (last created item) to (last created unit)


Note - Freehand.
 

antre

New Member
Reaction score
0
Ok. There isn't any easy way to revive a unit (at least I don't think so), so we'll do it in a slightly longer way.

First, you need a region/location to revive. This can be either next to a building, or a pre-placed region, etc.

Then you can make these triggers.

Variable Declaration:
Items[] -> Item Variable array with a size of 7
Respawn_Point -> Point Variable

Trigger:
  • Respawn
    • Events
      • Unit - A unit dies
    • Condition
      • (Triggering unit) Equal to <Your peon> -> This is unit comparison, not unit type
    • Actions
      • Set Respawn_Point = Center of (Region)
      • For (Integer A) from 1 to 6 do (multiple actions)
        • loop - Actions
          • Set Item[(Integer A)] = Item for (Triggering unit) in slot (Integer A)
      • Unit - Create 1 Peon for (Triggering Player) at Respawn_Point facing default facing west
      • For (Integer A) from 1 to 6 do (multiple actions)
        • loop - Actions
          • Item - Create Item[(Integer A)] at Respawn_Point
          • Hero - Give (last created item) to (last created unit)


Note - Freehand.


i kinda lost you at the interger part. Im new to map making :O and im actually kinda lost in total. i did everything u said here, altho im not sure about the respawn_point, so i just made a variable named that and set it to the region. please help me by dumbing it down a bit
 

Moridin

Snow Leopard
Reaction score
144
Hahah alright :). Let me try and explain that in a little detail.
I'm going to explain what to do first (to get it to work) and after that I'll explain how the trigger works.
Note: Anything after a -> is what you should be seeing in your window.

What to do, what to do:

In steps:

-----------------------------------------------------------------
Event
1) Create a new trigger.
2) Create a "New Event" for that trigger
3) Select "Unit - Generic unit event"
4) You should, by default, have "A unit dies", with the "dies in blue and underlined.
5) If you DONT you click on the "Dies" and from the drop down menu, select "dies".
6) Keep clicking OK till you're back to the main trigger.

-----------------------------------------------------------------
Condition
7) Create a new condition
8) Select "Unit Comparison" from the drop down menu.
You should have this:
-> (Triggering unit) Equal to Value

9) Click on Value
10) Click the button that says "Select a Unit"
11) Select your peon from the map. If you already have the peon stored in a unit variable, you can use the unit variable instead of selecting the unit.
12) Click Ok till you get to the main trigger.

-----------------------------------------------------------------
Actions
13) Create a new Action
14) Tap the "S" key on your keyboard. You should automatically get "Set Variable" as your option.
-> Set Variable = Value
15) Click the red "Variable". This opens up a list of your variables.
16) Select Edit Variables. This opens up the variable editor.
17) Create a new variable. (Ctrl + N)
18) For the variable name, type in Respawn_Point. They will not allow spaces, so use underscores.
19) For the variable type, open the drop-down menu and select "Point".
20) You can ignore the Array checkbox for now. Click OK. You now have a point variable!
21) Click ok until you get back to here (Select the newly created point variable)
-> Set Respawn_Point = Value
22) Click the red "Value"
23) Open the function drop-down menu and select "Center of Region"
24) Select the appropriate pre-made region. You can make regions in the map by going to the main map screen and using the Region pallette.
25) Click OK until you're back in the main trigger.
-------------------------
26) Create a new action
27) Tap the Key "F" on your keyboard. You should automatically get the option "For Each Integer A do multiple actions"
-> For each Integer A from 1 to 10 do (multiple actions)
28) Click the blue "10".
29) Type in 6.
30) Click ok until you're back in the main trigger.
-------------------------
31) Now click the Loop-Actions first and then create a new action. This action must be in the loop.
32) Tap "S" again, to get Set Variable.
33) Create a new variable again. This time the name should be "Items". The Type should be "Item". You should tick the Array check box. Make it size 7.
34) Click ok till you get to this:
-> Set Item[Index] = Value
35) Click the Index
36) From the drop down menu select "Integer A"
37) Click OK till you get back to this:
-> Set Item[(Integer A)] = Value
38) Click Value
39) Open the drop down menu and select "Item carried by Hero"
40) Click the red "Hero"
41) Open the drop down menu, select "Event Response - Triggering unit"
42) Click ok.
43) Select the blue "1" (I'm talking about the ..."in slot 1" )
44) Click the dot on the left side of the function drop-down menu.
45) Open the drop-down menu and select "Integer A".
46) Keep clicking OK till you get to the main trigger.
-------------------------
47) Click on the "For (Integer A)..." action you created earlier.
48) Create a new action (this action must be outside the for loop)
49) Tap "U" on your keyboard or scroll down, until you get to "Unit - Create units facing angle"
50) I'm not going to describe how to do this (because it'll stretch this to another page :p). If you don't know how to do this, ask and I'll answer :).
51) Click Ok till you're back in the main trigger.
-------------------------
52) Create a new action.
53) Repeat Steps 27 to 30 to create the for loop again.
54) Repeat step 31.
-------------------------
55) Create a new action.
56) Scroll down to "Item - Create Item"
-> Item - Create Tome of Experience at (Center of (Playable Map Area))
57) Click tome of experience.
58) Select your Items variable from the list.
59) Repeat steps 35 and 36.
60) Click "Center of (Playable Map Area)"
61) Select your Respawn_Point variable from the list.
62) Click OK, ok.
-------------------------
63) Create a new action, also inside the loop.
64) Tap "H" or scroll down to "Hero - Give item to Hero"
-> Give (last created item) to (triggering unit)
65) Click (Triggering unit)
66) From the drop-down menu, select "Last created unit"
67) Click Ok, ok.
-------------------------
You're done! :D
Also, I've realised that this is mega huge, so I'll be skipping the explanation. IF there's anything you don't understand, tell us, and we'll elaborate on that :).

Hope that helped.

Edit: Wow that is long :O.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top