HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

JASS - Not automatically starting

12-04-2007, 02:35 PM#1
Zandose
Hi, I can't get this trigger to start itself. I've been at this for two to three days (since the site went down), and am no closer to figuring it out so here I am. I believe that using a public function with the name InitTrig would make it work, but it doesn't.

Also, I hope not, but it this related to my earlier thread http://www.wc3campaigns.net/showthre...599#post978599?

Collapse JASS:
scope ItemPickup

globals
    integer array Item
    string array Model
endglobals

private function actions takes nothing returns nothing
    local integer i = 0
    set Item[1] = 'I00O' //Move to a seperate trigger on map initialization.
    set Model[1] = "war3mapImported\\NSRPG_sword_waterblade.mdl" //Move to a seperate trigger on map initialization.
    call BJDebugMsg(GetItemName(GetManipulatedItem()))
    set i = i + 1
    loop
        if GetItemTypeId(GetManipulatedItem()) == Item[i] then
            call AddSpecialEffectTarget(Model[i], GetTriggerUnit(), "hand left")
        endif
    endloop
endfunction

public function InitTrig takes nothing returns nothing
    local trigger trig = CreateTrigger()
    local integer i = 0 //Zero equals player 1 (red).
    loop //Checks for any unit picking up a item.
        call TriggerRegisterPlayerUnitEvent(trig, Player(i), ConvertPlayerUnitEvent(49), null)
        set i = i + 1
        exitwhen i == 12 //Max number of players
    endloop
    call TriggerAddAction(trig, function actions)
endfunction

endscope
12-04-2007, 02:40 PM#2
CommanderZ
You must have the trigger registered as trigger to make its init function start. You can do this by creating a trigger in WE, convert it to text and then you can put your code into its init function. Then it will start on init automatically. You cannot simply create a function and hope it will somehow trigger itself.
12-04-2007, 08:36 PM#3
HINDYhat
The scope's name must be the same as the trigger's name.
12-05-2007, 06:55 AM#4
Zandose
Sorry to say but, The Kingpin explained it best in my other thread.

http://www.wc3campaigns.net/showthre...t=97979&page=2