[JASS] JJCP: NewGen

Cheatpacks and learning how to use them, as well as other guides for manipulating maps.

Moderator: Cheaters

crazyaddict1
Junior Member
Posts: 30
Joined: October 26th, 2019, 11:54 am

Re: [JASS] JJCP: NewGen

Post by crazyaddict1 »

throw the full list of pliz commands.
owner123
Super Moderator
Posts: 1943
Joined: February 3rd, 2009, 11:28 pm

Re: [JASS] JJCP: NewGen

Post by owner123 »

User avatar
haxorico
Super Moderator
Posts: 3190
Joined: February 24th, 2009, 1:31 pm
Location: JEW LAND

Re: [JASS] JJCP: NewGen

Post by haxorico »

owner123 wrote:Because copying units was never programmed:

Code: Select all

function CopyHero takes unit source, integer uid, real locX, real locY returns nothing
local integer pid = GetPlayerId( GetOwningPlayer( source ) )
local real facing = GetUnitFacing( source )
	if uid == 0 then
		set uid = GetUnitTypeId( source )
	endif
	if IsUnitType( source, UNIT_TYPE_HERO ) then
		set bj_lastCreatedUnit = CreateUnit( Player( pid ), uid, locX, locY, facing )
		call CopyStats( source, bj_lastCreatedUnit )
		call CopyItems( source, bj_lastCreatedUnit )
		call CopyState( source, bj_lastCreatedUnit )
	endif
endfunction
I think it can be updated like this:

Code: Select all

function CopyHero takes unit source, integer uid, real locX, real locY returns nothing
local integer pid = GetPlayerId( GetOwningPlayer( source ) )
local real facing = GetUnitFacing( source )
	if uid == 0 then
		set uid = GetUnitTypeId( source )
	endif
	if IsUnitType( source, UNIT_TYPE_HERO ) then
		set bj_lastCreatedUnit = CreateUnit( Player( pid ), uid, locX, locY, facing )
		call CopyStats( source, bj_lastCreatedUnit )
		call CopyItems( source, bj_lastCreatedUnit )
		call CopyState( source, bj_lastCreatedUnit )
	else
		set bj_lastCreatedUnit = CreateUnit( Player( pid ), uid, locX, locY, facing )
	endif
endfunction
Not sure which version you are refering to.. Copy used to copy all units an # amount of times.
So if you select 2 footmen and 3 riflemen and use "-copy 2". Each SELECTED unit would be copy twice.
So you will endup having 6 footmen and 9 riflemen (4 new footment and 6 new riflemen)

Code: Select all

if SubString(s2s,0,5)=="-copy" and SubString(s2s,6,7)!="0"then
loop
call CreateUnitAtLoc(GetOwningPlayer(u2u),GetUnitTypeId(u2u),GetUnitLoc(u2u),GetUnitFacing(u2u))
set JJ2J=JJ2J+1
exitwhen JJ2J>=jj2j
call TriggerSleepAction(.001)
endloop
call RemoveLocation(GetUnitLoc(u2u))
endif
<-- This code was taken from FatherSpace's (Ken's) version of the update cheatpack back in who knows when... (cant remember the patch that broke most maps)
Kugrox
Member
Posts: 55
Joined: March 9th, 2008, 8:13 pm
Title: Demonoid Hacker
Location: Ask me personally.

Re: [JASS] JJCP: NewGen

Post by Kugrox »

I'm trying to add this cp to a map, first map i've tried to edit since reforged hit.
But the map im editing doesnt have endglobals in the .j
I tried dropping it just before function main with no luck.

where do I insert end globals if there are no end globals?
This .j im using looks nothing like anything ive ever seen on wc3 before, nothing looks familiar.

So is this code compatible with .j's written different, for example im seeing a lot of Ceres whatever that means. no traditional globals, no traditional end globals, and the function main is literally like one line, all the locals are at the top of the .j

curently trying to find familiar places to stick the end globals and hope for the best, any tips?
User avatar
nuzamacuxe
Also Not an Admin, but closer than devoltz
Posts: 1655
Joined: February 14th, 2018, 5:35 am
Title: Just Another S.Mod

Re: [JASS] JJCP: NewGen

Post by nuzamacuxe »

Post it so we can take a look
User avatar
nuzamacuxe
Also Not an Admin, but closer than devoltz
Posts: 1655
Joined: February 14th, 2018, 5:35 am
Title: Just Another S.Mod

Re: [JASS] JJCP: NewGen

Post by nuzamacuxe »

NewGen updated.

Code has been improved.
Mescadude
Newcomer
Posts: 7
Joined: April 10th, 2022, 7:07 am

Re: [JASS] JJCP: NewGen

Post by Mescadude »

Just as autoh, how do i do it for mana?
Skills like immolation that drains mana doesnt work with -nomana
User avatar
3nemy_
Cheater
Posts: 133
Joined: November 21st, 2016, 6:50 pm

Re: [JASS] JJCP: NewGen

Post by 3nemy_ »

I need some help with adding custom commands. I know how to create commands in original JJCP but not this one or NZCP so I took a peek at some old maps you created commands for. :D
I think I found the right variable and I tried to copy your format but it just breaks the map.

Code: Select all

function CustomCommandsHandler takes nothing returns nothing
local integer pid = GetPlayerId(GetTriggerPlayer())
local integer value = 0
local string text = SubString( GetEventPlayerChatString(), 1, StringLength(GetEventPlayerChatString()) )
local integer emptyAt = FindEmptyString( 0, text )
local string command = SubString( text, 0, emptyAt )
local string payload = SubString( text, emptyAt + 1, StringLength(GetEventPlayerChatString()) )
set value = S2I( payload )
if command == "addph" then
	call udg_playedseconds(Player( pid ) , value)
	endif
endif
endfunction
function CC_Init takes nothing returns nothing
call ChatEvent( CreateTrigger( ), "-", false, function CustomCommandsHandler )
endfunction
function main takes nothing returns nothing
call Fukki_CP_Config()
call ExecuteFunc( "Init_NewGen" )
call ExecuteFunc( "CC_Init" )

E.g. I am trying to create CC for playtime, in old JJCP you would find the integer and convert it to string via I2S function and write parameters where to find said string (s2s, number, number) right.
But here, I'm completely lost, the S2I function won't convert my command string back to integer, i'm missing some piece of information but I can't tell what.
I have barely any jass knowledge so maybe it's something easy but I'm simply not seeing it.

Here's how I did it in original JJCP:

Code: Select all

elseif SubString(s2s,0,8)=="-addtime"then
set udg_playedseconds[GetConvertedPlayerId(p2p)]=S2I(SubString(s2s,9,16))
User avatar
nuzamacuxe
Also Not an Admin, but closer than devoltz
Posts: 1655
Joined: February 14th, 2018, 5:35 am
Title: Just Another S.Mod

Re: [JASS] JJCP: NewGen

Post by nuzamacuxe »

Code: Select all

if command == "addph" then
   call udg_playedseconds(Player( pid ) , value)
   endif
endif
There's an additional endif. Remove it. Is udg_playerseconds a variable? If so:

Code: Select all

if command == "addph" then
   set udg_playedseconds[pid+1]=value
endif
Do not use "call" to change variables directly. "call" is used for FUNCTIONS.

GetConvertedPlayerId is just a GetPlayerId with a +1 at the end so that's why I added +1 instead of just "pid".
User avatar
3nemy_
Cheater
Posts: 133
Joined: November 21st, 2016, 6:50 pm

Re: [JASS] JJCP: NewGen

Post by 3nemy_ »

That was just a template I took from other map, I tried both with "set" and "call" and played around with pid+1 but to no avail.
The thing that confuses me is:

Code: Select all

set udg_mathishard=(udg_playedseconds[GetConvertedPlayerId(ConvertedPlayer(S2I(udg_text)))]/ 60)
set udg_mathisdumb=(udg_mathishard/ 60)
call DisplayTextToForce(GetPlayersMatching(Condition(function Trig_infocheck_Func002Func010001001)),(I2S(udg_mathisdumb)+"hours game time"))

So I found out playedseconds is integer array, the other 2 are integers.
In old JJCP I managed to add time in seconds but not for hours.
I looked up some other maps that have CC and integer array variable is always inside I2S bracket if that makes sense but in my case that one is normal integer.
I tried all 3 variables in JJCP NG and NZCP and none of them worked.


E.g. this is some Russian map I found with CC in it, functions, variables, triggers are all scrambled but you can easily find variable by searching TriggerRegisterPlayerChatEvent and TriggerAddAction in -info function, both which are scrambled but nonetheless lead to time played function.
So all they did was copy entire call into their CC statement.
In my scenario that doesn't work because my statement is missing GetPlayerName and ID so PID+1 can't locate it I guess?
I don't know how to deal with this part "(Condition(function Trig_infocheck_Func002Func010001001)", deleting it just breaks the map.

Code: Select all

f Command == "settime" then
    set LIL111[1+PID]=Value
    call DisplayTimedTextToPlayer(GetLocalPlayer(),0.,0.,10.,IIII11[GetConvertedPlayerId(Player(LIIII1))]+GetPlayerName(Player(LIIII1-1))+": |r|c000080C0играет уже|r  "+I2S(LIL111[LIIII1]+4)+" |c000080C0minute(s)|r")

I'm extremely sorry for going in such details but I put way too much into this and I'm a bit frustrated by this point. :neutral: