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

[Trigger] Maze Changing System - Triwizard Tournament

Status
Not open for further replies.
Level 3
Joined
Oct 14, 2007
Messages
37
For Type of Maze: Wall (not the sliding ones, more like the one in Harry Potter and the Goblet of Fire)
Trigger Action: This requires 2 regions, note that if you want a trigger for teleporting a unit to another region in its exact relative position then this tutorial is also for you, ill include the trigger code for teleporting an entire maze and individual units:

Entire Maze (Tested = Works)
  • Teleport Destructable
    • Events
      • Player - Player 1 (Red) types a chat message containing -Tele as An exact match (You can change this to whatever you want, this is a player-triggered code)
    • Conditions
    • Actions
      • Destructible - Pick every destructible in <Destination Region> and do (Actions)
        • Loop - Actions
          • Destructible - Kill (Picked destructible)
      • Destructible - Pick every destructible in <Departure Region> and do (Actions)
        • Loop - Actions
          • Set CoordinatesX = (X of (Position of (Picked destructible)))
          • Set CoordinatesY = (Y of (Position of (Picked destructible)))
          • Set CoordinatesX = (CoordinatesX - (Center X of <Departure Region>))
          • Set CoordinatesY = (CoordinatesY - (Center Y of <Departure Region>))
          • Destructible - Create a Ashenvale Tree Wall at (Point((CoordinatesX + (Center X of <Destination Region>)), (CoordinatesY + (Center Y of <Destination Region>)))) facing Default building facing with scale 1.00 and variation 3
          • Animation - Play (Last created destructible)'s birth animation
Variables:
CoordinatesX - Integer (Non-Array)
CoordinatesY - Integer (Non-Array)

Individual Unit Teleport: (Tested = Works) (Like in Water Wars)
  • Teleport
    • Events
      • Player - Player 1 (Red) types a chat message containing -TeleUnit as An exact match
    • Conditions
    • Actions
      • Set CoordinatesX = (X of (Position of <Unit Here> <gen>))
      • Set CoordinatesY = (Y of (Position of <Unit Here> <gen>))
      • Set CoordinatesX = (CoordinatesX - (Center X of Region 002 <gen>))
      • Set CoordinatesY = (CoordinatesY - (Center Y of Region 002 <gen>))
      • Unit - Move <Unit Here> <gen> instantly to (Point((CoordinatesX + (Center X of Region 002 Copy <gen>)), (CoordinatesY + (Center Y of Region 002 Copy <gen>))))
If your wondering why I created this maze changing code, well the answer is that I am working on a map The Triwizard Tournament
I have included a Download link

NOTES: Task 3 is not yet available on this dl link
 

Attachments

  • The Triwizard Tournamentv1.09.w3x
    1.5 MB · Views: 54
Last edited:
Level 29
Joined
Jul 29, 2007
Messages
5,174
If you really want this to be a tutorial, you should explain more about what/why/when and whatever + you need to remove point leaks.

I mean, I for one didn't understand the point of the first trigger.
The second one I understood only because im currently using it in the map im making.
 
Level 3
Joined
Oct 14, 2007
Messages
37
Maze Changing Trigger

Im not too concerned with point leaks right now, and in tests theres no lag with it at all, although I would appreciate it if you can give me the code to remove the point leak your talking about, i dont know jass

The First trigger takes 2 regions, the first region it kills all the destructables in it (trees in my case) and then saves the exact coordiantes of each tree in the other region relative to the center point of the second region, then creates trees at the saved coordinates relative to the center point of the first region, as a result in task 3, your walking and next thing you know, the walls around you collapse and new passageways appear, as well as old ones closing
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
I see, you should write that in the tutorial itself.

About the leaks, of course it would lag if run 1 time, but if it would be run a lot of times it will start to lag.
I for one don't like leaks even if they don't matter.

The code to remove locations goes like this "call RemoveLocation(udg_Variable)
For example if your point variable is called Point, it will look like this
  • Custom Script: call RemoveLocation(udg_Point)

[Notice] RemoveLocation and the variable's name are Case Sensitive.

If your variable is arrayed it would be the same thing but (udg_Point[x]) (x being the array number).

If you need a array that isn't a number (for example a player number) you should make a action that will use that player number and then convert to JASS and see how its written.
For example, I just took this random integar consisting "player number of (owner of triggering unit))
  • Set Integar = (Player number of (Owner of (Triggering unit)))
Then converted to JASS, and now it looks like this
JASS:
set udg_Integar = GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))


So the remove location code should look like this

  • Custom Script: call RemoveLocation(udg_Point[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))])

[Notice] To change a trigger to JASS, go the the "Convert To Custom Text" in Edit while in the trigger editor (it will convert the selected trigger).
 
Status
Not open for further replies.
Top