Repick System (kinda botched)

General talk about editing, cheating, and deprotecting maps.

Moderator: Cheaters

User avatar
Durge
Senior Member
Posts: 199
Joined: April 19th, 2009, 12:46 pm

Repick System (kinda botched)

Post by Durge »

Hey guys, I recently started trying to add a small repick system into the Twilight's eve map for me and my friends, but I've come across some problems, when I run the syntax check in JASS everything is fine, but it says the game isn't found when I try to play it.

Here is where I placed stuff and what I used.

Globals
Spoiler:
trigger gg_trg_Repick_Red=CreateTrigger()
trigger gg_trg_Repick_Blue=CreateTrigger()
trigger gg_trg_Repick_Teal=CreateTrigger()
trigger gg_trg_Repick_Purple=CreateTrigger()
trigger gg_trg_Repick_Yellow=CreateTrigger()
trigger gg_trg_Repick_Orange=CreateTrigger()
trigger gg_trg_Repick_Green=CreateTrigger()
trigger gg_trg_Repick_Pink=CreateTrigger()
trigger gg_trg_Repick_Gray=CreateTrigger()
trigger gg_trg_Repick_LightBlue=CreateTrigger()
trigger gg_trg_Repick_Red_Female=CreateTrigger()
trigger gg_trg_Repick_Blue_Female=CreateTrigger()
trigger gg_trg_Repick_Teal_Female=CreateTrigger()
trigger gg_trg_Repick_Purple_Female=CreateTrigger()
trigger gg_trg_Repick_Yellow_Female=CreateTrigger()
trigger gg_trg_Repick_Orange_Female=CreateTrigger()
trigger gg_trg_Repick_Green_Female=CreateTrigger()
trigger gg_trg_Repick_Pink_Female=CreateTrigger()
trigger gg_trg_Repick_Gray_Female=CreateTrigger()
trigger gg_trg_Repick_LightBlue_Female=CreateTrigger()


Endglobals
Spoiler:
function Trig_Repick_Red_Actions takes nothing returns nothing
call RemoveUnit(GetEnumUnit())
call CreateUnit(GetTriggerPlayer(),'H002',1088.,-11584.,270.)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_GOLD,0)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_LUMBER,0)
endfunction
function Trig_Repick_Blue_Actions takes nothing returns nothing
call RemoveUnit(GetEnumUnit())
call CreateUnit(GetTriggerPlayer(),'H002',1088.,-11584.,270.)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_GOLD,0)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_LUMBER,0)
endfunction
function Trig_Repick_Teal_Actions takes nothing returns nothing
call RemoveUnit(GetEnumUnit())
call CreateUnit(GetTriggerPlayer(),'H002',1088.,-11584.,270.)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_GOLD,0)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_LUMBER,0)
endfunction
function Trig_Repick_Purple_Actions takes nothing returns nothing
call RemoveUnit(GetEnumUnit())
call CreateUnit(GetTriggerPlayer(),'H002',1088.,-11584.,270.)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_GOLD,0)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_LUMBER,0)
endfunction
function Trig_Repick_Yellow_Actions takes nothing returns nothing
call RemoveUnit(GetEnumUnit())
call CreateUnit(GetTriggerPlayer(),'H002',1088.,-11584.,270.)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_GOLD,0)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_LUMBER,0)
endfunction
function Trig_Repick_Green_Actions takes nothing returns nothing
call RemoveUnit(GetEnumUnit())
call CreateUnit(GetTriggerPlayer(),'H002',1088.,-11584.,270.)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_GOLD,0)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_LUMBER,0)
endfunction
function Trig_Repick_Pink_Actions takes nothing returns nothing
call RemoveUnit(GetEnumUnit())
call CreateUnit(GetTriggerPlayer(),'H002',1088.,-11584.,270.)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_GOLD,0)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_LUMBER,0)
endfunction
function Trig_Repick_Gray_Actions takes nothing returns nothing
call RemoveUnit(GetEnumUnit())
call CreateUnit(GetTriggerPlayer(),'H002',1088.,-11584.,270.)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_GOLD,0)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_LUMBER,0)
endfunction
function Trig_Repick_LightBlue_Actions takes nothing returns nothing
call RemoveUnit(GetEnumUnit())
call CreateUnit(GetTriggerPlayer(),'H002',1088.,-11584.,270.)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_GOLD,0)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_LUMBER,0)
endfunction
function Trig_Repick_Red_Female_Actions takes nothing returns nothing
call RemoveUnit(GetEnumUnit())
call CreateUnit(GetTriggerPlayer(),'H001',1088.,-11584.,270.)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_GOLD,0)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_LUMBER,0)
endfunction
function Trig_Repick_Blue_Female_Actions takes nothing returns nothing
call RemoveUnit(GetEnumUnit())
call CreateUnit(GetTriggerPlayer(),'H001',1088.,-11584.,270.)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_GOLD,0)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_LUMBER,0)
endfunction
function Trig_Repick_Teal_Female_Actions takes nothing returns nothing
call RemoveUnit(GetEnumUnit())
call CreateUnit(GetTriggerPlayer(),'H001',1088.,-11584.,270.)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_GOLD,0)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_LUMBER,0)
endfunction
function Trig_Repick_Purple_Female_Actions takes nothing returns nothing
call RemoveUnit(GetEnumUnit())
call CreateUnit(GetTriggerPlayer(),'H001',1088.,-11584.,270.)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_GOLD,0)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_LUMBER,0)
endfunction
function Trig_Repick_Yellow_Female_Actions takes nothing returns nothing
call RemoveUnit(GetEnumUnit())
call CreateUnit(GetTriggerPlayer(),'H001',1088.,-11584.,270.)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_GOLD,0)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_LUMBER,0)
endfunction
function Trig_Repick_Green_Female_Actions takes nothing returns nothing
call RemoveUnit(GetEnumUnit())
call CreateUnit(GetTriggerPlayer(),'H001',1088.,-11584.,270.)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_GOLD,0)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_LUMBER,0)
endfunction
function Trig_Repick_Pink_Female_Actions takes nothing returns nothing
call RemoveUnit(GetEnumUnit())
call CreateUnit(GetTriggerPlayer(),'H001',1088.,-11584.,270.)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_GOLD,0)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_LUMBER,0)
endfunction
function Trig_Repick_Gray_Female_Actions takes nothing returns nothing
call RemoveUnit(GetEnumUnit())
call CreateUnit(GetTriggerPlayer(),'H001',1088.,-11584.,270.)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_GOLD,0)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_LUMBER,0)
endfunction
function Trig_Repick_LightBlue_Female_Actions takes nothing returns nothing
call RemoveUnit(GetEnumUnit())
call CreateUnit(GetTriggerPlayer(),'H001',1088.,-11584.,270.)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_GOLD,0)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_LUMBER,0)
endfunction


Function Main
Spoiler:
call TriggerRegisterPlayerChatEvent(gg_trg_Repick_Red,Player(0),"-repick male",true)
call TriggerAddAction(gg_trg_Repick_Red,function Trig_Repick_Red_Actions)
call TriggerRegisterPlayerChatEvent(gg_trg_Repick_Blue,Player(1),"-repick male",true)
call TriggerAddAction(gg_trg_Repick_Blue,function Trig_Repick_Blue_Actions)
call TriggerRegisterPlayerChatEvent(gg_trg_Repick_Teal,Player(2),"-repick male",true)
call TriggerAddAction(gg_trg_Repick_Teal,function Trig_Repick_Teal_Actions)
call TriggerRegisterPlayerChatEvent(gg_trg_Repick_Purple,Player(3),"-repick male",true)
call TriggerAddAction(gg_trg_Repick_Purple,function Trig_Repick_Purple_Actions)
call TriggerRegisterPlayerChatEvent(gg_trg_Repick_Yellow,Player(4),"-repick male",true)
call TriggerAddAction(gg_trg_Repick_Yellow,function Trig_Repick_Yellow_Actions)
call TriggerRegisterPlayerChatEvent(gg_trg_Repick_Orange,Player(5),"-repick male",true)
call TriggerAddAction(gg_trg_Repick_Orange,function Trig_Repick_Orange_Actions)
call TriggerRegisterPlayerChatEvent(gg_trg_Repick_Green,Player(6),"-repick male",true)
call TriggerAddAction(gg_trg_Repick_Green,function Trig_Repick_Green_Actions)
call TriggerRegisterPlayerChatEvent(gg_trg_Repick_Pink,Player(7),"-repick male",true)
call TriggerAddAction(gg_trg_Repick_Pink,function Trig_Repick_Pink_Actions)
call TriggerRegisterPlayerChatEvent(gg_trg_Repick_Gray,Player(8),"-repick male",true)
call TriggerAddAction(gg_trg_Repick_Gray,function Trig_Repick_Gray_Actions)
call TriggerRegisterPlayerChatEvent(gg_trg_Repick_LightBlue,Player(9),"-repick male",true)
call TriggerAddAction(gg_trg_Repick_LightBlue,function Trig_Repick_LightBlue_Actions)
call TriggerRegisterPlayerChatEvent(gg_trg_Repick_Red_Female,Player(0),"-repick female",true)
call TriggerAddAction(gg_trg_Repick_Red_Female,function Trig_Repick_Red_Female_Actions)
call TriggerRegisterPlayerChatEvent(gg_trg_Repick_Blue_Female,Player(1),"-repick female",true)
call TriggerAddAction(gg_trg_Repick_Blue_Female,function Trig_Repick_Blue_Female_Actions)
call TriggerRegisterPlayerChatEvent(gg_trg_Repick_Teal_Female,Player(2),"-repick female",true)
call TriggerAddAction(gg_trg_Repick_Teal_Female,function Trig_Repick_Teal_Female_Actions)
call TriggerRegisterPlayerChatEvent(gg_trg_Repick_Purple_Female,Player(3),"-repick female",true)
call TriggerAddAction(gg_trg_Repick_Purple_Female,function Trig_Repick_Purple_Female_Actions)
call TriggerRegisterPlayerChatEvent(gg_trg_Repick_Yellow_Female,Player(4),"-repick female",true)
call TriggerAddAction(gg_trg_Repick_Yellow_Female,function Trig_Repick_Yellow_Female_Actions)
call TriggerRegisterPlayerChatEvent(gg_trg_Repick_Orange_Female,Player(5),"-repick female",true)
call TriggerAddAction(gg_trg_Repick_Orange_Female,function Trig_Repick_Orange_Female_Actions)
call TriggerRegisterPlayerChatEvent(gg_trg_Repick_Green_Female,Player(6),"-repick female",true)
call TriggerAddAction(gg_trg_Repick_Green_Female,function Trig_Repick_Green_Female_Actions)
call TriggerRegisterPlayerChatEvent(gg_trg_Repick_Pink_Female,Player(7),"-repick female",true)
call TriggerAddAction(gg_trg_Repick_Pink_Female,function Trig_Repick_Pink_Female_Actions)
call TriggerRegisterPlayerChatEvent(gg_trg_Repick_Gray_Female,Player(8),"-repick female",true)
call TriggerAddAction(gg_trg_Repick_Gray_Female,function Trig_Repick_Gray_Female_Actions)
call TriggerRegisterPlayerChatEvent(gg_trg_Repick_LightBlue_Female,Player(9),"-repick female",true)
call TriggerAddAction(gg_trg_Repick_LightBlue_Female,function Trig_Repick_LightBlue_Female_Actions)
ImageImageImage
naturesfury
Forum Spammer
Posts: 610
Joined: March 30th, 2009, 9:02 pm

Re: Repick System (kinda botched)

Post by naturesfury »

whats enum unit o.o
theres no picked unit so enum unit doesn't exist...
try...call RemoveUnit(FirstofGroup(GetUnitsOfPlayerMatching(GetTriggerPlayer(),Condition(function HERO))))
and add a function named HERO (in this case) that checks if the unit is a hero or not
User avatar
Durge
Senior Member
Posts: 199
Joined: April 19th, 2009, 12:46 pm

Re: Repick System (kinda botched)

Post by Durge »

Ok, well did both of those, but it still doesn't work ;-/.

I assume it should look like this?
Spoiler:
function HERO takes nothing returns boolean
return(IsUnitType(GetFilterUnit(),UNIT_TYPE_HERO)!=null)
endfunction
function Trig_Repick_Red_Actions takes nothing returns nothing
call RemoveUnit(FirstOfGroup(GetUnitsOfPlayerMatching(GetTriggerPlayer(),Condition(function HERO))))
call CreateUnit(GetTriggerPlayer(),'H002',1088.,-11584.,270.)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_GOLD,0)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_LUMBER,0)
endfunction
function Trig_Repick_Blue_Actions takes nothing returns nothing
call RemoveUnit(FirstOfGroup(GetUnitsOfPlayerMatching(GetTriggerPlayer(),Condition(function HERO))))
call CreateUnit(GetTriggerPlayer(),'H002',1088.,-11584.,270.)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_GOLD,0)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_LUMBER,0)
endfunction
function Trig_Repick_Teal_Actions takes nothing returns nothing
call RemoveUnit(FirstOfGroup(GetUnitsOfPlayerMatching(GetTriggerPlayer(),Condition(function HERO))))
call CreateUnit(GetTriggerPlayer(),'H002',1088.,-11584.,270.)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_GOLD,0)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_LUMBER,0)
endfunction
function Trig_Repick_Purple_Actions takes nothing returns nothing
call RemoveUnit(FirstOfGroup(GetUnitsOfPlayerMatching(GetTriggerPlayer(),Condition(function HERO))))
call CreateUnit(GetTriggerPlayer(),'H002',1088.,-11584.,270.)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_GOLD,0)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_LUMBER,0)
endfunction
function Trig_Repick_Yellow_Actions takes nothing returns nothing
call RemoveUnit(FirstOfGroup(GetUnitsOfPlayerMatching(GetTriggerPlayer(),Condition(function HERO))))
call CreateUnit(GetTriggerPlayer(),'H002',1088.,-11584.,270.)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_GOLD,0)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_LUMBER,0)
endfunction
function Trig_Repick_Green_Actions takes nothing returns nothing
call RemoveUnit(FirstOfGroup(GetUnitsOfPlayerMatching(GetTriggerPlayer(),Condition(function HERO))))
call CreateUnit(GetTriggerPlayer(),'H002',1088.,-11584.,270.)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_GOLD,0)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_LUMBER,0)
endfunction
function Trig_Repick_Pink_Actions takes nothing returns nothing
call RemoveUnit(FirstOfGroup(GetUnitsOfPlayerMatching(GetTriggerPlayer(),Condition(function HERO))))
call CreateUnit(GetTriggerPlayer(),'H002',1088.,-11584.,270.)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_GOLD,0)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_LUMBER,0)
endfunction
function Trig_Repick_Gray_Actions takes nothing returns nothing
call RemoveUnit(FirstOfGroup(GetUnitsOfPlayerMatching(GetTriggerPlayer(),Condition(function HERO))))
call CreateUnit(GetTriggerPlayer(),'H002',1088.,-11584.,270.)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_GOLD,0)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_LUMBER,0)
endfunction
function Trig_Repick_LightBlue_Actions takes nothing returns nothing
call RemoveUnit(FirstOfGroup(GetUnitsOfPlayerMatching(GetTriggerPlayer(),Condition(function HERO))))
call CreateUnit(GetTriggerPlayer(),'H002',1088.,-11584.,270.)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_GOLD,0)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_LUMBER,0)
endfunction
function Trig_Repick_Red_Female_Actions takes nothing returns nothing
call RemoveUnit(FirstOfGroup(GetUnitsOfPlayerMatching(GetTriggerPlayer(),Condition(function HERO))))
call CreateUnit(GetTriggerPlayer(),'H001',1088.,-11584.,270.)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_GOLD,0)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_LUMBER,0)
endfunction
function Trig_Repick_Blue_Female_Actions takes nothing returns nothing
call RemoveUnit(FirstOfGroup(GetUnitsOfPlayerMatching(GetTriggerPlayer(),Condition(function HERO))))
call CreateUnit(GetTriggerPlayer(),'H001',1088.,-11584.,270.)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_GOLD,0)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_LUMBER,0)
endfunction
function Trig_Repick_Teal_Female_Actions takes nothing returns nothing
call RemoveUnit(FirstOfGroup(GetUnitsOfPlayerMatching(GetTriggerPlayer(),Condition(function HERO))))
call CreateUnit(GetTriggerPlayer(),'H001',1088.,-11584.,270.)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_GOLD,0)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_LUMBER,0)
endfunction
function Trig_Repick_Purple_Female_Actions takes nothing returns nothing
call RemoveUnit(FirstOfGroup(GetUnitsOfPlayerMatching(GetTriggerPlayer(),Condition(function HERO))))
call CreateUnit(GetTriggerPlayer(),'H001',1088.,-11584.,270.)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_GOLD,0)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_LUMBER,0)
endfunction
function Trig_Repick_Yellow_Female_Actions takes nothing returns nothing
call RemoveUnit(FirstOfGroup(GetUnitsOfPlayerMatching(GetTriggerPlayer(),Condition(function HERO))))
call CreateUnit(GetTriggerPlayer(),'H001',1088.,-11584.,270.)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_GOLD,0)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_LUMBER,0)
endfunction
function Trig_Repick_Green_Female_Actions takes nothing returns nothing
call RemoveUnit(FirstOfGroup(GetUnitsOfPlayerMatching(GetTriggerPlayer(),Condition(function HERO))))
call CreateUnit(GetTriggerPlayer(),'H001',1088.,-11584.,270.)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_GOLD,0)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_LUMBER,0)
endfunction
function Trig_Repick_Pink_Female_Actions takes nothing returns nothing
call RemoveUnit(FirstOfGroup(GetUnitsOfPlayerMatching(GetTriggerPlayer(),Condition(function HERO))))
call CreateUnit(GetTriggerPlayer(),'H001',1088.,-11584.,270.)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_GOLD,0)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_LUMBER,0)
endfunction
function Trig_Repick_Gray_Female_Actions takes nothing returns nothing
call RemoveUnit(FirstOfGroup(GetUnitsOfPlayerMatching(GetTriggerPlayer(),Condition(function HERO))))
call CreateUnit(GetTriggerPlayer(),'H001',1088.,-11584.,270.)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_GOLD,0)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_LUMBER,0)
endfunction
function Trig_Repick_LightBlue_Female_Actions takes nothing returns nothing
call RemoveUnit(FirstOfGroup(GetUnitsOfPlayerMatching(GetTriggerPlayer(),Condition(function HERO))))
call CreateUnit(GetTriggerPlayer(),'H001',1088.,-11584.,270.)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_GOLD,0)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_LUMBER,0)
endfunction


Or should I make a function of HERO (different names) for every color.
ImageImageImage
naturesfury
Forum Spammer
Posts: 610
Joined: March 30th, 2009, 9:02 pm

Re: Repick System (kinda botched)

Post by naturesfury »

ok first, this has kinda been bothering me....but why did you make a separate trigger for each player =/
just make one (two, one for male and one for female) action function and register the chat event all to one trigger?
you have the same stuff in each function anyway...

two, not rly sure about condition functions o.o
i heard it was buggy at times (from a raging mapmaker but still....maybe it was true?)

three, what doesn't work o.o
User avatar
haxorico
Super Moderator
Posts: 3190
Joined: February 24th, 2009, 1:31 pm
Location: JEW LAND

Re: Repick System (kinda botched)

Post by haxorico »

Just to get things orginized. I took your code and changed it, into jass, I just can't stand that GUI>JASS shit as its making things way more complicated than it should be. So here is what you are doing... (first post) orginized.

Code: Select all

globals
trigger trgRepick=CreateTrigger()
endglobals
function Repick takes nothing returns nothing
local string str=StringCase(GetEventPlayerChatString(),false)
if SubString(str,8,12)=="male"then
call RemoveUnit(GetEnumUnit())
call CreateUnit(GetTriggerPlayer(),'H002',1088.,-11584.,270.)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_GOLD,0)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_LUMBER,0)
elseif SubString(str,8,14)=="female"then
call RemoveUnit(GetEnumUnit())
call CreateUnit(GetTriggerPlayer(),'H001',1088.,-11584.,270.)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_GOLD,0)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_LUMBER,0)
else
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,"use -repick male/female")
endif
set str=""
endfunction
function main takes nothing returns nothing
local integer looper=0
loop
exitwhen looper>=11
call TriggerRegisterPlayerChatEvent(trgRepick,Player(looper),"-repick",false)
call TriggerAddAction(trgRepick,function Repick)
set looper=looper+1
endloop
endfunction


So here is what happens.
A player is writing -repick (not case sensitive).
if he didnt specify male or female it shows him the error message.
if he did specify, lets take for example male.
It will remove the picked unit, which makes no sense as there doesn't have to be a picked unit, what if he picked a neutral unit? or a unit that doesn't belong to him?
Then it creates the unit H002 (I didn't take the time to see what that unit is) at some place for the triggering player.
and then it sets its lumber and gold to 0.

Now, I didnt check the code if it works, but you can already see that the logic has holes in it as mentioned above. I dont play the map, so I dont know the best way way to code the repick system.
But the sure thing is, you need a different method.
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?
naturesfury
Forum Spammer
Posts: 610
Joined: March 30th, 2009, 9:02 pm

Re: Repick System (kinda botched)

Post by naturesfury »

lol...that and the fact that he said it didn't work o.o
he just didn't specify how it didn't work

and...pretty sure H001 and H002 are the basic characters
but now that I think of it....this is TEVE...so go to the save system, take the variable for the hero, remove that, and spawn a new one (make sure to set the new hero to the var)
if theres no variable for hero, take the method it gets the hero
User avatar
haxorico
Super Moderator
Posts: 3190
Joined: February 24th, 2009, 1:31 pm
Location: JEW LAND

Re: Repick System (kinda botched)

Post by haxorico »

naturesfury wrote:lol...that and the fact that he said it didn't work o.o
he just didn't specify how it didn't work

and...pretty sure H001 and H002 are the basic characters
but now that I think of it....this is TEVE...so go to the save system, take the variable for the hero, remove that, and spawn a new one (make sure to set the new hero to the var)
if theres no variable for hero, take the method it gets the hero

That is the strange thing. This code is bad, right. But it is not a reason to make the map NOT work. That is the odd thing I see.
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
Durge
Senior Member
Posts: 199
Joined: April 19th, 2009, 12:46 pm

Re: Repick System (kinda botched)

Post by Durge »

Ah, ty for all your help guys, please excuse my stupidity, still a newbie here and trying to learn, just a quick question, could you explain what this line does?

local string str=StringCase(GetEventPlayerChatString(),false)
ImageImageImage
User avatar
haxorico
Super Moderator
Posts: 3190
Joined: February 24th, 2009, 1:31 pm
Location: JEW LAND

Re: Repick System (kinda botched)

Post by haxorico »

Declaring a string variable called "str" that will hold the chat string written by the triggering player, and to make things easy, it will turn that certain string into lower-case letters.
so if you write "-Repick" the variable str will be set to "-repick".
I use it to make the commands NOT case sensitive.
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
Durge
Senior Member
Posts: 199
Joined: April 19th, 2009, 12:46 pm

Re: Repick System (kinda botched)

Post by Durge »

Ah ok thanks a lot, and just got an error saying that there wasn't enough memory and wc3 shut down when I ran the map, I compiled(flushed) and optimized it, or is there a different issue im over-looking? It showed a .cpp file in the error message.
ImageImageImage