wc3edit.net

United Warcraft 3 map hacking!
It is currently April 19th, 2024, 10:36 pm

All times are UTC




Post new topic Reply to topic  [ 24 posts ]  Go to page 1, 2, 3  Next
Author Message
PostPosted: November 30th, 2011, 1:59 am 
Offline
Old Wrinkly Member
User avatar

Joined: April 19th, 2009, 12:46 pm
Posts: 234
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


Top
 Profile  
 
PostPosted: November 30th, 2011, 2:17 am 
Offline
Senior Member
User avatar

Joined: September 25th, 2011, 1:15 pm
Posts: 158
Title: Slacking
Code:
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:
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"


Top
 Profile  
 
PostPosted: November 30th, 2011, 2:31 am 
Offline
Old Wrinkly Member
User avatar

Joined: April 19th, 2009, 12:46 pm
Posts: 234
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


Top
 Profile  
 
PostPosted: November 30th, 2011, 4:23 am 
Offline
Senior Member
User avatar

Joined: September 25th, 2011, 1:15 pm
Posts: 158
Title: Slacking
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:
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:
    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"


Top
 Profile  
 
PostPosted: November 30th, 2011, 5:13 am 
Offline
Forum Staff

Joined: October 27th, 2009, 12:18 pm
Posts: 1108
Location: Australia, GMT+8
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.


Top
 Profile  
 
PostPosted: November 30th, 2011, 5:53 am 
Offline
Super Moderator
User avatar

Joined: February 24th, 2009, 1:31 pm
Posts: 3815
Location: JEW LAND
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:
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:
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: November 30th, 2011, 5:56 am 
Offline
Senior Member
User avatar

Joined: September 25th, 2011, 1:15 pm
Posts: 158
Title: Slacking
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"


Top
 Profile  
 
PostPosted: November 30th, 2011, 5:59 am 
Offline
Super Moderator
User avatar

Joined: February 24th, 2009, 1:31 pm
Posts: 3815
Location: JEW LAND
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:
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:
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: November 30th, 2011, 6:00 am 
Offline
Old Wrinkly Member
User avatar

Joined: April 19th, 2009, 12:46 pm
Posts: 234
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


Top
 Profile  
 
PostPosted: November 30th, 2011, 8:09 am 
Offline
Super Moderator
User avatar

Joined: February 24th, 2009, 1:31 pm
Posts: 3815
Location: JEW LAND
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:
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  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 24 posts ]  Go to page 1, 2, 3  Next

All times are UTC


Who is online

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