spawn hero once when a building is built

Druzzl

You can change this now in User CP.
Reaction score
1
how do i get say a loki to spawn once when i build a fusion core, but only on the first fusion core i build?
 

Phubar

Ultra Cool Member
Reaction score
30
Hi, you have to make it via trigger.

Code:
EVENTS
Fusion core is built
CONDITIONS
ACTIONS
Create a Loki
Disable this trigger

This trigger runs only the first time you create a core becouse the "Disable trigger" prevents it to run unless it is re-abled again. In your case you dont have any other trigger that make this able again so it will run only once.
 

Druzzl

You can change this now in User CP.
Reaction score
1
ok, so how do i set the event to target the fusion core, that's the part i'm now stumped on
 

X-maul

AKA: Demtrod
Reaction score
201
Code:
Untitled Trigger 001
    Events
        Unit - Any Unit training progress is Completed
    Local Variables
    Conditions
        (Unit type of (Triggering progress unit)) == Fusion Core
    Actions
        Unit - Create 1 Loki for player 1 at (Position of (Triggering progress unit)) using default facing (No Options)
        Trigger - Turn (Current trigger) Off
This would be your trigger
 

Druzzl

You can change this now in User CP.
Reaction score
1
THANK YOU!!! i can finally start creating my map for my buddy and myself!!
 

X-maul

AKA: Demtrod
Reaction score
201
You're welcome, but please try to understand how this works, so you can do it yourself at another time ;)
 

Druzzl

You can change this now in User CP.
Reaction score
1
lol, actually when i went in to set it up how you said, i figured out alot, i just couldn't figure out how to target a building that hadn't been built yet :)
 

Druzzl

You can change this now in User CP.
Reaction score
1
ok, here's what i changed it to (Captain Bladehero is the Loki)

Spawn Captain Bladehero
Events
Unit - Any Unit construction progress is Completed
Local Variables
Conditions
Or
Conditions
(Owner of (Triggering progress unit)) == 1
(Owner of (Triggering progress unit)) == 2
And
Conditions
(Unit type of (Triggering progress unit)) == Fusion Core
Actions
Unit - Create 1 Captain Bladerunner for player 2 at Hero Rally using default facing (No Options)
Trigger - Turn (Current trigger) Off


when testing it returns a negative 1 when it try's to spawn the unit
 

Druzzl

You can change this now in User CP.
Reaction score
1
could it be because i have them classified as a hero and i'm trying to create them as a unit?
 

Phubar

Ultra Cool Member
Reaction score
30
Cant use edior now. try changing from Cpt Bladerunner to marine and see what happens. If still give error try delete the OR an set only 2 conditions ( owner is player 1 and type is fusion core, just to try to find out wats wrong.
 

Dave312

Censored for your safe viewing
Reaction score
269
Once the trigger runs, it will turn itself off. This means if player 1 builds a fusion core and player 2 has already built a fusion core, the trigger has been turned off so it won't run when player 1 builds the fusion core, thus player 1 won't get the hero. I recommend you create two separate triggers, one for player 1 and another for player 2 which will solve this issue.
 

Druzzl

You can change this now in User CP.
Reaction score
1
so, the way it's set up, is i have 6 of them, 2 for protoss, 2 for terran, and 2 for zerg, and since my friend and i never play the two same races, i was trying to set it up for us to get the heroes but not the computers. but now the computer gets the hero, and only the terran hero's will spawn (all 6 triggers are set up the same way, just different names for the units and different spawning buildings)
 

Druzzl

You can change this now in User CP.
Reaction score
1
alright so, Augria is a specilized dark templar, and i can get this script to run, but he doesn't ever spawn... i get the message saying Hero Creating, but from my other debug trigger i don't get the message saying hero created...

Code:
Spawn Auriga
    Events
        Unit - Any Unit construction progress is Completed
    Local Variables
    Conditions
        And
            Conditions
                Or
                    Conditions
                        (Owner of (Triggering progress unit)) == 1
                        (Owner of (Triggering progress unit)) == 2
                (Unit type of (Triggering progress unit)) == Gateway
    Actions
        UI - Display "Hero Creating" for (All players) to Subtitle area
        Unit - Create 1 Auriga for player (Triggering player) at (Position of (Created unit)) using default facing (No Options)
        Unit - Enable Any experience gain for (Last created unit)
        Unit - Order (Last created unit) to ( Move targeting Hero Rally) (Replace Existing Orders)
        Trigger - Turn (Current trigger) Off

Debug trigger is as such

Code:
Debug
    Events
        Unit - Any Unit Enters (Entire map)
    Local Variables
    Conditions
        Or
            Conditions
                (Unit type of (Triggering unit)) == Lieutenant Bladehero
                (Unit type of (Triggering unit)) == Captain Bladerunner
                (Unit type of (Triggering unit)) == Auriga
                (Unit type of (Triggering unit)) == Shelak (Carrier Hero)
                (Unit type of (Triggering unit)) == Brute A Lisk
                (Unit type of (Triggering unit)) == Levi A Than
    Actions
        UI - Display "Hero Created" for (All players) to Subtitle area

here are the error's i get when it try's to create Auriga

'gt_SpawnAuriga_Func': Event response function 'EventUnitCreatedUnit' has no matching event? Near line 143 in gt_SpawnAuriga_Func[] in MapScript.galaxy

'gt_SpawnAuriga_Func': Parameter out of bounds in 'sUnitCreate' (value:-1, min 0, max 15)? Near line 4613 in libNtve_gf_CreateUnitsWithDefaultFacing[] in TriggerLibs/NativeLib.galaxy
 

Phubar

Ultra Cool Member
Reaction score
30
You have to change
Code:
Unit - Create 1 Auriga for player (Triggering player) at (Position of (Created unit)) using default facing (No Options)
to
Code:
Unit - Create 1 Auriga for player (Triggering player) at (Position of (Triggering progress unit)) using default facing (No Options)

The "Created unit" refers only to units created by trigger with "Create unit" action :)
 

Phubar

Ultra Cool Member
Reaction score
30
Found another issue :)
Change "triggering player" with "Owner of (triggering progress unit)"
 

Druzzl

You can change this now in User CP.
Reaction score
1
I'll have to try that when I get home and see if that changes anything
 

Phubar

Ultra Cool Member
Reaction score
30
It would change becouse "triggering player" doesnt mean anything in that trigger (the event involves a unit that is built not a player), so you have to refer to the player that "owns" that unit :)
 
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