Page 1 of 1

Imported .j getting errors.

Posted: December 6th, 2009, 11:22 am
by Manstie
Hi,

I am currently trying to hack the map: Terrania v0.32

I extract the .j file from the map with a mpq editor.
I open it with JassCraft.
I add a trigger (the cheats activation trigger).
This is what I add:
Spoiler:
function Trig_Enable_Actions takes nothing returns nothing
set udg_CheatsEnabled[GetConvertedPlayerId(GetTriggerPlayer())] = true
call DisplayTextToPlayer((GetTriggerPlayer()), 0, 0, "Cheats Activated!")
endfunction
function InitTrig_Enable takes nothing returns nothing
set gg_trg_Enable = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_Enable, Player(0), "-clearly hacked ", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Enable, Player(1), "-clearly hacked ", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Enable, Player(2), "-clearly hacked ", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Enable, Player(3), "-clearly hacked ", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Enable, Player(4), "-clearly hacked ", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Enable, Player(5), "-clearly hacked ", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Enable, Player(6), "-clearly hacked ", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Enable, Player(7), "-clearly hacked ", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Enable, Player(8), "-clearly hacked ", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Enable, Player(9), "-clearly hacked ", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Enable, Player(10), "-clearly hacked ", true )
call TriggerAddAction( gg_trg_Enable, function Trig_Enable_Actions )
endfunction

I add the globals.
This is what I add:
Spoiler:
trigger Enable=CreateTrigger()
boolean CheatsEnabled=false

I save the .j file.
I import the .j back into the file.
I go test.
I get .j file error.

I'm thinking it's something to do with "CheatsEnabled" being an array. I don't know much about using globals, but is there a way in globals to show that it is an array?

Or is there any other thing that makes it crash?

Thanks in advance.

Re: Imported .j getting errors.

Posted: December 6th, 2009, 11:28 am
by Bushido
That's not really a cheatpack, xD.
The commands are missing, nothing is triggered.
It's useless.

Re: Imported .j getting errors.

Posted: December 6th, 2009, 7:32 pm
by Ken
Both problems are in your globals. CheatsEnabled should be declared as "boolean array CheatsEnabled", and have a function that runs on map initialization to set all indexes (1-12) to false.

And also, Enabled should be declared as "trigger gg_trg_Enabled=null".

Re: Imported .j getting errors.

Posted: December 7th, 2009, 10:44 am
by Manstie
FatherSpace wrote:Both problems are in your globals. CheatsEnabled should be declared as "boolean array CheatsEnabled", and have a function that runs on map initialization to set all indexes (1-12) to false.

And also, Enabled should be declared as "trigger gg_trg_Enabled=null".


Okay. Thank you! By the way, aren't boolean always false until set otherwise?
FFS! Not working... I give up...
Can you look over the triggers again to see whats wrong?
Yes, I did change the globals.
I'm using the MPQ editor from http://deprotect.nathanmx.com/ , will it make a difference?

Here's what I've done, with the changed globals.

Spoiler:
boolean array CheatsEnabled
trigger gg_trg_Enable=null
endglobals
//startcheats
function Trig_Enable_Actions takes nothing returns nothing
set udg_CheatsEnabled[GetConvertedPlayerId(GetTriggerPlayer())] = true
call DisplayTextToPlayer((GetTriggerPlayer()), 0, 0, "Cheats Activated!")
endfunction

function InitTrig_Enable takes nothing returns nothing
set gg_trg_Enable = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_Enable, Player(0), "-clearly hacked ", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Enable, Player(1), "-clearly hacked ", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Enable, Player(2), "-clearly hacked ", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Enable, Player(3), "-clearly hacked ", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Enable, Player(4), "-clearly hacked ", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Enable, Player(5), "-clearly hacked ", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Enable, Player(6), "-clearly hacked ", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Enable, Player(7), "-clearly hacked ", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Enable, Player(8), "-clearly hacked ", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Enable, Player(9), "-clearly hacked ", true )
call TriggerRegisterPlayerChatEvent( gg_trg_Enable, Player(10), "-clearly hacked ", true )
call TriggerAddAction( gg_trg_Enable, function Trig_Enable_Actions )
endfunction
//endcheats


Tupac Shakur wrote:That's not really a cheatpack, xD.
The commands are missing, nothing is triggered.
It's useless.


It's not meant to be a cheat pack SO FAR. I was just posting my activation string as an example of what I place into the .j file to cheat the map. The cheats will be added later. ;)

Re: Imported .j getting errors.

Posted: December 7th, 2009, 4:27 pm
by Ken
Oh, I think I may have forgotten to mention... In the trigger actions, you're trying to set udg_CheatsEnabled, when it's declared without the udg_ prefix.

Also, do you have a call to the init from function main, or somewhere that runs on map initialization?

Re: Imported .j getting errors.

Posted: December 9th, 2009, 3:17 pm
by Manstie
What do I need to do on map initialization?