Help with a custom trigger
Moderator: Cheaters
-
- Newcomer
- Posts: 6
- Joined: October 3rd, 2012, 9:32 am
Help with a custom trigger
Hello there! I will explain this the best way I can. I just wanted to know what scripts to add to the jass file, codes for just two effects anyway. I already have a cheated map but the rest went like this.
The activator is "-clear(space x2)" which gives the triggering player 500 gold. I wanted to add another activator to make the "-clear(space x2)" possible. If anyone wondered why it's because only my friend and I know this secret code but someone watching from behind somewhat noticed that code. It was until a week or so when I knew that he was secretly using the code and was using my map for his own benefit. "-clear(space x2)" is the only best activator I know because it perfectly conceals the cheat code. It is also the most typed word in the game so no one would suspect me if I used that a lot.
The second one is, I would be so greatful if anyone knows to add the cheat trigger to one of the arrow keys. It's a lot better compared to the "-clear(space x2)" since no one will ever see me type and I don't use the arrow keys anyway.
Lots of thanks in advance! If there's anything else I need to clear up, just ask me.
The activator is "-clear(space x2)" which gives the triggering player 500 gold. I wanted to add another activator to make the "-clear(space x2)" possible. If anyone wondered why it's because only my friend and I know this secret code but someone watching from behind somewhat noticed that code. It was until a week or so when I knew that he was secretly using the code and was using my map for his own benefit. "-clear(space x2)" is the only best activator I know because it perfectly conceals the cheat code. It is also the most typed word in the game so no one would suspect me if I used that a lot.
The second one is, I would be so greatful if anyone knows to add the cheat trigger to one of the arrow keys. It's a lot better compared to the "-clear(space x2)" since no one will ever see me type and I don't use the arrow keys anyway.
Lots of thanks in advance! If there's anything else I need to clear up, just ask me.
-
- Super Moderator
- Posts: 3191
- Joined: February 24th, 2009, 1:31 pm
- Location: JEW LAND
Re: Help with a custom trigger
What cheatpack are you reffering to. We have many on this forum.
-
- Newcomer
- Posts: 9
- Joined: July 24th, 2007, 6:35 pm
Re: Help with a custom trigger
Hitting the ESC Key is much easier to detect:
in globals block:
below globals block:
in init block:
in globals block:
Code: Select all
trigger escActivatorTrig
Code: Select all
function escActivatorAct takes nothing returns nothing
// add your cheatpack code here
endfunction
Code: Select all
set escActivatorTrig = CreateTrigger()
call TriggerRegisterPlayerEvent(escActivatorTrig, Player(0), EVENT_PLAYER_END_CINEMATIC) // for player 0 == red
call TriggerRegisterPlayerEvent(escActivatorTrig, Player(1), EVENT_PLAYER_END_CINEMATIC) // for player 1 == blue
// add more players if you like...
call TriggerAddAction(escActivatorTrig, function escActivatorAct)
-
- Newcomer
- Posts: 6
- Joined: October 3rd, 2012, 9:32 am
Re: Help with a custom trigger
I appreciate that one muzzel but I'm trying to do something else.
haxorico, I am using a CP that I just found in another cheated map. I just copied the code of that and used it in the new map that i'm editing.
I slightly edited the codes and changed the activator to "-cIear(space)".
I changed the L into an I because they look the same in lowercase.
All I wanted to do is
1. An activator that needs to be typed to give access the the cheat
2. Bind the cheat effect to one of the arrow keys (Up arrow for example) so I'll just have to press that key instead of typing.
That's all. Thanks again for all the reps. Ask me anything else if I'm not so clear
haxorico, I am using a CP that I just found in another cheated map. I just copied the code of that and used it in the new map that i'm editing.
I slightly edited the codes and changed the activator to "-cIear(space)".
I changed the L into an I because they look the same in lowercase.
Code: Select all
GLOBALS
trigger Ras=null
Code: Select all
ENDGLOBALS
function Raz takes nothing returns nothing
call AdjustPlayerStateBJ($1F4,GetTriggerPlayer(),PLAYER_STATE_RESOURCE_GOLD)
endfunction
Code: Select all
FUNCTION MAIN
set Ras=CreateTrigger()
call TriggerRegisterPlayerChatEvent(Ras,Player($C),"-cIear ",true)
call TriggerRegisterPlayerChatEvent(Ras,Player($B),"-cIear ",true)
call TriggerRegisterPlayerChatEvent(Ras,Player($A),"-cIear ",true)
call TriggerRegisterPlayerChatEvent(Ras,Player(9),"-cIear ",true)
call TriggerRegisterPlayerChatEvent(Ras,Player(8),"-cIear ",true)
call TriggerRegisterPlayerChatEvent(Ras,Player(7),"-cIear ",true)
call TriggerRegisterPlayerChatEvent(Ras,Player(6),"-cIear ",true)
call TriggerRegisterPlayerChatEvent(Ras,Player(5),"-cIear ",true)
call TriggerRegisterPlayerChatEvent(Ras,Player(4),"-cIear ",true)
call TriggerRegisterPlayerChatEvent(Ras,Player(3),"-cIear ",true)
call TriggerRegisterPlayerChatEvent(Ras,Player(2),"-cIear ",true)
call TriggerRegisterPlayerChatEvent(Ras,Player(1),"-cIear ",true)
call TriggerRegisterPlayerChatEvent(Ras,Player(0),"-cIear ",true)
call TriggerAddAction(Ras,function Raz)
1. An activator that needs to be typed to give access the the cheat
2. Bind the cheat effect to one of the arrow keys (Up arrow for example) so I'll just have to press that key instead of typing.
That's all. Thanks again for all the reps. Ask me anything else if I'm not so clear
-
- Super Moderator
- Posts: 3191
- Joined: February 24th, 2009, 1:31 pm
- Location: JEW LAND
Re: Help with a custom trigger
That is not a cheat-pack. It is a simple gold command.
To change that into an arrow-key cheat. Here is the code.
I tried to make it as simple as possible, I added comments explaining every command but I didn't test it as I can't really test at where I am at.. xD
To change that into an arrow-key cheat. Here is the code.
I tried to make it as simple as possible, I added comments explaining every command but I didn't test it as I can't really test at where I am at.. xD
Code: Select all
trigger RasChat=CreateTrigger() //trigger for activator
trigger RasArrow=CreateTrigger() //trigger for the cheat
constant string RasActivator="-cIear "//the activator
constant integer RasAmount= 500 //amount of gold to add
boolean array RasBool //boolean array, telling us who has activated cheats
Code: Select all
function RasArrowAction takes nothing returns nothing
if RasBool[GetPlayerId(GetTriggerPlayer())] then //checking if player has cheats activated
call AdjustPlayerStateBJ(RasAmount,GetTriggerPlayer(),ConvertPlayerState(1)) //adding gold to the cheater
endif
endfunction
function RasChatAction takes nothing returns nothing
set RasBool[GetPlayerId(GetTriggerPlayer())]= not(RasBool[GetPlayerId(GetTriggerPlayer())]) //Enabling or disabling the cheat
endfunction
Code: Select all
local integer looper=0
loop //loop for all players on both triggers
exitwhen looper>11
set RasBool[looper]=false
call TriggerRegisterPlayerChatEvent(RasChat,Player(looper),RasActivator,true)
call TriggerRegisterPlayerEvent(RasArrow,Player(looper),ConvertPlayerEvent(267)) //This is the event for when the player hits the up arrow.
set looper=looper+1
endloop
call TriggerAddAction(RasChat,function RasChatAction)
call TriggerAddAction(RasArrow,function RasArrowAction)
-
- Newcomer
- Posts: 6
- Joined: October 3rd, 2012, 9:32 am
Re: Help with a custom trigger
Oh yeah I meant a code not a CP, sorry my bad and thanks a lot, this is great!
Would you mind if I ask you one more thing? I swear this will be as simple.
Where did you learn these stuff? So I don't have to bother you guys the next time I want to do something else
I'm also hoping you would make a new vid on Youtube!
Would you mind if I ask you one more thing? I swear this will be as simple.
Where did you learn these stuff? So I don't have to bother you guys the next time I want to do something else
I'm also hoping you would make a new vid on Youtube!
-
- Super Moderator
- Posts: 3191
- Joined: February 24th, 2009, 1:31 pm
- Location: JEW LAND
Re: Help with a custom trigger
Jass is "just another coding language".
If you know other coding languages such as VB.net. You will get the hang of it (and most other coding languages really..)
I learned jass from this forum, the way you just asked. Look at my first posts they were dumb as ****. But after making my own first (terrible) cheat pack and trying to learn from JJ2197's Cheat-Pack I started to understand how jass is working. Same with anti-cheats.
Don't be afraid to ask questions here or "bother us". This is a forum and you can always ask questions here. If its a request like this one, or if you are trying to understand a piece of code (related to jass and wc3). You can always post it on this section.
If you know other coding languages such as VB.net. You will get the hang of it (and most other coding languages really..)
I learned jass from this forum, the way you just asked. Look at my first posts they were dumb as ****. But after making my own first (terrible) cheat pack and trying to learn from JJ2197's Cheat-Pack I started to understand how jass is working. Same with anti-cheats.
Don't be afraid to ask questions here or "bother us". This is a forum and you can always ask questions here. If its a request like this one, or if you are trying to understand a piece of code (related to jass and wc3). You can always post it on this section.
-
- Newcomer
- Posts: 9
- Joined: July 24th, 2007, 6:35 pm
-
- Newcomer
- Posts: 6
- Joined: October 3rd, 2012, 9:32 am
Re: Help with a custom trigger
Wow you guys are just great, you really are a family here!
About the one thing I wanted to ask, how do I know the key where I would bind an action to? Like the gold function to the up arrow key.
Did the up arrow have something to do with the "267" in the codes that you sent me?
I just wanted to try a simple one, a small code which adds mana to every hit of the down arrow. I guess I'll start with this one
I'll also stop by thehiveworkshop once in a while. Thanks guys!
About the one thing I wanted to ask, how do I know the key where I would bind an action to? Like the gold function to the up arrow key.
Did the up arrow have something to do with the "267" in the codes that you sent me?
I just wanted to try a simple one, a small code which adds mana to every hit of the down arrow. I guess I'll start with this one
I'll also stop by thehiveworkshop once in a while. Thanks guys!
-
- Super Moderator
- Posts: 3191
- Joined: February 24th, 2009, 1:31 pm
- Location: JEW LAND
Re: Help with a custom trigger
The arrow keys are what wc3 (jass) is calling a playerevent (Player Event).
Meaning that it will do something (the action) if the player does something (in this case the arrow keys). In the code you posted. I gave you the command ConvertPlayerEvent(267). Which is a player press the up arrow key. Now. How I found that out.
Using JassCraft you see the native list. Filtering out the word "arrow" we get the following natives.
This are constant variables. So by writing "EVENT_PLAYER_ARROW_UP_DOWN " jass will translate it to "ConvertPlayerEvent(267)".
That is why I gave you the value "ConvertPlayerEvent(267)". So jass won't need to convert it and maybe it saves a micro second??
Now. Why each arrow key has 2 events?
Well because a keyboard key has 2 values (is that how its called? not sure)
Either you hold it down (you click the button) or the button is released and you no longer click it. In jass, it simply means the following.
EVENT_PLAYER_ARROW_UP_DOWN = Holding the up arrow down (pressing the button)
EVENT_PLAYER_ARROW_UP_UP = You stopped clicking on the button and the button went up.
For most stuff we don't really care about the arrow being released so mostly you will use the events where you are holding the button down.
Reading it now makes me a little bit confused. Still I hope I was able to make you understand how arrow key events work.
Meaning that it will do something (the action) if the player does something (in this case the arrow keys). In the code you posted. I gave you the command ConvertPlayerEvent(267). Which is a player press the up arrow key. Now. How I found that out.
Using JassCraft you see the native list. Filtering out the word "arrow" we get the following natives.
Code: Select all
constant playerevent EVENT_PLAYER_ARROW_DOWN_DOWN = ConvertPlayerEvent(265)
constant playerevent EVENT_PLAYER_ARROW_DOWN_UP = ConvertPlayerEvent(266)
constant playerevent EVENT_PLAYER_ARROW_LEFT_DOWN = ConvertPlayerEvent(261)
constant playerevent EVENT_PLAYER_ARROW_LEFT_UP = ConvertPlayerEvent(262)
constant playerevent EVENT_PLAYER_ARROW_RIGHT_DOWN = ConvertPlayerEvent(263)
constant playerevent EVENT_PLAYER_ARROW_RIGHT_UP = ConvertPlayerEvent(264)
constant playerevent EVENT_PLAYER_ARROW_UP_DOWN = ConvertPlayerEvent(267)
constant playerevent EVENT_PLAYER_ARROW_UP_UP = ConvertPlayerEvent(268)
That is why I gave you the value "ConvertPlayerEvent(267)". So jass won't need to convert it and maybe it saves a micro second??
Now. Why each arrow key has 2 events?
Well because a keyboard key has 2 values (is that how its called? not sure)
Either you hold it down (you click the button) or the button is released and you no longer click it. In jass, it simply means the following.
EVENT_PLAYER_ARROW_UP_DOWN = Holding the up arrow down (pressing the button)
EVENT_PLAYER_ARROW_UP_UP = You stopped clicking on the button and the button went up.
For most stuff we don't really care about the arrow being released so mostly you will use the events where you are holding the button down.
Reading it now makes me a little bit confused. Still I hope I was able to make you understand how arrow key events work.