• 🏆 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!

Complete optimization/fix of all the map system.

Status
Not open for further replies.
Level 20
Joined
Jul 14, 2011
Messages
3,213
I need to integrally improve the systems in my map, maybe update some systems to JASS, or simply do things a better way. I have done the best I could everyday to make something substantially 'good'.

This is what I've done. I'd like to have some feedback / suggestions to improve / ideas, etc.If you see a problem and have a good solution, please help me =D And, also, please, be kind, it's my first map.

The map is an RPG. I'm trying to make it like a Multiplayer Zelda or MultiPlayer Final Fantasy, making several players able to go through the quest independently one from another.

I do this because I've spent about 8 hours doing something that someone with a bit more experience would have done in 2 minutes... I don't want to spend more time that way, neither want to spend it fixing all the stuff I can do right 'from the beginning'.

Thanks and Rep+ to all the helpers <3.


I know Special Effects can be destroyed right after being created, but some of them never show if I destroy them inmediatly, that's why I made a small 'wait' between creation and destruction (only for those that didn't work inmediatly destroying them).

I also know that 'set bj_wantDestroyGrop = true' can be used to destroy groups, but sometimes when I use it, the trigger doesn't work, in those cases I create the variable group.





I set Day/Night models to resemble the daylight during the daytime. These are the triggers.

  • Six AM Time
    • Events
      • Game - The in-game time of day becomes Equal to 6.00
    • Conditions
    • Actions
      • Custom script: call SetDayNightModels("DNCDayTime.mdx","DNCDayTime.mdx")
  • Three PM Time
    • Events
      • Game - The in-game time of day becomes Equal to 15.00
    • Conditions
    • Actions
      • Custom script: call SetDayNightModels("DNCFallOfDay.mdx","DNCFallOfDay.mdx")
  • Six PM Time
    • Events
      • Game - The in-game time of day becomes Equal to 18.00
    • Conditions
    • Actions
      • Custom script: call SetDayNightModels("DNCDarkPurpleLight.mdx","DNCDarkPurpleLight.mdx")
  • Midnight Time
    • Events
      • Game - The in-game time of day becomes Equal to 0.50
    • Conditions
      • (Random integer number between 1 and 10) Less than or equal to 5
    • Actions
      • Custom script: call SetDayNightModels("","")
  • Night effects Turn On
    • Events
      • Game - The in-game time of day becomes Equal to 18.00
    • Conditions
    • Actions
      • Countdown Timer - Start NightCurseTimer as a Repeating timer that will expire in 1.00 seconds
  • Night Blind
    • Events
      • Time - NightCurseTimer expires
    • Conditions
    • Actions
      • Set UnitsToBlind = (Units in (Playable map area) matching ((((Owner of (Matching unit)) controller) Equal to User) and ((((Matching unit) has buff Night vision ) Equal to False) and ((Unit-type of (Matching unit)) Not equal to Dummy Inventory))))
      • Unit Group - Pick every unit in UnitsToBlind and do (Actions)
        • Loop - Actions
          • Set PosUnitToBlind = (Position of (Picked unit))
          • Unit - Create 1 Dummy NightCaster for Neutral Hostile at PosUnitToBlind facing Default building facing degrees
          • Unit - Order (Last created unit) to Undead Banshee - Curse (Picked unit)
          • Unit - Order (Last created unit) to Human Sorceress - Slow (Picked unit)
          • Unit - Remove (Last created unit) from the game
          • Custom script: call RemoveLocation(udg_PosUnitToBlind)
      • Custom script: call DestroyGroup(udg_UnitsToBlind)
  • Night effects Turn Off
    • Events
      • Game - The in-game time of day becomes Equal to 6.00
    • Conditions
    • Actions
      • Countdown Timer - Pause NightCurseTimer


This triggers move the hero from one side of the bridge to the other side, going under it (I'm using platforms to go over it)

  • Rope Bridge Under GOBACK
    • Events
      • Unit - A unit enters UnderRopeBridgeGo <gen>
    • Conditions
    • Actions
      • Set Temp_Point = (Random point in UnderRopeBridgeBack APPEARBACK <gen>)
      • Unit - Move (Triggering unit) instantly to Temp_Point
      • Custom script: call RemoveLocation(udg_Temp_Point)
  • Rope Bridge Under BACKGO
    • Events
      • Unit - A unit enters UnderRopeBridgeBack <gen>
    • Conditions
    • Actions
      • Set Temp_Point = (Random point in UnderRopeBridgeBack APPEARGO <gen>)
      • Unit - Move (Triggering unit) instantly to Temp_Point
      • Custom script: call RemoveLocation(udg_Temp_Point)


This is for some Neutral units I have walking on town, not going outside town limits.

  • Neutral Wander
    • Events
      • Unit - A unit leaves First Beach Town Center <gen>
    • Conditions
      • (Owner of (Triggering unit)) Equal to Neutral Passive
    • Actions
      • Set Temp_Point = (Random point in First Beach Town Center <gen>)
      • Unit - Order (Triggering unit) to Move To Temp_Point
      • Custom script: call RemoveLocation(udg_Temp_Point)


When the unit enters a Dock at the beginning of the game, Gsu'h is created. Is removed when the units leave.
  • Gsuh Dock Appear
    • Events
      • Unit - A unit enters Ancient of Wonders Docks <gen>
    • Conditions
      • (Unit-type of (Triggering unit)) Not equal to hook dummy
      • (In-game time of day) Greater than or equal to 6.00
      • (In-game time of day) Less than 18.00
    • Actions
      • Unit - Create 1 Gsu'h for Neutral Passive at (Center of AoW appear DOCKS <gen>) facing Default building facing degrees
      • Visibility - Create an initially Enabled visibility modifier for (Owner of (Triggering unit)) emitting Visibility across Ancient of Wonders Docks <gen>
      • Trigger - Turn on Gsuh Dock Dissapear <gen>
      • Trigger - Turn off (This trigger)
  • Gsuh Dock Dissapear
    • Events
      • Unit - A unit leaves Ancient of Wonders Docks <gen>
    • Conditions
      • (Number of units in (Units in Ancient of Wonders Docks <gen>)) Less than or equal to 1
    • Actions
      • Unit - Remove (Random unit from (Units in AoW appear DOCKS <gen> owned by Neutral Passive)) from the game
      • Special Effect - Create a special effect at (Center of AoW appear DOCKS <gen>) using Objects\Spawnmodels\Other\ToonBoom\ToonBoom.mdl
      • Special Effect - Destroy (Last created special effect)
      • Visibility - Disable (Last created visibility modifier)
      • Trigger - Turn off (This trigger)
      • Trigger - Turn on Gsuh Dock Appear <gen>


A simple 'Move to boat' (Boat is a region with just a boat in the mid of the water' where units stay for some seconds until the boat reaches the city. That part isn't done yet.
  • Amos Boat
    • Events
      • Game - The in-game time of day becomes Equal to 11.00
    • Conditions
    • Actions
      • Set Temp_Point = (Random point in Small Boat <gen>)
      • Unit Group - Pick every unit in (Units in Boat PICK 1 <gen> matching ((((Matching unit) is A Hero) Equal to True) and (((Matching unit) has an item of type Boat Ticket: |cffffd700Mygdalia|r) Equal to True))) and do (Actions)
        • Loop - Actions
          • Unit - Move (Picked unit) instantly to Temp_Point
          • Hero - Drop (Item carried by (Picked unit) of type Boat Ticket: |cffffd700Mygdalia|r) from (Picked unit)
          • Item - Remove (Last dropped item)
      • Custom script: call RemoveLocation(udg_Temp_Point)
There's also a Ship (With two floors and else) with custom music in the region. (I'll use the ship later, but I already made it)
  • Ship Music ON
    • Events
      • Unit - A unit enters Ship Music <gen>
    • Conditions
    • Actions
      • Custom script: if GetLocalPlayer() == GetOwningPlayer(GetTriggerUnit()) then
      • Sound - Set Music to 0.00%
      • Custom script: endif
  • Ship Music OFF
    • Events
      • Unit - A unit leaves Ship Music <gen>
    • Conditions
    • Actions
      • Custom script: if GetLocalPlayer() == GetOwningPlayer(GetTriggerUnit()) then
      • Sound - Set Music to 100.00%
      • Custom script: endif
  • Ship GO UP
    • Events
      • Unit - A unit enters Ship Go Up <gen>
    • Conditions
    • Actions
      • Set Temp_Point = (Random point in Ship UP <gen>)
      • Unit - Move (Triggering unit) instantly to Temp_Point
      • Custom script: call RemoveLocation(udg_Temp_Point)





I'm working on the 'Hero Revive' system. I want to make a shade where the hero dyes, and someone has to cast 'Revive' on the shade, or the shade has to reach a revival point, or a Revival Item has to be used on it. OR the shade is created on revival point and it has to go for its body.

  • Hero Selection
    • Events
      • Unit - A unit Sells a unit
    • Conditions
      • ((Sold unit) is A Hero) Equal to True
    • Actions
      • Set Heroes[(Player number of (Owner of (Sold unit)))] = (Sold unit)
      • Unit - Remove (Buying unit) from the game
      • Player - Make (Unit-type of (Sold unit)) Unavailable for training/construction by (Owner of (Sold unit))
      • Unit - Move (Sold unit) instantly to (Center of Ancient of Wonders Docks <gen>)
      • Camera - Lock camera target for (Owner of (Sold unit)) to (Sold unit), offset by (0.00, 0.00) using Default rotation
      • Hero - Modify unspent skill points of (Sold unit): Add 5 points
      • Unit - Make (Sold unit) face (Selling unit) over 0.00 seconds
  • - A dialog Starts using a system The_Witcher made for me.
  • Hero lvl up
    • Events
      • Unit - A unit Gains a level
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • Player - Add 1 to (Owner of (Triggering unit)) Current lumber
      • Set Temp_Group = (Units within 400.00 of (Position of (Triggering unit)) matching ((((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True) and (((Matching unit) is alive) Equal to True)))
      • Hero - Modify unspent skill points of (Triggering unit): Add 5 points
      • Unit - Set life of (Triggering unit) to 100.00%
      • Unit - Set mana of (Triggering unit) to 100.00%
      • Unit Group - Pick every unit in Temp_Group and do (Actions)
        • Loop - Actions
          • Unit - Cause (Triggering unit) to damage (Picked unit), dealing ((Real((Level of (Triggering unit)))) x 25.00) damage of attack type Spells and damage type Normal
      • Custom script: call DestroyGroup(udg_Temp_Group)
      • Custom script: if GetLocalPlayer() == GetOwningPlayer(GetTriggerUnit()) then
      • Sound - Play Wohoo <gen> at 100.00% volume, skipping the first 0.00 seconds
      • Custom script: endif
      • Special Effect - Create a special effect attached to the origin of (Triggering unit) using Abilities\Spells\NightElf\Taunt\TauntCaster.mdl
      • Wait 0.10 seconds
      • Special Effect - Destroy (Last created special effect)
      • Floating Text - Create floating text that reads Level Up above (Picked unit) with Z offset 0.00, using font size 9.00, color (100.00%, 50.00%, 50.00%), and 0.00% transparency
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
      • Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
      • Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
All the stats increase dmg
  • Hero Attributes
    • Events
      • Unit - A unit Learns a skill
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Learned Hero Skill) Equal to Strength training
        • Then - Actions
          • Hero - Modify Strength of (Triggering unit): Add 1
          • Hero - Create Damage Training +1 and give it to (Triggering unit)
          • Unit - Remove Strength training from (Triggering unit)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Learned Hero Skill) Equal to Agility training
        • Then - Actions
          • Hero - Modify Agility of (Triggering unit): Add 1
          • Hero - Create Damage Training +1 and give it to (Triggering unit)
          • Unit - Remove Agility training from (Triggering unit)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Learned Hero Skill) Equal to Intelligence training
        • Then - Actions
          • Hero - Modify Intelligence of (Triggering unit): Add 1
          • Hero - Create Damage Training +1 and give it to (Triggering unit)
          • Unit - Remove Intelligence training from (Triggering unit)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Learned Hero Skill) Equal to Mp train
        • Then - Actions
          • Unit - Add Skill Manual of Mana (+12) to (Triggering unit)
          • Unit - Set level of Skill Manual of Mana (+12) for (Triggering unit) to 2
          • Unit - Remove Skill Manual of Mana (+12) from (Triggering unit)
          • Unit - Remove Mp train from (Triggering unit)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Learned Hero Skill) Equal to Hp train
        • Then - Actions
          • Hero - Create Manual of Health and give it to (Triggering unit)
          • Unit - Remove Hp train from (Triggering unit)
        • Else - Actions
I don't want to have people spending a lot of time in towns, so:
  • Hero Enters Town
    • Events
      • Unit - A unit enters First Beach Town <gen>
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • Unit - Set (Triggering unit) movement speed to 522.00
  • Hero Leaves Town
    • Events
      • Unit - A unit leaves First Beach Town <gen>
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • Unit - Set (Triggering unit) movement speed to (Default movement speed of (Triggering unit))



I want to create that symbol in the overhead then the units speak.

  • Talking Icon
    • Events
      • Player - Player 1 (Red) types a chat message containing <Empty String> as A substring
      • Player - Player 1 (Red) skips a cinematic sequence
      • Player - Player 2 (Blue) types a chat message containing <Empty String> as A substring
      • Player - Player 2 (Blue) skips a cinematic sequence
      • Player - Player 3 (Teal) types a chat message containing <Empty String> as A substring
      • Player - Player 3 (Teal) skips a cinematic sequence
      • Player - Player 4 (Purple) types a chat message containing <Empty String> as A substring
      • Player - Player 4 (Purple) skips a cinematic sequence
      • Player - Player 5 (Yellow) types a chat message containing <Empty String> as A substring
      • Player - Player 5 (Yellow) skips a cinematic sequence
    • Conditions
    • Actions
      • Set u = Heroes[(Player number of (Triggering player))]
      • Custom script: call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Other\\Silence\\SilenceTarget.mdl", udg_u, "overhead" ))
      • Custom script: call TriggerSleepAction(0.1)
      • Custom script: call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Other\\Silence\\SilenceTarget.mdl", udg_u, "overhead" ))
Can't be more obvious
  • Clear command
    • Events
      • Player - Player 1 (Red) types a chat message containing -clear as An exact match
      • Player - Player 2 (Blue) types a chat message containing -clear as An exact match
      • Player - Player 3 (Teal) types a chat message containing -clear as An exact match
      • Player - Player 4 (Purple) types a chat message containing -clear as An exact match
      • Player - Player 5 (Yellow) types a chat message containing -clear as An exact match
    • Conditions
    • Actions
      • Custom script: if GetLocalPlayer() == GetTriggerPlayer() then
      • Custom script: call ClearTextMessages()
      • Custom script: endif
Displays FP (Faith Points)

  • FP command
    • Events
      • Player - Player 1 (Red) types a chat message containing -fp as An exact match
      • Player - Player 2 (Blue) types a chat message containing -fp as An exact match
      • Player - Player 3 (Teal) types a chat message containing -fp as An exact match
      • Player - Player 4 (Purple) types a chat message containing -fp as An exact match
      • Player - Player 5 (Yellow) types a chat message containing -fp as An exact match
    • Conditions
    • Actions
      • Custom script: if GetLocalPlayer() == GetTriggerPlayer() then
      • Custom script: call ClearTextMessages()
      • Custom script: endif
      • Game - Display to (All players matching (((Triggering player) controller) Equal to User)) the text: (|cfffff700Faith Points|r: + (String(FP[(Player number of (Triggering player))])))

  • Camera distance set
    • Events
      • Player - Player 1 (Red) types a chat message containing -cam as A substring
      • Player - Player 2 (Blue) types a chat message containing -cam as A substring
      • Player - Player 3 (Teal) types a chat message containing -cam as A substring
      • Player - Player 4 (Purple) types a chat message containing -cam as A substring
      • Player - Player 5 (Yellow) types a chat message containing -cam as A substring
    • Conditions
    • Actions
      • Camera - Set (Triggering player)'s camera Distance to target to (Real((Substring((Entered chat string), 6, 9)))) over 2.00 seconds
  • Camera text info
    • Events
      • Player - Player 1 (Red) types a chat message containing -cam as An exact match
      • Player - Player 2 (Blue) types a chat message containing -cam as An exact match
      • Player - Player 3 (Teal) types a chat message containing -cam as An exact match
      • Player - Player 4 (Purple) types a chat message containing -cam as An exact match
      • Player - Player 5 (Yellow) types a chat message containing -cam as An exact match
    • Conditions
    • Actions
      • Custom script: if GetLocalPlayer() == GetTriggerPlayer() then
      • Custom script: call ClearTextMessages()
      • Custom script: endif
      • Game - Display to (All players matching (((Triggering player) slot status) Equal to Is playing)) the text: - Use '-cam ####' t...



That should be enough. I'll add more when all this is fixed/optimized :) I may delete them as they become fixed/optimized.
 
Level 22
Joined
Nov 14, 2008
Messages
3,256
-Leak
  • Unit - Create 1 Gsu'h for Neutral Passive at (Center of AoW appear DOCKS <gen>) facing Default building facing degrees
-Leak

  • (Number of units in (Units in Ancient of Wonders Docks <gen>)) Less than or equal to 1
-Leak

  • Unit - Remove (Random unit from (Units in AoW appear DOCKS <gen> owned by Neutral Passive)) from the game
-Leak
  • Unit Group - Pick every unit in (Units in Boat PICK 1 <gen> matching ((((Matching unit) is A Hero) Equal to True) and (((Matching unit) has an item of type Boat Ticket: |cffffd700Mygdalia|r) Equal to True))) and do (Actions)
-Leak

  • Unit - Move (Sold unit) instantly to (Center of Ancient of Wonders Docks <gen>)
-Leak

  • Set Temp_Group = (Units within 400.00 of (Position of (Triggering unit)) matching ((((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True) and (((Matching unit) is alive) Equal to True)))
-Will not work if another effect is created in this interval, just create it on the ground and the birth effect will work.

  • Special Effect - Create a special effect attached to the origin of (Triggering unit) using Abilities\Spells\NightElf\Taunt\TauntCaster.mdl
  • Wait 0.10 seconds
  • Special Effect - Destroy (Last created special effect)
-There are also a lot of performance loss you do. Especially when you use like TriggeringUnit a thousand times in one trigger. Just set it to a variable and use the variable (and no need to null the global variable). Anyway just skimmed it all.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
@baassee: Hey !Thanks a lot. I missed most of them, others where just ignorance :$.

  • Unit - Create 1 Gsu'h for Neutral Passive at (Center of AoW appear DOCKS <gen>) facing Default building facing degrees
  • Unit - Move (Sold unit) instantly to (Center of Ancient of Wonders Docks <gen>)
Using the same point over and over leaks? That's why I left some values like 'Center of AoW appear DOCK' like that, and not 'Temp Point' or else.

  • (Number of units in (Units in Ancient of Wonders Docks <gen>)) Less than or equal to 1
  • Unit - Remove (Random unit from (Units in AoW appear DOCKS <gen> owned by Neutral Passive)) from the game
  • Unit Group - Pick every unit in (Units in Boat PICK 1 <gen> matching ((((Matching unit) is A Hero) Equal to True) and (((Matching unit) has an item of type Boat Ticket: |cffffd700Mygdalia|r) Equal to True))) and do (Actions)
I'll have to store these into into Temp_Group and destroy it.
QUESTION: How can I do that? Where do I create those groups?
REAL QUESTION: ¿How do I fix this? xD

  • Set Temp_Group = (Units within 400.00 of (Position of (Triggering unit)) matching ((((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True) and (((Matching unit) is alive) Equal to True)))
Hehe, I missed that one '(Position of (Triggering Unit))

- I'll also test the special effect thing.
- Where do I call Triggering Unit a thousand times? :p And, do I set 'TrigUnit (Unit variable) = Triggering Unit' in the Map Init, or only in that trigger? EDIT: Lol, I see about 32 (Sold unit) and (Triggering Unit), most in 'Hero Related' section xD
 
Level 16
Joined
Aug 7, 2009
Messages
1,403
@baassee: Hey !Thanks a lot. I missed most of them, others where just ignorance :$.

  • Using the same point over and over leaks? That's why I left some values like 'Center of AoW appear DOCK' like that, and not 'Temp Point' or else.[/QUOTE]
  • For "Position of XY", "Center of XY" things you ALWAYS have to use a Point type variable. If you don't do so, a new [icode=jass]location[/icode] type HANDLE is created, and after the function is called, its reference is lost, meaning you won't be able to destroy it later. The more those kind of useless things exist the slower and more laggy your map is.
  • [quote="Spartipilo, post: 2009633"]And, do I set 'TrigUnit (Unit variable) = Triggering Unit' in the Map Init, or only in that trigger? [/QUOTE]
  • Triggeing Unit returns the unit that fired the event/trigger --> you have to set the value of "TrigUnit" variable at the top of the actual trigger. At map init it doesn't even have a value (well, it does: [icode=jass]null[/icode])
  • /off-topic
  • Please ignore "xD". It makes you (and everyone who uses it) look like a kid who should grow up. No offense (I didn't really write down my honest opinion about it, as it'd be too offensive), but I'm really hating that "word".
 
Level 17
Joined
Apr 27, 2008
Messages
2,455
Please ignore "xD". It makes you (and everyone who uses it) look like a kid whou should grow up. No offense (I didn't really write down my honest opinion about it, as it'd be too offensive), but I'm really hating that "word".

Like almost all it's all about how much you use it.

What ?! Who is talking about "flood" ?
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Thanks for both explanations Luorax.

/off-topic
I use 'xD' only when I'm actually laughing while writing whatever I am. When I write I try to be the most clear-expressive I can to avoid misunderstandings. Honestly, I don't want to look like an inexpressive-machine, I try to be warm and kind, and look like a person in my written words. I don't think that "xD'ing" is a sin, as a part of an inoffensive expression.

I quote you: "I'm really hating that "word"".. Notice the I'am. I respect you hate it, and I'll try not to say it to you directly, (PM, Visitor Message, direct answers, etc.), but, I think almost everything about this is deeply subjective, and there's no use on trying to force someone to think like any of us do, if it's not about a public and social convention about 'How to write' as for example: No offensive chatting, no vulgarities, no trolling, etc.
off-topic\.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Excuse me for this -double post- there seems to be a problem, since I can't edit none of my previous post. This is a test.

Test: But I can edit this one -.-. I can't update the first thread to show all the changes that may solve most of problems.
 
Status
Not open for further replies.
Top