wc3edit.net

United Warcraft 3 map hacking!
It is currently April 26th, 2024, 9:58 am

All times are UTC




Post new topic Reply to topic  [ 13 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: November 5th, 2007, 6:08 am 
Offline
Member

Joined: April 26th, 2007, 7:53 pm
Posts: 58
OK, so let's say I create a new trigger, and convert it to custom text. How can I add this trigger to an existing .j? I tried adding the trigger to a random spot in the .j, the map ran fine when I loaded it, but the trigger wouldn't work. Any help would be great, thanks.

Code:
function Trig_Untitled_Trigger_001_Conditions takes nothing returns boolean
    if ( not ( GetItemOfTypeFromUnitBJ(GetTriggerUnit(), 'I00E') == GetManipulatedItem() ) ) then
        return false
    endif
    return true
endfunction

function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing
    call SetItemDroppableBJ( GetManipulatedItem(), true )
    call UnitRemoveItemSwapped( GetManipulatedItem(), GetTriggerUnit() )
    call UnitAddItemByIdSwapped( 'I00E', GetTriggerUnit() )
endfunction


Top
 Profile  
 
PostPosted: November 5th, 2007, 6:11 am 
Offline
Honorary wc3edit.net Traitor
User avatar

Joined: February 1st, 2007, 4:11 pm
Posts: 2513
Location: NEVADA
Need to call it in function main.

Need to list it in globals.

[globals]
trigger gg_untitled_gay_gui_trigger_001 = null


[functions]
Init Trig_gg_untitled_gay_gui_trigger_001()


thats the noob way.


Top
 Profile  
 
PostPosted: November 5th, 2007, 6:40 am 
Offline
Member

Joined: April 26th, 2007, 7:53 pm
Posts: 58
Firstly, owch (even though I am a noob). Secondly, thanks =P


Top
 Profile  
 
PostPosted: November 5th, 2007, 3:11 pm 
Offline
Honorary wc3edit.net Traitor
User avatar

Joined: February 1st, 2007, 4:11 pm
Posts: 2513
Location: NEVADA
lol, np. let me know if you need any help.


Top
 Profile  
 
PostPosted: November 6th, 2007, 3:10 am 
Offline
Member

Joined: April 26th, 2007, 7:53 pm
Posts: 58
Well actually I had either posted wrong or just forgot the last part the first time, this is actually the entire trigger.

Spoiler:
function Trg_greed_Conditions takes nothing returns boolean
if ( not ( GetItemOfTypeFromUnitBJ(GetTriggerUnit(), 'I00E') == GetManipulatedItem() ) ) then
return false
endif
return true
endfunction

function Trig_greed_Actions takes nothing returns nothing
call SetItemDroppableBJ( GetManipulatedItem(), true )
call UnitRemoveItemSwapped( GetManipulatedItem(), GetTriggerUnit() )
call UnitAddItemByIdSwapped( 'I00E', GetTriggerUnit() )
endfunction

//===========================================================================
function InitTrig_greed takes nothing returns nothing
set gg_trg_greed = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_greed, EVENT_PLAYER_UNIT_USE_ITEM )
call TriggerAddCondition( gg_trg_greed, Condition( function Trig_greed_Conditions ) )
call TriggerAddAction( gg_trg_greed, function Trig_greed_Actions )
endfunction


I added
Code:
trigger gg_trig_greed=null
to the globals, and added
Code:
function InitTrig_greed takes nothing returns nothing
    set gg_trg_greed = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_greed, EVENT_PLAYER_UNIT_USE_ITEM )
    call TriggerAddCondition( gg_trg_greed, Condition( function Trig_greed_Conditions ) )
    call TriggerAddAction( gg_trg_greed, function Trig_greed_Actions )
endfunction
in the functions

Than added the
Code:
function Trig_greed_Conditions takes nothing returns boolean
    if ( not ( GetItemOfTypeFromUnitBJ(GetTriggerUnit(), 'I00E') == GetManipulatedItem() ) ) then
        return false
    endif
    return true
endfunction

function Trig_greed_Actions takes nothing returns nothing
    call SetItemDroppableBJ( GetManipulatedItem(), true )
    call UnitRemoveItemSwapped( GetManipulatedItem(), GetTriggerUnit() )
    call UnitAddItemByIdSwapped( 'I00E', GetTriggerUnit() )
endfunction
part in, and when I saved and did a syntax check, I got 2 errors.
Line 488: Undefined function.
Line 489: Undefined function.

Line 488 being
Code:
call TriggerRegisterAnyUnitEventBJ( gg_trg_greed, EVENT_PLAYER_UNIT_USE_ITEM )

Line 489 being
Code:
call TriggerAddCondition( gg_trg_greed, Condition( function Trig_greed_Conditions ) )


This is probably something simple, to someone with even a little skill with JASS =S


Top
 Profile  
 
PostPosted: November 6th, 2007, 3:38 am 
Offline
Senior Member
User avatar

Joined: February 20th, 2007, 8:40 pm
Posts: 132
Location: Canada!!!
Title: Random Noob
Code:
trigger gg_trig_greed=null

Should be
Code:
trigger gg_trg_greed=null

In the globals, since gg_trg_greed is what your using later, not gg_trig_greed.

_________________
If you knew a woman who was pregnant, who had 8 kids already,
three who were deaf, two who were blind, one mentally retarded, and she had syphilis; would you recommend that she have an abortion?

Answer:
Spoiler:
If you said yes, you just killed Beethoven...


Top
 Profile  
 
PostPosted: November 6th, 2007, 5:04 am 
Offline
Member

Joined: April 26th, 2007, 7:53 pm
Posts: 58
trb92 wrote:
Code:
trigger gg_trig_greed=null

Should be
Code:
trigger gg_trg_greed=null

In the globals, since gg_trg_greed is what your using later, not gg_trig_greed.


Tried that too.

I think I need to "call" something, somewhere.


Top
 Profile  
 
 Post subject: Does anyone read these?
PostPosted: November 6th, 2007, 5:17 am 
Offline
Legendary Genius
User avatar

Joined: August 8th, 2007, 8:10 am
Posts: 1318
Location: St. George Utah
Title: Legendary Genius²
Try this....

Code:
function Trig_greed_Conditions takes nothing returns boolean
    if ( not ( GetItemOfTypeFromUnitBJ(GetTriggerUnit(), 'I00E') == GetManipulatedItem() ) ) then
        return false
    endif
    return true
endfunction
function Trig_greed_Actions takes nothing returns nothing
    call SetItemDroppableBJ( GetManipulatedItem(), true )
    call UnitRemoveItemSwapped( GetManipulatedItem(), GetTriggerUnit() )
    call UnitAddItemByIdSwapped( 'I00E', GetTriggerUnit() )
endfunction
function InitTrig_greed takes nothing returns nothing
    local trigger gg_trg_greed=null
    set gg_trg_greed = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_greed, EVENT_PLAYER_UNIT_USE_ITEM )
    call TriggerAddCondition( gg_trg_greed, Condition( function Trig_greed_Conditions ) )
    call TriggerAddAction( gg_trg_greed, function Trig_greed_Actions )
endfunction

_________________
Computer Specs:
Motherboard: GA-990FXA-UD3
CPU: FX-8350 @ 4.0GHz
PSU: Corsair CX500
RAM: G.Skill Ripjaws X 8GB @ 1866
GPU: Radeon HD 4870 1GB
HDD: OCZ Vertex series 30GB SSD
Case: Antec 900
Monitor: Toshiba 32"
OS: Windows 7 Ultimate


Top
 Profile  
 
PostPosted: November 6th, 2007, 5:25 am 
Offline
Member

Joined: April 26th, 2007, 7:53 pm
Posts: 58
With that, do I need to add trigger gg_greed=null in the globals?


Top
 Profile  
 
PostPosted: November 6th, 2007, 6:04 am 
Offline
Legendary Genius
User avatar

Joined: August 8th, 2007, 8:10 am
Posts: 1318
Location: St. George Utah
Title: Legendary Genius²
No, It's right in the functions as a local... though if you have the trigger in another function though (which I would imagine no) then yes you would want to put in globals...

And when you got the error I would assume you meant these were the errors...

Code:
call TriggerAddCondition( gg_trg_greed, Condition( function Trig_greed_Conditions ) )
call TriggerAddAction( gg_trg_greed, function Trig_greed_Actions )

_________________
Computer Specs:
Motherboard: GA-990FXA-UD3
CPU: FX-8350 @ 4.0GHz
PSU: Corsair CX500
RAM: G.Skill Ripjaws X 8GB @ 1866
GPU: Radeon HD 4870 1GB
HDD: OCZ Vertex series 30GB SSD
Case: Antec 900
Monitor: Toshiba 32"
OS: Windows 7 Ultimate


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ]  Go to page 1, 2  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 34 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group

phpBB SEO


Privacy Policy Statement
Impressum (German)