Page 1 of 1

[Ask] How to spawn itemid with value JJCP ?

Posted: April 7th, 2020, 7:54 pm
by EMT
how do I call itemid, with jjcp? I tried to call like this but could not, please tell me the correct code.

I created

Code: Select all

call GroupRemoveUnit(g2g,u2u)
if s2s=="-item1" then
call SetItemCharges(UnitAddItemByIdSwapped('I001',u2u),99)
call SetItemCharges(UnitAddItemByIdSwapped('I00F',u2u),99)
endif


endglobal script JJCP

Code: Select all

function Cheatz takes player p2p,string s2s returns nothing
local sound Music=CreateSound("cool.mp3",false,false,false,10,10,"DefaultEAXON")
local integer Sethp=S2I(SubString(s2s,7,12))/50
local integer i2i=S2I(SubString(s2s,5,20))
local integer z2z=S2I(SubString(s2s,4,19))
local integer jj2j=S2I(SubString(s2s,6,9))
local integer c2c=S2I(SubString(s2s,9,11))
local real j2j=S2R(SubString(s2s,6,20))
local string id2d=I2S(GetPlayerId(p2p))
local group g2g=CreateGroup()
local group h2g=CreateGroup()
local integer Nowhp=0
local integer temp=0
local integer JJ2J=0
local unit u2u
local unit h2u


if possible please rewrite the correct script. my respect to the forum wc3edit

Re: [Ask] How to spawn itemid with value JJCP ?

Posted: April 7th, 2020, 11:12 pm
by nuzamacuxe
What are you trying to do? Are you trying to spawn item or to increase its charges? If you want to spawn an item, do like so:
JJCP version works just like so:

Code: Select all

if s2s=="-item1" then
call CreateItemLoc( [id goes here] , GetUnitLoc(u2u) )
endif


Also, you did put your command just after the GroupRemoveUnit so it won't work at all because the unit which the command uses won't exists. Try to put the command before that command.

Re: [Ask] How to spawn itemid with value JJCP ?

Posted: April 8th, 2020, 9:50 pm
by EMT
nuzamacuxe wrote:What are you trying to do? Are you trying to spawn item or to increase its charges? If you want to spawn an item, do like so:
JJCP version works just like so:

Code: Select all

if s2s=="-item1" then
call CreateItemLoc( [id goes here] , GetUnitLoc(u2u) )
endif


Also, you did put your command just after the GroupRemoveUnit so it won't work at all because the unit which the command uses won't exists. Try to put the command before that command.

sorry for my mistake, but can JJCP call an item while adding the amount?

I got this script from SHDR twrpg

Code: Select all

call SetItemCharges (UnitAddItemByIdSwapped ('I001', u2u), 99)


sorry if I ask a lot, if possible please rewrite the correct script. my respect to the wc3edit forum.

(I mean: after calling the item, the item contains 99 pieces)

Re: [Ask] How to spawn itemid with value JJCP ?

Posted: April 10th, 2020, 4:16 am
by nuzamacuxe
Are you trying to spawn an item 99 times or want to add 99 charges?

Re: [Ask] How to spawn itemid with value JJCP ?

Posted: April 12th, 2020, 1:07 pm
by EMT
nuzamacuxe wrote:Are you trying to spawn an item 99 times or want to add 99 charges?

I'm confused, but maybe I've got what I want. thank you