Make spawned units drop items

K

Kilrothy7

Guest
I have no clue how to make units drop items, I have created an item table and I have turned on the unit drops items when killed tag, I can make my already created units drop items. But that is about it. Anyone know how to do this?
 

Jazradel

Helping people do more by doing less.
Reaction score
102
You have to use a piece of Jass Code. Or you can download Persen Edit(search for it) and that has a GUI option for adding an item table to a spawned unit.
 

Lord Kass

Active Member
Reaction score
2
Code:
Creep Item
Events - A unit Dies
Conditions - Owner of Dying Unit Equal to (The Player That Owns Your Spawned Units)
Actions - If all Conditions Are True then do Actions else do Actions
                 If - Conditon
                 If unit type of triggering unit equal to (put any unit type here)
                 Then - Actions
                 If all Conditions Are True then do Actions else do Actions 
                     If - Conditon
                     Random integer between 1 and 100 Less than 23
                     Then - Actions
                     Create (Your item)  at Position of Triggering Unit
                     Else - Actions
                     Do Nothing
                 Else - Actions
                 Do Nothing

The Random Integer between..... here is for like percentage or something so your spawned unit dont drop items always when your spawned unit dies

Reply if you cant understand of having trouble creating this trigger.
 

xPheRe

New Member
Reaction score
43
Create a trigger like this one
Code:
[b]Item table 1[/b]
Events
Conditions
Actions
    Set ItemSpawn[0] = Scroll of Town Portal
    Set ItemSpawnValue[0] = 7
    Set ItemSpawn[1] = Ank of Resurrection
    Set ItemSpawnValue[1] = 2
    Set ItemSpawn[2] = Protection Ring +5
    Set ItemSpawnValue[2] = 1
    Set ItemSpawnTotal = 7 + 2 + 1
    Run Spawn an item from table
Code:
[b]Spawn an item from table[/b]
Events
Conditions
Actions
    Set iTmp = (Random integer number between 1 and ItemSpawnTotal)
    Set ItemSpawnIndex = 0
    Custom script: loop
    Set iTmp = (iTmp - ItemSpawnValue[ItemSpawnIndex])
    Custom script: exitwhen udg_ItemSpawnTotal <= 0
    Set ItemSpawnIndex = (ItemSpawnIndex + 1)
    Custom script: endloop

    Set pTmp = Position of (Dying unit)
    Create ItemSpawn[ItemSpawnIndex] at pTmp
    Custom script: call RemoveLocation(udg_pTmp)
Code:
[b]Variables needed:[/b]
iTmp => Integer
pTmp => Point
ItemSpawnIndex => Integer
ItemSpawn => Item-type array
ItemSpawnValue => Integer array
ItemSpawnTotal => Integer
Then when you spawn a unit that can drop a item when die, use this
Code:
If Random integer between 0 and 100 lesser than 15 then
    Add to (Item Table 1) the event (Unit - (Last created unit) Dies)
 
K

Kilrothy7

Guest
Thanks for the help on the subject .. I just figured that the system would take better advantage of the item tables already built in. I am trying to get the persen edit to work currently. Just getting it to initialize is a problem and I know it is something simple. in the readme it says:Copy the contents of "PersenEdit mapscript.txt" to you map's custom script." Does this mean that I need to make an action in the map initialization with the run script? If so, I get an error when attempting to save the map.
 

Jazradel

Helping people do more by doing less.
Reaction score
102
I attached my customized version of PersenScript for you. Just move the UI folder into your Warcraft III directory.
Then open the map script(ModMap Script.rtf), select all, copy it to your maps custom script. Then create a game cache variable called HandleVariables. Then create the dummy unit like in the instuctions. And your all readly to use the additional features :).
 
K

Kilrothy7

Guest
Jazradel said:
Then open the map script(ModMap Script.rtf), select all, copy it to your maps custom script. Then create a game cache variable called HandleVariables. Then create the dummy unit like in the instuctions.

What I think my problem is, is that I don't know how to copy anything to my "maps custom script" If I try to use the action "cutom script" I only get one line of code to enter... which isn't enough charicters. Sorry if this is a simple question but I just completely miss the option

Jazradel said:
Then create the dummy unit like in the instuctions.
As far as creating a dummy unit this is the first I have heard of needing one for the initialization to work.

Ill cut and paste the whole set of instructions that came with persen edit:
//====================================================================
PERSEN'S WORLD EDITOR PATCH README
//====================================================================

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
===I TAKE NO RESPONIBILITY FOR ANY ERRORS THAT MIGHT BE CAUSED BY THIS PATCH===
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

==================INSTALLATION================

WIN & MAC: Just unzip the archive into your Warcraft III folder.

==================UNINSTALLATION==============

WIN: Run "Uninstall PersenEdit" in your Warcraft III folder.
MAC: Delete the "UI" folder, the "PersenEdit" map file and this file.

==================UNPATCH WE==================

WIN: To restore the original WE, close the editor, and run "Restore WE" in the Warcraft III Folder.
MAC: Change the name of the UI folder inside the War3 folder to something else, like UI2 or PatchData.

==================RE-PATCH WE=================

WIN: To re-patch the World Editor, close the editor, and run "Patch WE" in the Warcraft III Folder.
MAC: Revert the name of the UI folder to "UI"

==================RUN PERSEN EDIT=============

WIN & MAC: To run the patched WE, just start the World Editor as usual. To unpatch the editor, follow the steps above.

==================HOW TO USE==================

To use the triggers named "Advanced -", you have to
1. Copy the contents of "PersenEdit mapscript.txt" to you map's custom script.
2. Add the action "Init Advanced" to your map init trigger.
3. Create a global game cache variable named zz_cache.

==================NOTES=======================

If you use any of the actions marked with #PERSEN#, you will be unable to open that map with any other editor (Including original WE, WEU, and UMSWE) unless you convert those triggers into custom text.


Anyway ... I am going out for the day today so I will revisit this tomarrow .. since it is a holiday

Merry Christmas
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,497
> I don't know how to copy anything to my "maps custom script".

In the Trigger Editor, click on your map's name (at the very top of the trigger list)...
 
K

Kilrothy7

Guest
Thanks a bunch Ace, I just got in from my christmas party and got your message .. man I knew it was something simple... Not enough sleep in me to work on the map atm but I am one step closer to my goal now ... only thing left is to set up this supposed "make spawned unit drop item from user created item table." looking at it before I didn't see this trigger... I still think it is very silly that the editor completely lacks this function without typing up some jass or creating an over complicated 3 page long trigger.

I probably won't be working on my map tomarrow but I am sure I will end up needing further help on the subject.

G'night
 
P

Persen

Guest
Jazradel said:
I attached my customized version of PersenScript for you. Just move the UI folder into your Warcraft III directory.
Then open the map script(ModMap Script.rtf), select all, copy it to your maps custom script. Then create a game cache variable called HandleVariables. Then create the dummy unit like in the instuctions. And your all readly to use the additional features :).
May i ask... What did you customize???
 
K

Kilrothy7

Guest
Ok guys .. this is my trigger I am using to deal with item drops. coupled with a closed off section of the map (using dodads). The new question is .. will this cause a significant memory leak and is it a good enough trigger? I am happy with it thus far .. seems to be working perfectly





Code:
Item drop
    Events
        Unit - A unit Dies
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Unit-type of (Dying unit)) Equal to Footmantest
            Then - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Random integer number between 1 and 100) Less than 16
                    Then - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (Random integer number between 1 and 10) Greater than 1
                            Then - Actions
                                Item - Create (Item-type of (Random item in 10percent <gen>)) at (Position of (Dying unit))
                            Else - Actions
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        (Random integer number between 1 and 10) Greater than 1
                                    Then - Actions
                                        Item - Create (Item-type of (Random item in 4Percent <gen>)) at (Position of (Dying unit))
                                    Else - Actions
                                        Item - Create (Item-type of (Random item in 1Percent <gen>)) at (Position of (Dying unit))
                                Item - Create (Item-type of (Random item in 10percent <gen>)) at (Position of (Dying unit))
                    Else - Actions
                        Do nothing
            Else - Actions
                Do nothing
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top