How do I insert my own triggers?

General talk about editing, cheating, and deprotecting maps.

Moderator: Cheaters

Fiddle
Newcomer
Posts: 19
Joined: April 8th, 2007, 3:28 pm

How do I insert my own triggers?

Post by Fiddle »

Say for example, this is the trigger converted from GUI in the world editor:
Spoiler:

Code: Select all

function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing
    call SetPlayerStateBJ( GetTriggerPlayer(), PLAYER_STATE_RESOURCE_GOLD, S2I(SubStringBJ("-gold ", 7, 12)) )
endfunction

//===========================================================================
function InitTrig_Untitled_Trigger_001 takes nothing returns nothing
    set gg_trg_Untitled_Trigger_001 = CreateTrigger(  )
    call TriggerRegisterPlayerChatEvent( gg_trg_Untitled_Trigger_001, Player(0), "-gold ", false )
    call TriggerAddAction( gg_trg_Untitled_Trigger_001, function Trig_Untitled_Trigger_001_Actions )
endfunction


How would I go about inserting this into a protected map?

What I've tried is putting both all of the above under "endglobals" and putting the line:
"trigger gg_trg_Untitled_Trigger_001 = null" at the end of globals, but when I tried to host the map, it says The game was not found. I've also deleted the attributes file in the map using MPQ.
User avatar
Kryptonyte
Forum Staff
Posts: 1400
Joined: March 17th, 2008, 12:07 am

Re: How do I insert my own triggers?

Post by Kryptonyte »

1. Those both go under "endglobals"
2. Look below "globals", there will be something like...

Code: Select all

trigger (Name of your trigger)=null

You also need that...
Image
Made by the late ILikeHacking

My quote from SKillER

Spoiler:
Chat wrote:(19:12:41) SKillER: newfags cant triforce
(19:20:30) SKillER: ▲
▲ ▲
(19:20:35) SKillER: aww
(19:20:37) FatherSpace: FAIL
(19:20:43) Kryptonyte: Wow stop failing.
(19:20:47) SKillER: ▲
▲ ▲
(19:21:41) Kryptonyte: .

. ▲
▲ ▲
(19:22:20) Kryptonyte: I guess you were right, newfags can't triforce.
(19:22:29) SKillER: . . ▲
▲ ▲
(19:23:04) SKillER: OMFG
(19:23:06) SKillER: ... THIS CHAT
(19:23:06) SKillER: !
(19:23:36) SKillER: ▲
▲ ▲
(19:23:46) SKillER: ▲
.▲ ▲


Apparently, SKillER is a newfag.
Fiddle
Newcomer
Posts: 19
Joined: April 8th, 2007, 3:28 pm

Re: How do I insert my own triggers?

Post by Fiddle »

Um, I do have it like that.
What I've tried is putting both all of the above under "endglobals" and putting the line:
"trigger gg_trg_Untitled_Trigger_001 = null" at the end of globals, but when I tried to host the map, it says The game was not found. I've also deleted the attributes file in the map using MPQ.
User avatar
Kryptonyte
Forum Staff
Posts: 1400
Joined: March 17th, 2008, 12:07 am

Re: How do I insert my own triggers?

Post by Kryptonyte »

Give me the .j file
Image
Made by the late ILikeHacking

My quote from SKillER

Spoiler:
Chat wrote:(19:12:41) SKillER: newfags cant triforce
(19:20:30) SKillER: ▲
▲ ▲
(19:20:35) SKillER: aww
(19:20:37) FatherSpace: FAIL
(19:20:43) Kryptonyte: Wow stop failing.
(19:20:47) SKillER: ▲
▲ ▲
(19:21:41) Kryptonyte: .

. ▲
▲ ▲
(19:22:20) Kryptonyte: I guess you were right, newfags can't triforce.
(19:22:29) SKillER: . . ▲
▲ ▲
(19:23:04) SKillER: OMFG
(19:23:06) SKillER: ... THIS CHAT
(19:23:06) SKillER: !
(19:23:36) SKillER: ▲
▲ ▲
(19:23:46) SKillER: ▲
.▲ ▲


Apparently, SKillER is a newfag.
Fiddle
Newcomer
Posts: 19
Joined: April 8th, 2007, 3:28 pm

Re: How do I insert my own triggers?

Post by Fiddle »

Edited Parts:
Spoiler:

Code: Select all

trigger asdf=null
trigger asdf2=null
endglobals
function goldActions takes nothing returns nothing
call SetPlayerStateBJ( GetTriggerPlayer(), PLAYER_STATE_RESOURCE_GOLD, S2I(SubStringBJ("-gold ", 7, 12)) )
endfunction
function lumberActions takes nothing returns nothing
call SetPlayerStateBJ( GetTriggerPlayer(), PLAYER_STATE_RESOURCE_LUMBER, S2I(SubStringBJ("-lumber ", 9, 14)) )
endfunction
function goldInit takes nothing returns nothing
set asdf = CreateTrigger(  )
call TriggerRegisterPlayerChatEvent(asdf,Player(0), "-gold ", false )
call TriggerAddAction(asdf, function goldActions )
endfunction
function lumberInit takes nothing returns nothing
set asdf2 = CreateTrigger(  )
call TriggerRegisterPlayerChatEvent(asdf2,Player(0), "-lumber ", false )
call TriggerAddAction(asdf2, function lumberActions )
endfunction


In case that isn't sufficient, I attached the file too.

Edit: Ah wait, I found an error in the code. My bad, sorry, I'll update this post again once I try out editing some other parts.
You do not have the required permissions to view the files attached to this post.
User avatar
Kryptonyte
Forum Staff
Posts: 1400
Joined: March 17th, 2008, 12:07 am

Re: How do I insert my own triggers?

Post by Kryptonyte »

Lol, run syntax checker.
Rename two of the functions to something random (change anything that would be affected by their name, too)
Image
Made by the late ILikeHacking

My quote from SKillER

Spoiler:
Chat wrote:(19:12:41) SKillER: newfags cant triforce
(19:20:30) SKillER: ▲
▲ ▲
(19:20:35) SKillER: aww
(19:20:37) FatherSpace: FAIL
(19:20:43) Kryptonyte: Wow stop failing.
(19:20:47) SKillER: ▲
▲ ▲
(19:21:41) Kryptonyte: .

. ▲
▲ ▲
(19:22:20) Kryptonyte: I guess you were right, newfags can't triforce.
(19:22:29) SKillER: . . ▲
▲ ▲
(19:23:04) SKillER: OMFG
(19:23:06) SKillER: ... THIS CHAT
(19:23:06) SKillER: !
(19:23:36) SKillER: ▲
▲ ▲
(19:23:46) SKillER: ▲
.▲ ▲


Apparently, SKillER is a newfag.
Fiddle
Newcomer
Posts: 19
Joined: April 8th, 2007, 3:28 pm

Re: How do I insert my own triggers?

Post by Fiddle »

Syntax checker? :shock: Where do i get it!?

And apparently there's something wrong with this too:
set o0OooOO[id]=(S2I(SubStringBJ("-gold ", 7, 12)))
set o0Ooo0O[id]=(S2I(SubStringBJ("-lumber ", 9, 14)))

Because it gave me "The game was not found" after I added those two lines.

Edit: Nvm, found the syntax checker... and seriously... Forgot that "id" wasn't inserted as a parameter OR a local. Sheesh. Too many errors. Thanks.