wc3edit.net

United Warcraft 3 map hacking!
It is currently March 28th, 2024, 10:15 am

All times are UTC




Post new topic Reply to topic  [ 9 posts ] 
Author Message
PostPosted: July 18th, 2010, 2:58 am 
Offline
Member

Joined: March 28th, 2010, 2:49 am
Posts: 58
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


Top
 Profile  
 
PostPosted: July 18th, 2010, 4:03 am 
Offline
Spice Pirate
User avatar

Joined: January 29th, 2009, 5:35 pm
Posts: 949
Location: Canada
Title: LHC
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:
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.
Quote:
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?
Quote:
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??
Quote:
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?
Quote:
UndeadxAssassin: If I thought of a random one...
UndeadxAssassin: Like....
UndeadxAssassin: I'll get back to you on that


Top
 Profile  
 
PostPosted: July 18th, 2010, 4:37 am 
Offline
Member

Joined: March 28th, 2010, 2:49 am
Posts: 58
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


Top
 Profile  
 
PostPosted: July 18th, 2010, 7:42 am 
Offline
Super Moderator
User avatar

Joined: February 24th, 2009, 1:31 pm
Posts: 3815
Location: JEW LAND
I didn't test it tough it should work...

Post this under globals
Spoiler:
Code:
integer array var_income
trigger time_cheat=CreateTrigger()

Post this under endglobals
Spoiler:
Code:
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:
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.

_________________
Image
Spoiler:
(02:24:09)
Code:
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:

(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:
(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:
(15:42:51) Lanaya: can i suck , . . .

Code:
(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:
GeorgeMots: xplain what happens in SP. Why cant you save?
dast.-:i need play with 2 players

Code:
(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:
(10:08:02) Bartimaeus: you do know run I youtube channel for my favorite music, right?


Last edited by haxorico on July 18th, 2010, 3:15 pm, edited 1 time in total.

Top
 Profile  
 
PostPosted: July 18th, 2010, 11:39 am 
Offline
Member

Joined: March 28th, 2010, 2:49 am
Posts: 58
Thank you very much Fatherspace and haxorico

I am truly grateful
:razz:


Top
 Profile  
 
PostPosted: July 19th, 2010, 4:09 pm 
Offline
Forum Spammer

Joined: March 30th, 2009, 9:02 pm
Posts: 682
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)?


Top
 Profile  
 
PostPosted: July 20th, 2010, 11:53 am 
Offline
Super Moderator
User avatar

Joined: February 24th, 2009, 1:31 pm
Posts: 3815
Location: JEW LAND
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:
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:

(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:
(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:
(15:42:51) Lanaya: can i suck , . . .

Code:
(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:
GeorgeMots: xplain what happens in SP. Why cant you save?
dast.-:i need play with 2 players

Code:
(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:
(10:08:02) Bartimaeus: you do know run I youtube channel for my favorite music, right?


Top
 Profile  
 
PostPosted: July 20th, 2010, 4:37 pm 
Offline
Spice Pirate
User avatar

Joined: January 29th, 2009, 5:35 pm
Posts: 949
Location: Canada
Title: LHC
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.
Quote:
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?
Quote:
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??
Quote:
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?
Quote:
UndeadxAssassin: If I thought of a random one...
UndeadxAssassin: Like....
UndeadxAssassin: I'll get back to you on that


Top
 Profile  
 
PostPosted: July 23rd, 2010, 12:24 pm 
Offline
Forum Spammer

Joined: March 30th, 2009, 9:02 pm
Posts: 682
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 17 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)