• 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.

[Trigger] Creating a Unit with an item

Status
Not open for further replies.
Level 2
Joined
Jul 22, 2007
Messages
8
Hello.

I've been trying to find a way to find a way to spawn a hero with an item already equipped, without any luck.

  • Spawn Red
    • Events
      • Map initialization
    • Conditions
      • (Player 1 (Red) slot status) Equal to Is playing
    • Actions
      • Player Group - Make Team1[(Integer A)] treat Team1[(Integer A)] as an Ally with shared vision
      • For each (Integer A) from 1 to 1, do (Actions)
        • Loop - Actions
          • Unit - Create 1 Plasma Shooter for (Player((Integer A))) at (Random point in Team 1 Spawn <gen>) facing 180.00 degrees
          • Set PlayerUnits[(Player number of (Player((Integer A))))] = (Last created unit)
That's what I have for a creation trigger, anyway to fit that in there?


I also have a problem with giving items abilities, like bear form and beserk, then setting the stats to "Automatically use when acquired". You can hear the unit pick it up, but they drop it immediately with no effect, impossible to pick it up.
 
Last edited:
Level 19
Joined
Jun 16, 2007
Messages
1,574
Try this.. it might work.

  • Spawn Red
    • Events
      • Map initialization
    • Conditions
      • (Player 1 (Red) slot status) Equal to Is playing
    • Actions
      • Player Group - Make Team1[(Integer A)] treat Team1[(Integer A)] as an Ally with shared vision
      • For each (Integer A) from 1 to 1, do (Actions)
        • Loop - Actions
          • Unit - Create 1 Plasma Shooter for (Player((Integer A))) at (Random point in Team 1 Spawn <gen>) facing 180.00 degrees
          • Set PlayerUnits[(Player number of (Player((Integer A))))] = (Last created unit)
    • Wait 2.00 seconds
      • Hero - Create Item and give it to (Random unit from (Units in (Playable map area) owned by Player 1 (Red)))
 
Level 2
Joined
Jul 22, 2007
Messages
8
Thank you, that works perfectly.

I have another question about my camera though. I have it set to follow the unit in a closeup 3rd person, but I also want it to stay behind the unit when it turns so you always see where that unit is facing, I thought I had it, but this doesn't seem to work.

  • Camera
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Unit - Create 1 Unarmed Human for Player 1 (Red) at (Center of Team 1 Spawn <gen>) facing 90.00 degrees
      • Set Player[(Integer A)] = (Last created unit)
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • Camera - Lock camera target for (Player((Integer A))) to (Last created unit), offset by (0.00, 0.00) using Default rotation
          • Camera - Set (Player((Integer A)))'s camera Distance to target to 800.00 over 0.00 seconds
          • Camera - Set (Player((Integer A)))'s camera Height Offset to 90.00 over 0.00 seconds
 
Last edited:
Level 8
Joined
Jul 23, 2005
Messages
329
You will need to add in another trigger to do that periodically. It'd look something like:

  • Periodic Thingy
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • Camera - Set (Player((Integer A)))'s camera Rotation to (Facing of ( Player[(Integer A)])) over 0.00 seconds
 
Level 19
Joined
Nov 16, 2006
Messages
2,165
robot-dude wait functions aren't always good, some data gets lost after it.

bobsod, thats an odd trigger. Are you using it for one or more players (spawn red)?

I also created a camera system for my map, you can pick 3th person view or not, I can post it if you want but it is using much locals and custom scripts.
 
Level 2
Joined
Jul 22, 2007
Messages
8
I Coulden't seem to get that camera trigger to work. It just rotated my camera sideways , so instead of my camera box being like..
_____
| |
------

its

---
| |
| |
---
so up is left and down is right and left is down and right is up or w/e....which makes no sense to me at all...




Well I needed it to spawn for 10 people, but it would always give them the unit even if they weren't in the game.

So I decided to just give everyone separate spawn triggers, that depended on them being in the game, I probably should move the player group to a different trigger though.
 
Last edited:
Status
Not open for further replies.
Top