[HELP]Gold/Lumber Rate

General talk about editing, cheating, and deprotecting maps.

Moderator: Cheaters

zUsername
Forum Addict
Posts: 407
Joined: February 25th, 2011, 3:16 am
Location: Unknown

[HELP]Gold/Lumber Rate

Post by zUsername »

How to make custom commands to set gold/lumber rate for player?
User avatar
haxorico
Super Moderator
Posts: 3190
Joined: February 24th, 2009, 1:31 pm
Location: JEW LAND

Re: [HELP]Gold/Lumber Rate

Post by haxorico »

Ill explain the way I made for gold rate and you can mske it into lumber.

Make an integer variable holding the current amount of gold (make sn array if you want it for more than one player)

Make a trigger running everytime the gold amount changes.

Compare the new gold amount to the old gold amount.

If you see the gold increased, add more gold to the triggering player.
Make sure you disable the trigger before you add the gold so the trigger won't run infinitely. And turn it on when it's finished.
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?
zUsername
Forum Addict
Posts: 407
Joined: February 25th, 2011, 3:16 am
Location: Unknown

Re: [HELP]Gold/Lumber Rate

Post by zUsername »

thanks Hax , I'll try now thanks for helping me .
zUsername
Forum Addict
Posts: 407
Joined: February 25th, 2011, 3:16 am
Location: Unknown

Re: [HELP]Gold/Lumber Rate

Post by zUsername »

haxorico wrote:Ill explain the way I made for gold rate and you can mske it into lumber.

Make an integer variable holding the current amount of gold (make sn array if you want it for more than one player)

Make a trigger running everytime the gold amount changes.

Compare the new gold amount to the old gold amount.

If you see the gold increased, add more gold to the triggering player.
Make sure you disable the trigger before you add the gold so the trigger won't run infinitely. And turn it on when it's finished.


I create one integer variable with name Gold_Check then I set Gold_Check[triggerplayer...]=triggerplayer... current gold. As you said make trigger running everytime, I don't know what events I should choose. If I choose event every seconds, it's can't be use with triggerplayer.
And I think need to create 2 integer variables to holding amount of gold. 1 holding old gold amount , 1 holding new gold amount, then compare it. I'm understand what you says but I don't know how to make it. @@. I'm still noob.
User avatar
haxorico
Super Moderator
Posts: 3190
Joined: February 24th, 2009, 1:31 pm
Location: JEW LAND

Re: [HELP]Gold/Lumber Rate

Post by haxorico »

There is an event regarding the resources changed. You can look at any rate edit cheatpack like sgguy fukki and mine.
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?
zUsername
Forum Addict
Posts: 407
Joined: February 25th, 2011, 3:16 am
Location: Unknown

Re: [HELP]Gold/Lumber Rate

Post by zUsername »

Code: Select all

globals
integer array VmFai
trigger array u7g_tmTp7
endglobals

function GoldConD takes player u7g_pp9,integer u7g_ii7,integer u7g_ss9 returns nothing
local integer u7g_ft7=VmFai[u7g_ii7+55]*(u7g_ss9-VmFai[u7g_ii7+79])
local integer u7g_goldwhee=u7g_ss9+u7g_ft7*3/20
call SetPlayerState(u7g_pp9,PLAYER_STATE_RESOURCE_GOLD,u7g_goldwhee)
endfunction

function Sg_Gold_hi7 takes nothing returns boolean
local playerstate u7g_bb9=PLAYER_STATE_RESOURCE_GOLD
local player u7g_pp9=GetTriggerPlayer()
local integer u7g_ii7=GetPlayerId(u7g_pp9)
local integer u7g_ss9=GetPlayerState(u7g_pp9,u7g_bb9)
if u7g_ss9>VmFai[u7g_ii7+79]then
if u7g_ss9-VmFai[u7g_ii7+79]>1then
call DisableTrigger(GetTriggeringTrigger())
call GoldConD(u7g_pp9,u7g_ii7,u7g_ss9)
set u7g_ss9=GetPlayerState(u7g_pp9,u7g_bb9)
call EnableTrigger(GetTriggeringTrigger())
endif
endif
set VmFai[u7g_ii7+79]=u7g_ss9
set u7g_pp9=null
set u7g_bb9=null
return false
endfunction

function Sg_Gold_Selection_Actions takes nothing returns nothing
local integer u7g_id5=GetPlayerId(GetTriggerPlayer())+48
local integer u7g_mnG=13
loop
exitwhen u7g_mnG>17
set u7g_tmTp7[u7g_id5]=CreateTrigger()
call TriggerAddCondition(u7g_tmTp7[u7g_id5],Condition(function Sg_Gold_hi7))
set VmFai[GetPlayerId(GetTriggerPlayer())+79]=GetPlayerState(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_GOLD)
call TriggerRegisterPlayerStateEvent(u7g_tmTp7[u7g_id5],GetTriggerPlayer(),PLAYER_STATE_RESOURCE_GOLD,GREATER_THAN_OR_EQUAL,0)
set VmFai[GetPlayerId(GetTriggerPlayer())+55]=u7g_mnG-12
set u7g_mnG=u7g_mnG+1
endloop
endfunction

I'm extracted from SgGuyCP, it's working but when I killing unit, my resource gold will set to 10000000.
Please check my mistake. Thanks.
Last edited by zUsername on June 11th, 2013, 5:14 pm, edited 2 times in total.
User avatar
haxorico
Super Moderator
Posts: 3190
Joined: February 24th, 2009, 1:31 pm
Location: JEW LAND

Re: [HELP]Gold/Lumber Rate

Post by haxorico »

A) If you post a code, please use the [code] tag
B) Reading from sgguy cp (and fai) is rather difficult for me as the variables have weird names so I will need to get home to read it properly.
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?
zUsername
Forum Addict
Posts: 407
Joined: February 25th, 2011, 3:16 am
Location: Unknown

Re: [HELP]Gold/Lumber Rate

Post by zUsername »

Ok, I'll wait for you . Thanks Hax.
User avatar
haxorico
Super Moderator
Posts: 3190
Joined: February 24th, 2009, 1:31 pm
Location: JEW LAND

Re: [HELP]Gold/Lumber Rate

Post by haxorico »

Brief look and it seems you left out some parts.
What is calling the function sg_gold_selection_action
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?
zUsername
Forum Addict
Posts: 407
Joined: February 25th, 2011, 3:16 am
Location: Unknown

Re: [HELP]Gold/Lumber Rate

Post by zUsername »

function main Hax