• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Item drops

Status
Not open for further replies.
Level 3
Joined
Aug 11, 2007
Messages
42
Hi im making a rpg and i want the creeps to drop specific items (like in defiance) but i can only make them able to drop the once (when they respawn they cant drop it anymore), anyone has a trigger or anything for that?
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
you don't give them an item set, instead you create a trigger like this

Events: A unit dies
Conditions : unit type of dying unit = Yourcreep
Actions: If random integer between 1 and 100 < 20 (this way there's 20% chance to drop the item, you don't need this)
--- Then: set Variable: "TempLoc" = position of dying unit
------ Item - create a "item-type" at "TempLoc"
------ custom script to remove the leak
--- Else: do nothing
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
Well, if you only have one option like here: drop or not drop, you don't need a variable. However, keep in mind that if there are multiple options (e.g. 10% chance to do action A, 10% chance to do action B, 80% chance to do action C), you need to store the random integer in a variable first.
 
Level 3
Joined
Aug 11, 2007
Messages
42
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Random integer number between 1 and 100) Equal to 15
    • Then - Actions
      • Region - Center ITEM <gen> on (Position of (Dying unit))
      • Item - Create Gnoll Club at (Center of ITEM <gen>)
    • Else - Actions
would this work or do i need a variable?? cus i tried with variable and it didnt work
 
Level 9
Joined
Jun 26, 2007
Messages
659
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Random integer number between 1 and 100) [COLOR="Red"]not greater than[/COLOR] 15 [COLOR="SeaGreen"]// if you want 15%, your's was 1%[/COLOR]
    • Then - Actions
      • Set PositionVariable = (Position of (Dying unit)) [COLOR="seagreen"]// you need a variable to prevent memory leak[/COLOR]
      • Item - Create Gnoll Club at PositionVariable [COLOR="SeaGreen"]// = create Gnoll Club at position of dying unit[/COLOR]
      • Custom script : call RemoveLocation( udg_PositionVariable ) [COLOR="seagreen"]// here you remove the used point from the memory[/COLOR]
    • Else - Actions
And so, you don't need the "ITEM" Region
 
Level 3
Joined
Aug 11, 2007
Messages
42
hehe aha ty for the help man

-edit-
got a problem... when i try to save with thecustom script it only says exepting a name
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
custom scripts are very case-sensitive. Make sure the variable you use (PositionVariable in the exampletrigger) is a POINT variable. Make absolute sure that the variable used in the custom scripts is exactly the same name as the other one.

For example:
set VariableName = position of dying unit
Custom script: call RemoveLocation( udg_Variablename) will not work because I forgot the capital letter "N" in VariableName.
 
Level 6
Joined
May 3, 2006
Messages
81
Why dont u just create the item at the position of dying unit?

A unit dies

unit = ur unit <<< this isnt needed

create 1 Potion of Health at position of dying unit
(OR what I use for my RPG's is create 1 random artifact of level 8)
and set all the items I use to lvl 8 artifacts so the unit will drop one of them and you can even check the level of the dying unit or life and drop an item from a group that fits the unit, peasant drops mantle of intelligence, ogre drops boots of speed.
 
Level 3
Joined
Aug 11, 2007
Messages
42
Why dont u just create the item at the position of dying unit?

A unit dies

unit = ur unit <<< this isnt needed

create 1 Potion of Health at position of dying unit
(OR what I use for my RPG's is create 1 random artifact of level 8)
and set all the items I use to lvl 8 artifacts so the unit will drop one of them and you can even check the level of the dying unit or life and drop an item from a group that fits the unit, peasant drops mantle of intelligence, ogre drops boots of speed.

that might work^^ takes all the annoying custom scirpts away (still doesnt work..)
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
The whole point of the custom scripts are (mainly) to remove memory leaks. If you don't remove those leaks, your map will start lagging after some time, especially if you run this trigger frequently.

Feel free not to use custom scripts to remove leaks, I'm just warning you that your map will lag terribly after some time.
 
Status
Not open for further replies.
Top