[ask]how to make a simple CP

General talk about editing, cheating, and deprotecting maps.

Moderator: Cheaters

User avatar
EMT
Junior Member
Posts: 38
Joined: April 4th, 2020, 5:25 pm

[ask]how to make a simple CP

Post by EMT »

I want to ask how to make a simple cheatpack, I only need 1 command. items with the function of calling item charges like this

Code: Select all

if dev_cmd == "- candies" then
call SetItemCharges (UnitAddItemByIdSwapped ('sres', dev_unit), 99)
call SetItemCharges (UnitAddItemByIdSwapped ('totw', dev_unit), 99)
call SetItemCharges (UnitAddItemByIdSwapped ('wild', dev_unit), 99)
endif


and i think dev_cmd is a function of the command, how do I make the same function?
i mean like this

Code: Select all

the dev_cmdz function takes player p1, string s1 returns nothing
local integer dev_value
local integer i = 0
local string dev_cmd
local string dev_chat = GetEventPlayerChatString ()
local integer dev_length = StringLength (dev_chat)
local unit dev_unit
local group dev_group = CreateGroup ()
local region remove_region = CreateRegion ()
local rect remove_rect = Rect (20320, -6592,23456, -12032)
local player dev_trig = GetTriggerPlayer ()
local string dev_string
set dev_unit = FirstOfGroup (dev_group)
call RegionAddRect (remove_region, remove_rect)
the loop


what is lacking from the function that I am trying to make
for function

Code: Select all

function cp_command takes player p1, string s1 returns nothing
local string c_comand
local unit c_unit
local group c_group=CreateGroup()
set c_unit=FirstOfGroup(c_group)


for call command

Code: Select all

if c_comand == "- candies" then
call SetItemCharges (UnitAddItemByIdSwapped ('sres', c_unit), 99)
call SetItemCharges (UnitAddItemByIdSwapped ('totw',c_unit), 99)
call SetItemCharges (UnitAddItemByIdSwapped ('wild', c_unitt), 99)
endif

if possible please make it easier, how to make it. I am a beginner in this field. sorry if troublesome. Thank you my respect to the wc3edit.net forum
owner123
Super Moderator
Posts: 1943
Joined: February 3rd, 2009, 11:28 pm

Re: [ask]how to make a simple CP

Post by owner123 »

In addition to programming the functions, you also need to add code to the function main in order to initialize those functions with a trigger + event. And you'll nee to add all your custom variables in the globals section.

I recommend you make a new map in the world editor, program your cheatpack in basic triggers (gui or jass, doesn't matter, this is a learning exercise) and then open up the map and extract the war3map.j.

Take a look at the globals/endglobals/function main section and observe how the world editor compiled your code. You need an understanding of that compilation before you can write your own cheatpack from scratch.