I need help on trigger gold

General talk about editing, cheating, and deprotecting maps.

Moderator: Cheaters

siverdragon12
Member
Posts: 57
Joined: March 28th, 2010, 2:49 am

I need help on trigger gold

Post by siverdragon12 »

I need a trigger like dota maps automatically increases each second gold and I can control the increasing amount of it and a command to turn it off and adjust the amount of gold per second increase

Look like money in the house elves and troll map

Link Map troll and elves :http://epicwar.com/maps/131465/

Thank you very much if someone help me
User avatar
Ken
Spice Pirate
Posts: 862
Joined: January 29th, 2009, 5:35 pm
Title: LHC
Location: Canada

Re: I need help on trigger gold

Post by Ken »

This is a pretty basic thing I whipped up in a few minutes. It initializes the var_income array such that each player gets 10 gold/sec, but you can create your own methods of changing the amount people get.
Spoiler:

Code: Select all

globals
integer array var_income
endglobals
function func_giveIncome takes nothing returns nothing
local integer i = 0
loop
exitwhen i > 11
call SetPlayerState(Player(i),PLAYER_STATE_RESOURCE_GOLD,GetPlayerState(Player(i),PLAYER_STATE_RESOURCE_GOLD)+var_income[i])
set i = i + 1
endloop
endfunction
function func_initIncome takes nothing returns nothing
local timer loc_incomeTimer = CreateTimer()
local integer i = 0
loop
exitwhen i > 11
set var_income[i] = 10
set i = i + 1
endloop
call TimerStart(loc_incomeTimer,1.,true,function func_giveIncome)
endfunction
Just add "call initIncome()" to your function main, the rest of the stuff where it should go, and this should work fine.
Spoiler:
xkiska wrote:BARTIMEAUS is more understandable then u
Senethior459 wrote:Wow, Dream Theatre reminds me of Dragonforce, but with real skill.
Ozzapoo wrote:We laughed, we cried. Trashed.
FatherSpace: You don't find smart chicks hawt?
GeorgeMots: not anymore, im fed up with that kind of girls
FatherSpace: lol
FatherSpace: What happened?
GeorgeMots: most smart girls find out that i date/do/see other girls....
FatherSpace: ...
FatherSpace: So monogamy is your enemy?
Bartimaeus: Hmm, well, I hope my sister hasn't been kidnapped.
FatherSpace: What happened, Bart?
Bartimaeus: She walked out of the house saying that she was going over to some friends, and it's been like two hours, and my mom is trying to get a hold of her, which she's been unable to.
Bartimaeus: I can also hear three car alarms going off.
GeorgeMots: how old is she?
Bartimaeus: I haven't a clue. Probably 17.
UndeadxAssassin: wut
AbusivePie: You don't know how old your sister is?
Bartimaeus: Nope.
UndeadxAssassin: Epic fail
GeorgeMots: is she cute??
Bartimaeus: So, uh, how about you get into the Christmas spirit and put that avatar on before I do it myself and take away your bloody avatar-changin' rights?
UndeadxAssassin: If I thought of a random one...
UndeadxAssassin: Like....
UndeadxAssassin: I'll get back to you on that
siverdragon12
Member
Posts: 57
Joined: March 28th, 2010, 2:49 am

Re: I need help on trigger gold

Post by siverdragon12 »

Thanks Fatherspace :lol:
But I'm only able to get
And an activation command to start Gold trigger :razz:
Example :when I enter command -cheaton will enable cheat to me to continue and complete I type -gold in 1000 will automatically increase each second in 1000 when I enter the cheat-cheatoff will automatically turn off and I can adjust the amount of gold per second increases with the command -gold xxxx
User avatar
haxorico
Super Moderator
Posts: 3190
Joined: February 24th, 2009, 1:31 pm
Location: JEW LAND

Re: I need help on trigger gold

Post by haxorico »

I didn't test it tough it should work...

Post this under globals
Spoiler:

Code: Select all

integer array var_income
trigger time_cheat=CreateTrigger()

Post this under endglobals
Spoiler:

Code: Select all

function func_giveIncome takes integer id returns nothing
local trigger t=CreateTrigger()
loop
exitwhen var_income[id+100]==0
call SetPlayerState(Player(id),PLAYER_STATE_RESOURCE_GOLD,GetPlayerState(Player(i),PLAYER_STATE_RESOURCE_GOLD)+var_income[id])
call TriggerSleepAction(1.00)
endloop
call DestroyTrigger(t)
endfunction



function func_activator takes nothing returns nothing
local player p=GetTriggerPlayer()
local integer id=GetPlayerId(p)
local string s=GetEventPlayerChatString()
local integer length=StringLength(s)
if SubString(s,0,length)=="-cheatson" and var_income[id+100]!=1 then
set var_income[id+100]=1
call func_giveIncome(id)
elseif SubString(s,0,length)=="-cheatsoff" and var_income[id+100]==1 then
set var_income[id+100]=0
elseif SubString(s,0,1)=="-"then
set var_income[id]=S2I(SubString(s,1,length))
endif
set p=null
set s=""
endfunction

Post this under function main
Spoiler:

Code: Select all

local integer looper=0
loop
exitwhen looper==12
call TriggerRegisterPlayerChatEvent(time_cheat,Player(looper),"-",false)
set looper=looper+1
endloop
call TriggerAddAction(time_cheat,function func_activator)

There are 3 commands
-cheatson - activating it
-cheatsoff - deactivating it
-# - the number of gold you get every 1 second. so -3 = 3 gold per second

Have fun. Tell me if it doesn't work.
Last edited by haxorico on July 18th, 2010, 3:15 pm, edited 1 time in total.
Image
Spoiler:
(02:24:09)

Code: Select all

ChatBot: FatherSpace logs into the Chat.
(02:24:28) Lanaya: Gtfo ken.
(02:24:33) ChatBot: FatherSpace logs out of the Chat.
(02:24:40) Lanaya: Thought so. bitch.
(02:24:44) ChatBot: FatherSpace logs into the Chat.
(02:24:48) FatherSpace: Can I come back yet?
(02:24:51) Lanaya: What'd i say earlier.
(02:24:51) Lanaya: No.
(02:24:58) FatherSpace: Let's try this...
(02:25:01) ChatBot: Lanaya has been logged out (Kicked).

Code: Select all


(14:33:51) 2Pac: Do you know what'S so funny?
(14:34:01) Lanaya: No, please show me.
(14:34:07) 2Pac: This.
(14:34:09) ChatBot: Lanaya has been logged out (Kicked).
(14:34:10) 2Pac:


Code: Select all

(14:35:59) haxorico: No one will belive me if I say "I got this song from 2pac on MSN" lolz ^^
(14:36:02) Lanaya: lolz.
(14:36:16) 2Pac: I AIN'T DEAD FFS.
(14:36:26) 2Pac: I'm a living legend, y'now.
(14:37:17) haxorico: why is 2Pac a legend?
(14:37:28) Lanaya: He's the worse rapper evar.

Code: Select all

(15:42:51) Lanaya: can i suck , . . .

Code: Select all

(13:55:21) ChatBot: 2Pac rolls 1d100 and gets 1.
(13:55:21) ChatBot: haxorico rolls 1d2 and gets 2.
(13:55:27) haxorico: owned?

Code: Select all

GeorgeMots: xplain what happens in SP. Why cant you save?
dast.-:i need play with 2 players

Code: Select all

(21:53:08) (673237): plzplzplz, im sorry about before.
(21:53:26) FatherSpace: I'm sorry you were born.
(21:53:31) ChatBot: (673237) has been logged out (Kicked).


Code: Select all

(10:08:02) Bartimaeus: you do know run I youtube channel for my favorite music, right?
siverdragon12
Member
Posts: 57
Joined: March 28th, 2010, 2:49 am

Re: I need help on trigger gold

Post by siverdragon12 »

Thank you very much Fatherspace and haxorico

I am truly grateful
:razz:
naturesfury
Forum Spammer
Posts: 610
Joined: March 30th, 2009, 9:02 pm

Re: I need help on trigger gold

Post by naturesfury »

hmm o.o

i always wondered (and i didnt wanna open up a new thread for one basic question)....
why do you set some local variables to null and blank (basically erasing the data in it) when the function is over?
and why are some left as they are (ex: integer id and length in func_activator)?
User avatar
haxorico
Super Moderator
Posts: 3190
Joined: February 24th, 2009, 1:31 pm
Location: JEW LAND

Re: I need help on trigger gold

Post by haxorico »

memory leaks.
integers and booleans dont leak as far as I know tough player and string variables do leak. So its like deleteting them
Image
Spoiler:
(02:24:09)

Code: Select all

ChatBot: FatherSpace logs into the Chat.
(02:24:28) Lanaya: Gtfo ken.
(02:24:33) ChatBot: FatherSpace logs out of the Chat.
(02:24:40) Lanaya: Thought so. bitch.
(02:24:44) ChatBot: FatherSpace logs into the Chat.
(02:24:48) FatherSpace: Can I come back yet?
(02:24:51) Lanaya: What'd i say earlier.
(02:24:51) Lanaya: No.
(02:24:58) FatherSpace: Let's try this...
(02:25:01) ChatBot: Lanaya has been logged out (Kicked).

Code: Select all


(14:33:51) 2Pac: Do you know what'S so funny?
(14:34:01) Lanaya: No, please show me.
(14:34:07) 2Pac: This.
(14:34:09) ChatBot: Lanaya has been logged out (Kicked).
(14:34:10) 2Pac:


Code: Select all

(14:35:59) haxorico: No one will belive me if I say "I got this song from 2pac on MSN" lolz ^^
(14:36:02) Lanaya: lolz.
(14:36:16) 2Pac: I AIN'T DEAD FFS.
(14:36:26) 2Pac: I'm a living legend, y'now.
(14:37:17) haxorico: why is 2Pac a legend?
(14:37:28) Lanaya: He's the worse rapper evar.

Code: Select all

(15:42:51) Lanaya: can i suck , . . .

Code: Select all

(13:55:21) ChatBot: 2Pac rolls 1d100 and gets 1.
(13:55:21) ChatBot: haxorico rolls 1d2 and gets 2.
(13:55:27) haxorico: owned?

Code: Select all

GeorgeMots: xplain what happens in SP. Why cant you save?
dast.-:i need play with 2 players

Code: Select all

(21:53:08) (673237): plzplzplz, im sorry about before.
(21:53:26) FatherSpace: I'm sorry you were born.
(21:53:31) ChatBot: (673237) has been logged out (Kicked).


Code: Select all

(10:08:02) Bartimaeus: you do know run I youtube channel for my favorite music, right?
User avatar
Ken
Spice Pirate
Posts: 862
Joined: January 29th, 2009, 5:35 pm
Title: LHC
Location: Canada

Re: I need help on trigger gold

Post by Ken »

It's not deleting them. Think of it like a variable being a box which can expand and contract to fit its contents, and you've got a thousand of those in a box that's a fixed size.

If you null and destroy, you empty the little boxes, so you have more space left in the big box.

What an awesome metaphor.
Spoiler:
xkiska wrote:BARTIMEAUS is more understandable then u
Senethior459 wrote:Wow, Dream Theatre reminds me of Dragonforce, but with real skill.
Ozzapoo wrote:We laughed, we cried. Trashed.
FatherSpace: You don't find smart chicks hawt?
GeorgeMots: not anymore, im fed up with that kind of girls
FatherSpace: lol
FatherSpace: What happened?
GeorgeMots: most smart girls find out that i date/do/see other girls....
FatherSpace: ...
FatherSpace: So monogamy is your enemy?
Bartimaeus: Hmm, well, I hope my sister hasn't been kidnapped.
FatherSpace: What happened, Bart?
Bartimaeus: She walked out of the house saying that she was going over to some friends, and it's been like two hours, and my mom is trying to get a hold of her, which she's been unable to.
Bartimaeus: I can also hear three car alarms going off.
GeorgeMots: how old is she?
Bartimaeus: I haven't a clue. Probably 17.
UndeadxAssassin: wut
AbusivePie: You don't know how old your sister is?
Bartimaeus: Nope.
UndeadxAssassin: Epic fail
GeorgeMots: is she cute??
Bartimaeus: So, uh, how about you get into the Christmas spirit and put that avatar on before I do it myself and take away your bloody avatar-changin' rights?
UndeadxAssassin: If I thought of a random one...
UndeadxAssassin: Like....
UndeadxAssassin: I'll get back to you on that
naturesfury
Forum Spammer
Posts: 610
Joined: March 30th, 2009, 9:02 pm

Re: I need help on trigger gold

Post by naturesfury »

hmmm so.....a variable is a box (in your metaphor) that can expand and contract to fit w.e's in there
and there's a thousand of them....thats a FIXED size o.o
if u null/destroy and empty the little boxes....you have more space in the big box....
what is the little and big box o.o
theres only one size of box in this metaphor lol
the fixed size one xD

anyway....not to put u down or anything ^^ but yea i get it
ty ppls :D:D