• 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.

[Solved] I need help with the creation of a trigger.

Status
Not open for further replies.
Level 4
Joined
Jan 14, 2005
Messages
73
So I have a trigger that re-spawns my Creeps in their original locations, I'm using Skirks Trigger thats here > http://www.hiveworkshop.com/forums/trigger-gui-editor-tutorials-279/creep-respawn-gui-65987/

It does the re-spawning fine. However I don't want the Same Creeps to spawn all the time, so I decided to have multiple levels of each type of creep. Kind of like the Diablo 2, (Common, Uncommon, Rare, Etc)

What I would like to have help with is modifying Skirks Spawning system, so that when it re-spawns said unit, that unit has a chance to be One of the more Rare Types. For example


I have 3 Creeps all called Wolf (I have already made Multiple Units for this)

Wolf (Common)
Wolf (Uncommon)
Wolf (Rare)

I want it to spawn the Common wolf 90% of the time, uncommon 9% of the time and rare 1% of the time. How can I accomplish this and still be able to easily encorporate it into a drop system.

I would also like to setup my variables in this way:

Set Creature_Type[0] = Wolf (Common)
Set Creature_Type[1] = Wolf (Uncommon)
Set Creature_Type[2] = Wolf (Rare)
Set Creature_Type[3] = Bird (Common)
Set Creature_Type[4] = Bird (Uncommon)
Set Creature_Type[5] = Bird (Rare)

I Know this is fairly complicated, As such Im asking for some help or Ideas. I have one But Im not sure its very Effecient,

When Creep is Spawned, Generate random Number, If that Number = 1to90 out of 100 and Creep Spawned is != Common then Kill Creep and Spawn Common. (if its 91 to 99 then spawn uncommon Else spawn Rare)

The problem with that is then I would have to be constantly Storing newly Created Creatures inside Skirks Variables and not only that but I believe it would be slower then it needs to be.

If anyone has any questions on what I want please post so that I Know where this is more confusing lol.

Thanks In advance for any help.
 
Level 7
Joined
Feb 9, 2010
Messages
298
Why don't you ask the creator of the Trigger you are using for help?
Also for permission to make changes to his trigger!

Yep, you can also put it that way! :)
 
Last edited:
Level 8
Joined
Jan 8, 2010
Messages
493
from what i understood in Skirk's tutorial, the spawned units are the same as the units that died. you can create a Unit Type variable (eg. SpawnType). before spawning them, you can add an if-then-else and set the SpawnType to the type of unit you will spawn.

i don't understand JASS, so i'll be taking the Standard Triggering as the example

  • Respawn
  • Events
    • Unit - A unit Dies
  • Conditions
    • (Owner of (Triggering unit)) Equal to Neutral Hostile
    • (Custom Value of (Triggering unit)) Greater than 0
    • Or - Any (Conditions) are true
      • Conditions
        • (Unit-type of (Triggering unit)) Equal to Creature_Type[0]
        • (Unit-type of (Triggering unit)) Equal to Creature_Type[1]
        • (Unit-type of (Triggering unit)) Equal to Creature_Type[2]
  • Actions
    • Set RandomValue = (Random integer number between 1 and 100)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • RandomValue Less than or equal to 90
      • Then - Actions
        • Set SpawnType = (Unit-type of Creature_Type[0])
      • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • RandomValue Greater than 90
            • RandomValue Less than or equal to 99
          • Then - Actions
            • Set SpawnType = (Unit-type of Creature_Type[1])
          • Else - Actions
            • Set SpawnType = (Unit-type of Creature_Type[2])
    • Wait Respawn_Time game-time seconds
    • Unit - Create 1 (Unit-type of SpawnType) for Neutral Hostile at Creep_Point[(Custom value of (Triggering unit))] facing Default building facing (270.0) degrees
    • Unit - Set the custom value of (Last created unit) to (Custom value of (Triggering unit))
@Player
i think he's not necessarily changing Skirk's trigger, but modifying it to suit his map.
 
Level 11
Joined
Nov 15, 2007
Messages
800
  • Respawn
  • Events
    • Unit - A unit Dies
  • Conditions
    • (Owner of (Triggering unit)) Equal to Neutral Hostile
    • (Custom Value of (Triggering unit)) Greater than 0
    • Or - Any (Conditions) are true
      • Conditions
        • (Unit-type of (Triggering unit)) Equal to Creature_Type[0]
        • (Unit-type of (Triggering unit)) Equal to Creature_Type[1]
        • (Unit-type of (Triggering unit)) Equal to Creature_Type[2]
  • Actions
    • Set RandomValue = (Random integer number between 1 and 100)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • RandomValue Less than or equal to 90
      • Then - Actions
        • Set SpawnType = (Unit-type of Creature_Type[0])
      • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • RandomValue Greater than 90
            • RandomValue Less than or equal to 99
          • Then - Actions
            • Set SpawnType = (Unit-type of Creature_Type[1])
          • Else - Actions
            • Set SpawnType = (Unit-type of Creature_Type[2])
    • Wait Respawn_Time game-time seconds
    • Unit - Create 1 (Unit-type of SpawnType) for Neutral Hostile at Creep_Point[(Custom value of (Triggering unit))] facing Default building facing (270.0) degrees
    • Unit - Set the custom value of (Last created unit) to (Custom value of (Triggering unit))

That trigger sets SpawnType to the type of unit of the last unit to die. You'd have wolves respawning as zombies and all sorts of general disorder.


OP, have you considered just increasing the stats/size/changing appearance (via vertex color/special effects attachments)/adding or improving abilities for rare spawns? It seems like it'd be the easiest solution.
 
Level 8
Joined
Jan 8, 2010
Messages
493
my sample simply means he will have to do additional triggers for it, or have the condition
  • (Unit-type of (Triggering unit)) Equal to Creature_Type[0]
  • (Unit-type of (Triggering unit)) Equal to Creature_Type[1]
  • ...
  • ...
under the Actions section and have many if-then-else's.

i barely understood Skirk's tutorial, but with regards to what he wants, he will have to set the type of the spawning unit to a variable and make that variable the unit type that is supposed to be spawned, which is why i set SpawnType to a Unit Type.
 
Level 4
Joined
Jan 14, 2005
Messages
73
Ok first off I am going to be using this trigger on my map, I dont intend to release it as my own (I might send a copy to skirk though in case he wants to post it).

Second Off Ronojales Thats the Idea I want However Meticulous has it right, I dont want things like Zombies Spawning In the Place where the Wolfs should be.

Thirdly I do not understand Hashtables nor do I know thier use. Is it essentially a table that would look somthing like this?
[a][c][d]
[1][z][z][z][z]
[2][z][z][z][z]
[3][z][z][z][z]
[4][z][z][z][z]

Z being the Data, abcd and 1234 being the Reference Numbers? (So hashtable would be a MultiDimensional Array?) Or do i have that all wrong.

My Main Problem Is what Math would I use if theres 3 Unit-Types for each Creature, And 2 Variables Looking Something like this

Creatures_UnitType[1] = Wolf (Common)
Creatures_UnitType[2] = Wolf (Uncommon)
Creatures_UnitType[3] = Wolf (Rare)
Creatures_UnitType[4] = Bird (Common)
Creatures_UnitType[5] = Bird (Uncommon)
Creatures_UnitType[6] = Bird (Rare)

CreatureName_String[1] = Wolf
CreatureName_String[2] = Bird

To properly Pick and Spawn a unit of the Same String, What should I do?

This Is what I want the Trigger to look like, I do not know how to set it up to work with Skirks Spawn System, If theres an easier way to do it in jass Please let me know (I have no idea how to use jass (Well I know how to put it into my map but I dont know how to Call functions Or get the map to save with it without JassNewgen Telling me theres something wrong with it))

  • UnitSpawn
    • Events
    • Conditions
    • Actions
      • Set RandomNumber = (Random integer number between 1 and 100)
        • Do Multiple ActionsFor each (Integer A) from 1 to 10, do (Actions)
          • Loop - Actions
            • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Name of (Triggering unit)) Equal to (==) CreatureName_String[(Integer A)]
              • Then - Actions
                • Set Temp_Integer = (Integer A)
              • Else - Actions
      • Set Temp_Integer_CreatureToBeSpawn = (Temp_Integer x 3)
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • RandomNumber Less than (<) 91
          • Then - Actions
            • Set Temp_Integer_CreatureToBeSpawn = (Temp_Integer_CreatureToBeSpawn - 2)
          • Else - Actions
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • RandomNumber Less than (<) 100
            • RandomNumber Greater than or equal to (>=) 91
          • Then - Actions
            • Set Temp_Integer_CreatureToBeSpawn = (Temp_Integer_CreatureToBeSpawn - 1)
          • Else - Actions
The above is what I would like my Trigger to look like.
@Ronojales:
Thanks for the Trigger Rono, Im still trying to figure out how to implement it into skirks trigger though. I basically want to create a gui trigger that I can CALL to spawn instead of using skirks "Create Unit". So Il probably have to create 2 more variables instead of using skirks local i and ii.

@-Kobas-:
Id appreciate the help if you would be so kind as to show me this jass related script?

PS: Please take note that I have modified Skirks Trigger, Im not sure If im allowed to post it just so you guys can see it? Its Respawn time is 10Minutes and it wont respawn Creatures until the unit that killed them is outside a region the size of 1000x1000.
So The trigger I create needs to be able to keep that as well (thats Why I would prefer to call another Trigger to run when Skirks would be "Create unit". Im gonna Fool Around With the Triggers and see if i can make it work.

Since after I get it working Il be starting on a Save/Load Trigger...(only going to save Stats/Hero/Level/Items at first) That should be fun, Unless someone knows of one thats already somewhere on the site that allows for MultiEntry Load Commands (The Save code is going to be roughly 2-4 Full Chat Boxes (Im unsure yet as Im not 100% on which data will be getting saved (I know Im saving Stats, Level, Gold, Subclass, Hero, Quests Completed, Pet, Pet Spell(s), Hero Items, Pet Items. Il be Recommending People Use GameCapture for saving) Its gonna be a pretty big Orpg I plan to make a Second Map if theres enough Interest in this one).
 
Last edited:
Level 3
Joined
Nov 16, 2011
Messages
54
I can create for you GUI creep respawn system. I already have created one but it's making the map size few kb bigger. Yet this weekend i may create fully triggered creep respawn system for GUI that can respawn the creeps at their starting points no matter how much time have passed. Yet it's always good to try creating one yourself watching from others because as you know this is like reading "book". it's very hard to gain knowledge if you haven't read/seen it from somewhere. :wink:

Edit: When you are browsing the forums if you see post by My Idol read it careful he is a smart person also Bribe is one of the smart guys in here. I have learn a lot from those 2 :)
 
Level 4
Joined
Jan 14, 2005
Messages
73
@Kadabra:
Well the thing Is I already have the creeps respawning Fine, I just need them to spawn 1/4 different creeps.

EG Wolf Would be Spawned at Original Placement Location, I want that wolf to be 1 of 4 Different Wolfs. And I need it to work for multiple Creeps.

Can Someone Verify That This Trigger Will Not Cause Bugs? and tell me how to restart unit spawn timer if player is next to thier spawn point?
  • Creep Respawn Part 2
    • Events
      • Unit - A unit owned by Neutral Hostile Dies
    • Conditions
      • (Custom value of (Triggering unit)) Greater than (>) 0
    • Actions
      • Custom script: local integer i
      • Custom script: local integer ii = GetUnitUserData(GetTriggerUnit())
      • Set Temp_Point = (Position of (Triggering unit))
      • Set DeadUnitRegion[(Player number of (Owner of (Killing unit)))] = (Region centered at Temp_Point with size (1000.00, 1000.00))
      • Wait until ((DeadUnitRegion[(Player number of (Owner of (Killing unit)))] contains (Killing unit)) Equal to (==) False), checking every 10.00 seconds
      • Wait (Respawn_Time x 60.00) game-time seconds
        • Do Multiple ActionsFor each (Integer A) from 1 to 10, do (Actions)
          • Loop - Actions
            • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Name of (Triggering unit)) Equal to (==) CreatureName_String[(Integer A)]
              • Then - Actions
                • Set Temp_Integer = (Integer A)
              • Else - Actions
      • Set RandomNumber = (Random integer number between 1 and 100)
      • Set Temp_Integer_CreatureToBeSpawn = (Temp_Integer x 4)
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • RandomNumber Less than or equal to (<=) 79
          • Then - Actions
            • Set Temp_Integer_CreatureToBeSpawn = (Temp_Integer_CreatureToBeSpawn - 3)
          • Else - Actions
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • RandomNumber Less than or equal to (<=) 89
            • RandomNumber Greater than or equal to (>=) 80
          • Then - Actions
            • Set Temp_Integer_CreatureToBeSpawn = (Temp_Integer_CreatureToBeSpawn - 2)
          • Else - Actions
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • RandomNumber Less than or equal to (<=) 94
            • RandomNumber Greater than or equal to (>=) 90
          • Then - Actions
            • Set Temp_Integer_CreatureToBeSpawn = (Temp_Integer_CreatureToBeSpawn - 1)
          • Else - Actions
      • Custom script: set i = udg_Creature_UnitTypes[udg_Temp_Integer_CreatureToBeSpawn]
      • Custom script: call SetUnitUserData(CreateUnit(Player(12),i,GetLocationX(udg_Creep_Point[ii]),GetLocationY(udg_Creep_Point[ii]),270),ii)
      • Custom script: call RemoveLocation(udg_Temp_Point)
I do not Understand Custom Scripts So I basically Did Trial and Error till jassnewgen didnt error on me. Im going to test it out now.

OP, have you considered just increasing the stats/size/changing appearance (via vertex color/special effects attachments)/adding or improving abilities for rare spawns? It seems like it'd be the easiest solution.
@Meticulous I cant simply Change the Appearance and Size etc Since the more Rare Creatures Drop Better Items, and give Slightly more exp. Im not sure how I could determine if the creature was different without having a separate Unit.

PS Unrelated:
Im having Trouble With Floating Text (Kadabra Attempted to help me fix it, and on my un updated map it works fine) I have a loop that should put floating text above my circle of powers used for hero selection. However it Doesnt work at all, Except in my older map.

Also Unrelated Is there anything Wrong with Starting a Timer More then Once? (I mean Is that how to restart it without letting it finish, keeping it counting down though?)
 
Last edited:
Level 8
Joined
Jan 8, 2010
Messages
493
if you want to use Meticulous' suggestion, you can add a dummy invisible skill. and when the unit dies, you can use
  • Unit - Level of DummySkill for (Triggering unit) Equal to 1
to detect whether the unit is Uncommon or Rare, while using a custom drop and EXP system.
 
Level 11
Joined
Nov 15, 2007
Messages
800
@Meticulous I cant simply Change the Appearance and Size etc Since the more Rare Creatures Drop Better Items, and give Slightly more exp. Im not sure how I could determine if the creature was different without having a separate Unit.

Here's a concept map with everything turned up to 11.
 

Attachments

  • ogodthewolves.w3x
    25.4 KB · Views: 37
Level 37
Joined
Mar 6, 2006
Messages
9,243
  • Untitled Trigger 003
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set hash = (Last created hashtable)
      • /* Save data for commong wolf */
      • Custom script: call SaveInteger(udg_hash, 'u000', 0, 'u000')
      • Custom script: call SaveInteger(udg_hash, 'u000', 1, 'u001')
      • Custom script: call SaveInteger(udg_hash, 'u000', 2, 'u002')
      • /* Save data for uncommong wolf */
      • Custom script: call SaveInteger(udg_hash, 'u001', 0, 'u000')
      • Custom script: call SaveInteger(udg_hash, 'u001', 1, 'u001')
      • Custom script: call SaveInteger(udg_hash, 'u001', 2, 'u002')
      • /* Save data for rare wolf */
      • Custom script: call SaveInteger(udg_hash, 'u002', 0, 'u000')
      • Custom script: call SaveInteger(udg_hash, 'u002', 1, 'u001')
      • Custom script: call SaveInteger(udg_hash, 'u002', 2, 'u002')
The first code, 'xxxx', is the unit type raw code for which you want to save other unit types for. You can check raw codes in object editor by pressing ctrl + D.

'u000' should be replaced with the common wolf, 'u001' with the uncommon and 'u002' with the rare.

In the respawn system, remove the SetUnitUserData line after the wait, and replace it with this:
  • Untitled Trigger 002
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 10) Equal to 1
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Random integer number between 1 and 10) Equal to 1
            • Then - Actions
              • Custom script: Custom script: call SetUnitUserData(CreateUnit(Player(12),LoadInteger(udg_hash, i, 2),GetLocationX(udg_Creep_Point[ii]),GetLocationY(udg_Creep_Point[ii]),270),ii)
            • Else - Actions
              • Custom script: Custom script: call SetUnitUserData(CreateUnit(Player(12),LoadInteger(udg_hash, i, 1),GetLocationX(udg_Creep_Point[ii]),GetLocationY(udg_Creep_Point[ii]),270),ii)
        • Else - Actions
          • Custom script: Custom script: call SetUnitUserData(CreateUnit(Player(12),LoadInteger(udg_hash, i, 0),GetLocationX(udg_Creep_Point[ii]),GetLocationY(udg_Creep_Point[ii]),270),ii)
 
Level 4
Joined
Jan 14, 2005
Messages
73
K well I did manage to get it working, Thanks you everyone :) Very Useful. I am sticking with my current trigger (I cant be bothered to figure out hash tables, But I will figure them out when I do my Save/Load System Most likely)

I am still having one other problem in my map though if anyone would like to help me out with that, Floating Text Doesnt Show up on my circles... link: http://www.hiveworkshop.com/forums/.../weird-umswe-bug-might-we-208471/#post2065504

Again Thanks Everyone, Great support

PS: How do i set the thread to solved?
 
Status
Not open for further replies.
Top