• 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] Buying units for Comp

Status
Not open for further replies.
Level 3
Joined
Dec 15, 2007
Messages
44
Okay, so I'm working on this trigger and it seems completely right to me, but when I test it out, it doesn't work right at all.

My map is an AoS type map and there are outposts.
The outposts will be abled to hire groups of mercenaries to help push lanes.
I have it so that the computers control the outposts but have shop sharing on and sell certain units.
When you purchase a group it's supposed to put a group of units down and then they go along and push.
Here's my trigger:

  • Events
    • Unit - A unit Sells a unit
  • Conditions
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Unit-type of (Sold unit)) Equal to Overlord
      • Then - Actions
        • Unit - Change ownership of (Sold unit) to Player 1 (Red) and Change color
        • Unit - Create 2 Bloodfiend for Player 1 (Red) at (Position of (Sold unit)) facing Default building facing degrees
        • Unit - Create 2 Eredar Sorcerer for Player 1 (Red) at (Position of (Sold unit)) facing Default building facing degrees
        • Unit - Create 1 Fel Stalker for Player 1 (Red) at (Position of (Sold unit)) facing Default building facing degrees
      • Else - Actions
        • Do nothing
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Unit-type of (Sold unit)) Equal to Elder Voidwalker
      • Then - Actions
        • Unit - Change ownership of (Sold unit) to Player 1 (Red) and Change color
        • Unit - Create 2 Voidwalker for Player 1 (Red) at (Position of (Sold unit)) facing Default building facing degrees
        • Unit - Create 3 Lesser Voidwalker for Player 1 (Red) at (Position of (Sold unit)) facing Default building facing degrees
      • Else - Actions
        • Do nothing
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Unit-type of (Triggering unit)) Equal to Spider
      • Then - Actions
        • Unit - Change ownership of (Sold unit) to Player 1 (Red) and Change color
        • Unit - Create 2 Spitting Spider for Player 1 (Red) at (Position of (Sold unit)) facing Default building facing degrees
        • Unit - Create 2 Spider for Player 1 (Red) at (Position of (Sold unit)) facing Default building facing degrees
      • Else - Actions
        • Do nothing
It's really puzzling me. Basically when a player hires a unit, the way I have the trigger work is that it gives that unit to the computer player. Then under the conditions of unit hired, it creates the rest of the mercenary group. It seems like it should work but it doesn't. You can hire the unit, but it doesn't create any others and it doesn't give the unit to the computer it just stays as player controlled.

Someone help me please?
 
Level 3
Joined
Dec 15, 2007
Messages
44
Nevermind guys! I fixed it! Turns out the units I was conditioning weren't the same ones the building was selling. Strange, 'cause they had the exact same name, but I just re-entered them.
 
Level 3
Joined
Dec 15, 2007
Messages
44
Can I take them out and leave them blank?

I needed the If / Then / Else (Multiple Actions) to do all those.
 
Level 3
Joined
Dec 15, 2007
Messages
44
Okay, since Ghost wants me to post in same thread, here goes.

I need a trigger to respawn neutral creep camps. I copied two from a blank DotA template and they seemed legit. When I copied them in, it disables the second one saying there is an error on line 384: Expected a name.
Here's the two I have:

  • Store Creeps
    • Events
    • Conditions
    • Actions
      • Set LoopCreep = 0
      • Unit Group - Pick every unit in (Units owned by Neutral Hostile) and do (Actions)
        • Loop - Actions
          • Set Creep_Types[LoopCreep] = (Unit-type of (Picked unit))
          • Set Creep_Positions[LoopCreep] = (Position of (Picked unit))
          • Unit - Set the custom value of (Picked unit) to LoopCreep
          • Set LoopCreep = (LoopCreep + 1)
      • Custom script: call DestroyGroup(bj_lastCreatedGroup)
And...

JASS:
function Trig_Revive_Creeps_Actions takes nothing returns nothing
    local integer CUSTOM
    set CUSTOM = GetUnitUserData(GetDyingUnit())
    call TriggerSleepAction( udg_Hostile_Revive_Time )
    call CreateNUnitsAtLoc( 1, udg_Creep_Types[CUSTOM], Player(PLAYER_NEUTRAL_AGGRESSIVE), udg_Creep_Positions[CUSTOM], bj_UNIT_FACING )
    call SetUnitUserData( GetLastCreatedUnit(), CUSTOM )
endfunction

//===========================================================================
function InitTrig_Revive_Creeps takes nothing returns nothing
    set gg_trg_Revive_Creeps = CreateTrigger(  )
    call TriggerRegisterPlayerUnitEventSimple( gg_trg_Revive_Creeps, Player(PLAYER_NEUTRAL_AGGRESSIVE), EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddAction( gg_trg_Revive_Creeps, function Trig_Revive_Creeps_Actions )
endfunction

It gives me a problem with the line 384: call TriggerSleepAction( udg_Hostile_Revive_Time )
Stating:
"Error: Expected a name." I don't know what it means 'cause it works on the map I got it from. Does anyone have any ideas on how to fix this, OR a better way to respawn neutrals?
 
Level 3
Joined
Dec 15, 2007
Messages
44
I don't think so. How do I set them?

(Also I searched through the map I got it from's triggers and I didn't see any of those so I figured I didn't need them.)

Anyways, please tell me how to set them. Is it with a variable setup?
 
Status
Not open for further replies.
Top