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

Importing Trigger function (COMPLETLY STUCK)

Status
Not open for further replies.
Level 8
Joined
Aug 8, 2008
Messages
340
The Neutral Hostile creeps of my map has been placed right from the start and should respawn 60-120 seconds after they have been killed in the exact same position they where placed (not where they where killed). Which is why I am transfering the Creep Respawn system from DotA Tamplate (Map attached)
I've tried to import the trigger: "Store Creeps", The Variables: "LoopCreep", "Creep_Types", "Creep_Position" and The trigger: "Revive Creeps":

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

But when I try to save it gives me this:
Script Errors
4 compile errors
Line 318: Expected a name
Line 324: Expected a variable name
Line 325: Expected a name
Line 326: Expected a name

I am clueless what to do about this!
 

Attachments

  • Dota Template 1.0.w3x
    364.5 KB · Views: 50
Level 28
Joined
Jan 26, 2007
Messages
4,789
First off: use JASS-tags for posting JASS triggers.
[code=jass] (paste script here) [/code]​
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

For GUI-triggers, it is:
[trigger] (paste script here) [/trigger]​
In-depth tutorial for this.

Second: the errors you've posted are pretty useless for us, because we do not know which line is which (like "line 318", what's that?).

Here's how you should import triggers:
First off, go to File -> Preferences and make sure that "Automatically create unknown variables while pasting trigger data" is checked.
Then, you should copy the entire category "Hostile Creeps".

In the JASS-trigger, you can see udg_Hostile_Revive_Time.
Everything with "udg_" in front of it, is a variable. Variables in JASS-script are not automatically created when pasting triggers.
So create a real variable called "Hostile_Revive_Time" and set it to 120 seconds at the start of the game (see the trigger "Map Initialization", that's where they set that variable).

If all of that is done, it should work.
 
Level 8
Joined
Aug 8, 2008
Messages
340
Yeah sorry about the poor information, I've never really used that script text. So I did what you told me to and It worked! But I don't understand how to set the respawn timer. Could you tell me which part to of the trigger to adjust in order to do that?
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
That's okay, you're here to learn (probably) :).
Those triggers are for respawning creeps, not heroes. Do you want a respawn timer to show up for whenever a hero dies, then?
Or if you want to change how long it takes for creeps to respawn, simply change "Hostile_Revive_Time" (it's the amount of seconds before a creep respawns).
 
Level 8
Joined
Aug 8, 2008
Messages
340
Well it's the hostile creeps I mean, but I'm not seeing any part refering to time. I am well ware it has something to do with "Hostile_Revive_Time", just don't know what to change.
 
Last edited:
Level 28
Joined
Jan 26, 2007
Messages
4,789
Ah, of course.
In the map "Dota Template", there are 3 triggers that relate to the creep respawn: the 2 triggers in the category "Hostile Creeps", and the trigger "Map Initialization".
That trigger ("Map Initialization") is where you can change the respawn time. Change the variable "Hostile_Revive_Time" and it is done.
 
Level 8
Joined
Aug 8, 2008
Messages
340
YES! IT WORKS! IT FUCKING WORKS! :D Thank you so much!
I am a little busy for the night, but I was wondering if I could send you a PM later about another importing problem I've been having (with the same map). Would that be okay?
 
Status
Not open for further replies.
Top