• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

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