-godly all command on teve map

General talk about editing, cheating, and deprotecting maps.

Moderator: Cheaters

User avatar
Durge
Old Wrinkly Member
Posts: 234
Joined: April 19th, 2009, 12:46 pm
Contact:

-godly all command on teve map

Post by Durge »

Ok, just figure I'd start a new thread since it had no relevance to my other thread, since it was based solely on the repick system.

So I was wondering how do you know what to put in the SubString(<w/e>,<here>,<and here>).

Heres what I'm trying to do, I followed what you did for your repick command haxorico, maybe it's something completely different thats the problem, I'm not sure.

Spoiler:
function GodlyItem takes nothing returns nothing
local string bum=StringCase(GetEventPlayerChatString(),false)
if SubString(bum,7,10)=="all"then

call UnitAddItemByIdSwapped('I02Z',GetTriggerUnit())
call UnitAddItemByIdSwapped('I047',GetTriggerUnit())
call UnitAddItemByIdSwapped('I046',GetTriggerUnit())
call UnitAddItemByIdSwapped('I04N',GetTriggerUnit())
call UnitAddItemByIdSwapped('I04O',GetTriggerUnit())
call UnitAddItemByIdSwapped('I04P',GetTriggerUnit())
call UnitAddItemByIdSwapped('I05H',GetTriggerUnit())
call UnitAddItemByIdSwapped('I05G',GetTriggerUnit())
call UnitAddItemByIdSwapped('I05F',GetTriggerUnit())
endif
set bum=""
endfunction

function main
local integer godlooper=0
loop
exitwhen godlooper>=1
call TriggerRegisterPlayerChatEvent(trgGodly,Player(godlooper),"-godly",false)
call TriggerAddAction(trgGodly,function GodlyItem)
set godlooper=godlooper+1
endloop
ImageImageImage
User avatar
Risugami
Senior Member
Posts: 158
Joined: September 25th, 2011, 1:15 pm
Title: Slacking

Re: -godly all command on teve map

Post by Risugami »

Code: Select all

set bum=""


Why are you setting bum to ""? I'm aware of leaks but strings are fine.

Well, there's a better way to do it. Like for example:

Code: Select all

function GodlyItem takes string s2 returns nothing
if SubString(s2,0,10)=="-godly all"then
call UnitAddItemByIdSwapped('I02Z',GetTriggerUnit())
call UnitAddItemByIdSwapped('I047',GetTriggerUnit())
call UnitAddItemByIdSwapped('I046',GetTriggerUnit())
call UnitAddItemByIdSwapped('I04N',GetTriggerUnit())
call UnitAddItemByIdSwapped('I04O',GetTriggerUnit())
call UnitAddItemByIdSwapped('I04P',GetTriggerUnit())
call UnitAddItemByIdSwapped('I05H',GetTriggerUnit())
call UnitAddItemByIdSwapped('I05G',GetTriggerUnit())
call UnitAddItemByIdSwapped('I05F',GetTriggerUnit())
endif
endfunction


I didn't tested it if it would work so I don't recommend for you to use it. IIRC that's how JJ's CP handles strings.

Another questions pops out is. Why are you using SubStrings? If you're just gonna make a "-godly all" as a exact match. But if you still want to use substrings this could help you.

warcraft-map-discussion-f67/queries-t22780.html#p152826
Image Image
(Made by: Risugami) | Risugami's Signature Workshop

"As a young boy, I was taught in high school that hacking was cool. - Kevin Mitnick"
User avatar
Durge
Old Wrinkly Member
Posts: 234
Joined: April 19th, 2009, 12:46 pm
Contact:

Re: -godly all command on teve map

Post by Durge »

Oh, that makes a lot more sense, thanks for the help Risugami

EDIT:Ok, I've revised my command, but to no avail it still does not work.
Here is what I have

Spoiler:
globals
trigger trgGodly=CreateTrigger()

endglobals
function GodlyItem takes nothing returns nothing
call TriggerRegisterPlayerChatEvent(trgGodly,GetTriggerPlayer(),"-godly all",true)
call UnitAddItemByIdSwapped('I02Z',GetTriggerUnit())
call UnitAddItemByIdSwapped('I047',GetTriggerUnit())
call UnitAddItemByIdSwapped('I046',GetTriggerUnit())
call UnitAddItemByIdSwapped('I04N',GetTriggerUnit())
call UnitAddItemByIdSwapped('I04O',GetTriggerUnit())
call UnitAddItemByIdSwapped('I04P',GetTriggerUnit())
call UnitAddItemByIdSwapped('I05H',GetTriggerUnit())
call UnitAddItemByIdSwapped('I05G',GetTriggerUnit())
call UnitAddItemByIdSwapped('I05F',GetTriggerUnit())
endfunction

function main
call TriggerAddAction(trgGodly,function GodlyItem)
ImageImageImage
User avatar
Risugami
Senior Member
Posts: 158
Joined: September 25th, 2011, 1:15 pm
Title: Slacking

Re: -godly all command on teve map

Post by Risugami »

It doesn't work because you didn't have a condition. I am not in my computer right now so...

First of all, put call 'TriggerRegisterPlayerChatEvent(trgGodly,GetTriggerPlayer(),"-godly all",true)' into a new function or something that returns boolean so you'll make that as condition. So whenever it returns true it will call function GodlyItem. Which creates the items and such.

[EDIT: This should work, please do test it:]

After endglobals:

Code: Select all

function GI_Conditions takes nothing returns boolean
    if GetEventPlayerChatString() == "-godly all" then
        return true
    endif
    return false
endfunction

function GI_Actions takes nothing returns nothing
    call UnitAddItemByIdSwapped('I02Z',GetTriggerUnit())
    call UnitAddItemByIdSwapped('I047',GetTriggerUnit())
    call UnitAddItemByIdSwapped('I046',GetTriggerUnit())
    call UnitAddItemByIdSwapped('I04N',GetTriggerUnit())
    call UnitAddItemByIdSwapped('I04O',GetTriggerUnit())
    call UnitAddItemByIdSwapped('I04P',GetTriggerUnit())
    call UnitAddItemByIdSwapped('I05H',GetTriggerUnit())
    call UnitAddItemByIdSwapped('I05G',GetTriggerUnit())
    call UnitAddItemByIdSwapped('I05F',GetTriggerUnit())
endfunction


And this is at the function main part: (AFTER LOCALS!)

Code: Select all

    local trigger t = CreateTrigger()
    local integer i = 0
    loop
        exitwhen i>11
        call TriggerRegisterPlayerChatEvent( t, Player(i), "-godly all", true)
        set i = i+1
    endloop
    call TriggerAddCondition(t, Condition(function GI_Conditions))
    call TriggerAddAction(t, function GI_Actions)


It should work with all players but I didn't tested it really. But well it should work.
Image Image
(Made by: Risugami) | Risugami's Signature Workshop

"As a young boy, I was taught in high school that hacking was cool. - Kevin Mitnick"
Kyoshiro
Forum Staff
Posts: 1108
Joined: October 27th, 2009, 12:18 pm
Location: Australia, GMT+8

Re: -godly all command on teve map

Post by Kyoshiro »

just a question.
since when can units have more than 6 inv slots?
If you have any questions drop in by chat sometime, chances are there'll be someone who can help you that's afking there, so the next best thing is to click the link on UndeadxAssassin's Sig and ask your question there.
User avatar
haxorico
Super Moderator
Posts: 3816
Joined: February 24th, 2009, 1:31 pm
Location: JEW LAND
Contact:

Re: -godly all command on teve map

Post by haxorico »

wtf? Why are you guys making it so complicated?

Your code is good, I suspect you didn't use CreateTrigger() on globals but used null as its given by default.
Here is the full code you need to have.

Spoiler:

Code: Select all

globals
trigger trgGodly=CreateTrigger()
endglobals

function GodlyItem takes nothing returns nothing
local string bum=StringCase(GetEventPlayerChatString(),false)
if SubString(bum,7,10)=="all"then
call UnitAddItemByIdSwapped('I02Z',GetTriggerUnit())
call UnitAddItemByIdSwapped('I047',GetTriggerUnit())
call UnitAddItemByIdSwapped('I046',GetTriggerUnit())
call UnitAddItemByIdSwapped('I04N',GetTriggerUnit())
call UnitAddItemByIdSwapped('I04O',GetTriggerUnit())
call UnitAddItemByIdSwapped('I04P',GetTriggerUnit())
call UnitAddItemByIdSwapped('I05H',GetTriggerUnit())
call UnitAddItemByIdSwapped('I05G',GetTriggerUnit())
call UnitAddItemByIdSwapped('I05F',GetTriggerUnit())
endif
set bum=""
endfunction

function main takes nothing returns nothing
local integer godlooper=0
loop
exitwhen godlooper>=1
call TriggerRegisterPlayerChatEvent(trgGodly,Player(godlooper),"-godly",false)
call TriggerAddAction(trgGodly,function GodlyItem)
set godlooper=godlooper+1
endloop
endfunction


As for the string="". Strings takes more space the more characters they contain, for example on C# - each character takes 16bit (IIRC).
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
Risugami
Senior Member
Posts: 158
Joined: September 25th, 2011, 1:15 pm
Title: Slacking

Re: -godly all command on teve map

Post by Risugami »

Kyoshiro wrote:just a question.
since when can units have more than 6 inv slots?


UnitAddItemByIdSwapped doesn't add the item on inventory. You still have to pick it up. But, you do have a point. o.o

@haxorico. My bad, :\
Image Image
(Made by: Risugami) | Risugami's Signature Workshop

"As a young boy, I was taught in high school that hacking was cool. - Kevin Mitnick"
User avatar
haxorico
Super Moderator
Posts: 3816
Joined: February 24th, 2009, 1:31 pm
Location: JEW LAND
Contact:

Re: -godly all command on teve map

Post by haxorico »

If you want to have some debugging, here is what I used to do. try this code, and tell me how it goes.

Spoiler:

Code: Select all

globals
trigger trgGodly=CreateTrigger()
endglobals

function GodlyItem takes nothing returns nothing
local string bum=StringCase(GetEventPlayerChatString(),false)
if SubString(bum,0,10)=="-godly all"then
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,"Success - The code detected the command")
else
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,"You wrote " + GetEventPlayerChatString() + " and not -godly all")
endif
set bum=""
endfunction

function main takes nothing returns nothing
local integer godlooper=0
loop
exitwhen godlooper>=1
call TriggerRegisterPlayerChatEvent(trgGodly,Player(godlooper),"-",false)
call TriggerAddAction(trgGodly,function GodlyItem)
set godlooper=godlooper+1
endloop
endfunction
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
Old Wrinkly Member
Posts: 234
Joined: April 19th, 2009, 12:46 pm
Contact:

Re: -godly all command on teve map

Post by Durge »

Technically shouldn't this work also?
Chattrigger is set as null in globals

Spoiler:
function Chattrg takes nothing returns nothing
set Chattrigger = CreateTrigger()
call TriggerRegisterPlayerChatEvent(Chattrigger,GetTriggerPlayer(),"-godly all",true)
call TriggerAddAction(Chattrigger,function Godly)
endfunction
function Godly takes nothing returns nothing
call UnitAddItemByIdSwapped('I02Z',GetTriggerUnit())
call UnitAddItemByIdSwapped('I047',GetTriggerUnit())
call UnitAddItemByIdSwapped('I046',GetTriggerUnit())
call UnitAddItemByIdSwapped('I04N',GetTriggerUnit())
call UnitAddItemByIdSwapped('I04O',GetTriggerUnit())
call UnitAddItemByIdSwapped('I04P',GetTriggerUnit())
call UnitAddItemByIdSwapped('I05H',GetTriggerUnit())
call UnitAddItemByIdSwapped('I05G',GetTriggerUnit())
call UnitAddItemByIdSwapped('I05F',GetTriggerUnit())
endfunction


EDIT:The problem seems to be the items not spawning for some reason.

I even tried this as well

Spoiler:
call CreateItemLoc('102Z',GetUnitLoc(GetTriggerUnit()))
call CreateItemLoc('1047',GetUnitLoc(GetTriggerUnit()))
call CreateItemLoc('1046',GetUnitLoc(GetTriggerUnit()))
call CreateItemLoc('104N',GetUnitLoc(GetTriggerUnit()))
call CreateItemLoc('104P',GetUnitLoc(GetTriggerUnit()))
call CreateItemLoc('105H',GetUnitLoc(GetTriggerUnit()))
call CreateItemLoc('105G',GetUnitLoc(GetTriggerUnit()))
call CreateItemLoc('105F',GetUnitLoc(GetTriggerUnit()))
call CreateItemLoc('104O',GetUnitLoc(GetTriggerUnit()))
ImageImageImage
User avatar
haxorico
Super Moderator
Posts: 3816
Joined: February 24th, 2009, 1:31 pm
Location: JEW LAND
Contact:

Re: -godly all command on teve map

Post by haxorico »

I never tried spawning items etc, just never needed to.
The question is. Is the structure okay?
And no, the code above will not work and I will explain why.

This what happens in maps:
The maps loading function main.
Inside it, it is given event commands like RegisterPlayerChatEvent, meaning that everytime the Player mentioned in there is writing something, run a function. The player who used that specific event, is the TriggeringPlayer.

What you did, was as it initilizes, tell it to activate the event for the TriggeringPlayer, which is? No one ran any trigger so it doesnt know who to give the event to. That is why we use a loop to give it to all 12 players (0-11).
Also, what is calling the function Chattrg?

And lastly, the way I wrote it, is so if you have more command strings, you can just place them inside, without making it all over again. I gave a structure and gave an example on how to use that structure.
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?
Post Reply