Miscellaneous Snippets

Status
Not open for further replies.

Darg

Administrator
Reaction score
49
Victory / Defeat Code for Non-Melee Maps

Enforcing Victory & Defeat conditions in non-melee maps.

non-melee buildings and units.w3m - A player's buildings AND units must all be destroyed for that player to be defeated.

non-melee buildings only.w3m - A player's buildings ONLY must all be destroyed for that player to be defeated.
 

Attachments

  • non-melee buildings and units.w3m
    14.4 KB · Views: 541
  • non-melee buildings only.w3m
    15 KB · Views: 539

Mind

New Member
Reaction score
7
Improved Version of "thedudeabides" Cheat

The "thedudeabides" cheat doesn't work very well - you have to type it every time you cast a spell.
Code:
[b]Trigger 1[/b]
Event:
    [player - chat message]
    Player types (thedudeabides) as an exact match.
Actions:
    [trigger - turn on]
    Turn on (Trigger 2)
    [game - message]
    Display (Cheat Enabled!)

[b]Trigger 2[/b] (initially disabled)
Event:
    [generic unit event] 
    Unit stops casting an ability
Condition:
    [player comparison] 
    (Owner of (casting unit)) is equal to (player 1)
Actions: 
    Reset ability cooldown for (casting unit)

[b]Trigger 3[/b]
Event:
    [player - chat message]
    player 1 types thedudeabides as an exact much
Condition:
    [boolean comparison]
    Trigger 2 is enabled is equal to true
Action:
    [trigger - turn off]
    Turn off trigger 2
    [game - message]
    Display (Cheat disabled!)
If you're making a multi-player level, you have to delete the condition in Trigger 2. Otherwise, if you're making a single-player level, you don't.
 
W

warcraftguy

Guest
Dueling system

The idea of this is for allied players to be able to duel.

my dueling system may be a bit tricky but it works. :D each player will almost have the exact same trigger shwon below (change player) all it is is 3 triggers player

My arena is shaped like a square. 2 regions on each end. one for each of the 2 duelers
Code:
red player duel
    Events
        Player - Player 1 (Red) types a chat message containing -duel as An exact match
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Number of units in (Units in Region 005 <gen>)) Equal to 1
            Then - Actions
                Unit Group - Pick every unit in (Units owned by Player 1 (Red)) and do (Actions)
                    Loop - Actions
                        Unit - Move (Picked unit) instantly to (Center of Region 004 <gen>)
                        Game - Display to (All players) for 5.00 seconds the text: DUEL STARTING
                        Destructible - Kill ForceWall 0040 <gen>
                        Unit Group - Pick every unit in (Units in Region 005 <gen>) and do (Player - Make (Owner of (Picked unit)) treat Player 1 (Red) as an Enemy with shared vision)
                        Unit Group - Pick every unit in (Units in Region 005 <gen>) and do (Player - Make Player 1 (Red) treat (Owner of (Picked unit)) as an Enemy with shared vision)
                        Trigger - Turn on DUEL DIE <gen> (look below for deatails)
            Else - Actions
                Unit - Move (Picked unit) instantly to (Center of Region 005 <gen>)
this trigger should be turned off at beggining. al it does is set alliance between dulers after duel
Code:
DUEL DIE
Events
        Unit - A unit Dies
    Conditions
        (Owner of (Dying unit)) Not equal to Player 12 (Brown)
        (Owner of (Killing unit)) Not equal to Player 12 (Brown)
    Actions
        Game - Display to (All players) for 5.00 seconds the text: DUEL OVER!
        Game - Display to (All players) for 10.00 seconds the text: ((Name of (Owner of (Killing unit))) + ( beat  + ((Name of (Owner of (Dying unit))) +  in a duel!)))
        Player - Make (Owner of (Killing unit)) treat (Owner of (Dying unit)) as an Ally with shared vision
        Player - Make (Owner of (Dying unit)) treat (Owner of (Killing unit)) as an Ally with shared vision
        Trigger - Turn on off duel <gen>
        Trigger - Turn off (This trigger)
this trigger will remove the player who won after the duel is over from the field.(use this if in arena and closed in) (this is based on my rpg)
Code:
off duel
    Events
        Player - Player 1 (Red) types a chat message containing -end duel as An exact match
        Player - Player 2 (Blue) types a chat message containing -end duel as An exact match
        Player - Player 3 (Teal) types a chat message containing -end duel as An exact match
        Player - Player 4 (Purple) types a chat message containing -end duel as An exact match
        Player - Player 5 (Yellow) types a chat message containing -end duel as An exact match
        Player - Player 6 (Orange) types a chat message containing -end duel as An exact match
        Player - Player 7 (Green) types a chat message containing -end duel as An exact match
        Player - Player 8 (Pink) types a chat message containing -end duel as An exact match
        Player - Player 9 (Gray) types a chat message containing -end duel as An exact match
        Player - Player 10 (Light Blue) types a chat message containing -end duel as An exact match
    Conditions
    Actions
        Unit Group - Pick every unit in (Units in Region 006 <gen>) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Owner of (Picked unit)) Equal to (Triggering player)
                    Then - Actions
                        Unit - Move (Picked unit) instantly to (Center of Region 007 <gen>)
                    Else - Actions
                        Do nothing
REMEMBER
this is taken from my rpg that has the dueling system:
12 brown are the creeps in my rpg so ignore that if player 12 brown is a player as well as dark green
 

Shadowy Fear

I have returned
Reaction score
44
Trigger Based Anti - Theft

Although map protectors are unbreakable to the average gamer, there are plenty of people out there who specilize in breaking open maps and reconstructing them. Besides map protectors, though, there are trigger - based ways to make it so that if someone tries to edit your map and test it, the game won't let them (wont let them TEST it that is, they could still edit it with the simple detector I have below).

Events: Map Initiliziation

Conditions: N / A ( you could delete the player name check below to make it a multiplayer game only)

Actions: Pick every player in (all players) and do (actions)
Loop - actions
If all conditons are true then do (then actions) else do (else actions)
Conditions
- (name of (picked player)) equal to WorldEdit
(number of players in all (players)) equal to 1
Actions
player - set name of picked player to Map Stealer
game - defeat (picked player) with the message NO MAPSTEALERS!

This is quite a basic detection sysem; there are other, more advanced ways to check strings and determine whether or not the creator's name was changed to that of the mapstealer. If you really want to be crafty, make one obvious trigger like this, and then hide a few others among the other triggers :D. And if you are familiar with JASS, do this trigger in JASS along with the other functions to make it so that if you delete the whole trigger, the map will be unplayable :) If you are feeling creative (along with sadistic) then you can add a few more ---'interesting' :) --- functions as well; on my map a bunch of floating text appears that flames the mapstealer, and then user control is disabled and you watch a cinematic lecturing you on the idiosyncrasies of mapstealers before the game ends :)

They'll never know what hit them :) Just be sure to disable this when YOU are testing your map though -_-
 

Husky

Local Lurker
Reaction score
120
Secret Cheats...

This is a good way to an "advantage", *cough*cheat*cough*.
There are many things you can do with this, getting more gold/lumber, free units etc.

NOTE: Words inbetween *these* means put this as whatever you want.
And Words inbetween ##these## means you have to create a region.


FOR GOLD
Code:
Event: Player Chat Message - *Player 1 (Red)* types *-gold* as an exact match.
Conditions - 
Actions - Player Add Property - Add *1000* for *Player 1 (Red)* Current Gold.]


FOR LUMBER

Code:
Event: Player Chat Message - *Player 1 (Red)* types *-timber* as an exact match.
Conditions - 
Actions - Player Add Property - Add *1000* for *Player 1 (Red)* Current Lumber.

FOR PERSONAL ADDED FOOD LIMIT
Code:
Event: Player Chat Message - *Player 1 (Red)* types *-units please* as an exact match.
Conditions - 
Actions - Player Add Property - Add *10* for *Player 1 (Red)* Food Max

FREE UNITS
Code:
Event: Player Chat Message - *Player 1 (Red)* types *-troops* as an exact match.
Conditions - 
Actions - Unit Create Units Facing Angle - Unit - Create *10* *Footman* for *Player 1 (Red)* at ##(Center of (Playable map area))## facing Default building facing degrees

HERO EXPERIENCE:
Code:
Event: Player Chat Message - *Player 1 (Red)* types *-exp* as an exact match.
Conditions - 
Actions - Hero Set Experience - Hero - Add *1000* experience to *(Triggering unit)*, Hide level-up graphics

HERO LEVEL:
Code:
Event: Player Chat Message - *Player 1 (Red)* types *-level* as an exact match.
Conditions - 
Actions - Hero Set Level - Hero - Set *(Triggering unit)* Hero-level to *8*, Hide level-up graphics

Just but a few of the many possiblilities.
NOTE: Have not tested most of these so you may have to modify a few of them. Especially the Hero ones.

Happy Gaming/Mapping,
-Husky
 

Husky

Local Lurker
Reaction score
120
Random Region...

NOTE: New Demonstartion Map up (it was pitiful before :p)
Also added Step 6: Spawning

Well here's something more.
Its a "random region variable setup". As in when you die or start you spawn at a random place in the map.
I had aa lot of trouble with this so I thought I may aswell post it up...

STEP 1: Creating the Regions.
*Yeah, as it says you must create some regions. I had 15 in my map but 2 will do for this one.

STEP 2: Createing the Variable.
*Go to Trigger Editor.
*Create Variable
*Create New Variable naming it whatever you want. RandomRegion will do NOTE: You can't use spaces in the name.
*Make it a "Region" Variable.
*Check the "Array" box and set the number to how many regions you've got. In my case 15.
*Click OK.

STEP 3: Creating the Event Trigger.
For the event...
*Time - Time Elasped: set it to whatever but best within the second. I have it set to 0.10. So it should look like:
Code:
Time - Elapsed game time is 0.10 seconds

STEP 4: Creating the Action Triggers.
NOTE: There are no Condition Triggers.
For the Actions...
*Create New. Make sure its in All dropdown menu, and scroll down to "Set Variable".
*Click Variable and in the pull down menu select your RandomRegion (or whatever its called) and click ok.
*Okay now a [Index] should of appeared. Click it and set the number to how 1 (for Region 1).
*Click Value And from the Variable Pull Down Menu select your 1st region.

STEP 5: The Copying and Pasting... and a bit of number changing.
Okay so now you should have something like thus...
Code:
Untitled Trigger 001
    Events
        Time - Elapsed game time is 0.10 seconds
    Conditions
    Actions
        Set regionrandom[1] = spawn1 <gen>


Okay now you have to Copy the Action and just change round the Index[1] and, Value - Spawn1 (or Region001 which is what you might have).

So after changing them Up 1 number each you should have something like:
Code:
Region Variable
    Events
        Time - Elapsed game time is 0.10 seconds
    Conditions
    Actions
        Set regionrandom[1] = spawn1 <gen>
        Set regionrandom[2] = spawn2 <gen>
        Set regionrandom[3] = spawn3 <gen>
        Set regionrandom[4] = spawn4 <gen>
        Set regionrandom[5] = spawn5 <gen>
        Set regionrandom[6] = spawn6 <gen>
        Set regionrandom[7] = spawn7 <gen>
        Set regionrandom[8] = spawn8 <gen>
        Set regionrandom[9] = spawn9 <gen>
        Set regionrandom[10] = spawn10 <gen>
        Set regionrandom[11] = spawn11 <gen>
        Set regionrandom[12] = spawn12 <gen>
        Set regionrandom[13] = spawn13 <gen>
        Set regionrandom[14] = spawn14 <gen>
        Set regionrandom[15] = spawn15 <gen>
        Set regionrandom[16] = spawn16 <gen>

STEP 6: Spawning.
It's just the normal Revive or Create trigger (create in this case) but with a little bit edited, here is what it should look like:
Code:
Unit - Create 1 Footman for Player 1 (Red) at (Center of RandomRegion[(Random integer number between 1 and 16)]) facing Default building facing degrees

And for Hero Revive:
Code:
Hero - Instantly revive No unit at (Center of RandomRegion[(Random integer number between 1 and 16)]), Show revival graphics

Okay so now you should have a final product.
Hope that helped...
-Husky

Thanks to Im_On_56K for this...
 

Attachments

  • Random Region.w3x
    13.6 KB · Views: 548

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,497
Non-repeating random sequence

Ever been in need of getting some random numbers,
that don't repeat?

No idea what that might be good for?

Ever used "All random" in some map?

Imagine you have some array, holding a couple of units,
and, for some reason, you need to choose one at random,
then another one and yet another one,
but, you have to make sure that every unit is only ever taken once...


Well, here's one way of doing it ;)



You'll need a couple variables:
Sequence, an Integer array, of size "how many numbers you need". (I used 10 in my example)
SequenceTotal, an Integer, set to that same size as before. (10 too in this example)
SequenceCurrent, another Integer, to keep track of what numbers we already used.


Code:
RandomSequenceInit
    Events
        Map initialization
    Conditions
    Actions
        Set SequenceTotal = 10
        For each (Integer A) from 1 to SequenceTotal, do (Actions)
            Loop - Actions
                Set Sequence[(Integer A)] = (Integer A)
        Set SequenceCurrent = SequenceTotal

That's the preparation.
It simply sets:
Sequence[1] to 1,
Sequence[2] to 2,
...
Sequence[SequenceTotal] to SequenceTotal.

That's not very random yet, now is it? :)


The "trick" comes when you use it:

Code:
Actions
    Set tmpInteger = (Random integer number between 1 and SequenceCurrent)

    --- Do something with "Sequence[tmpInteger]" ---
    Game - Display to (All players) the text: (String(Sequence[tmpInteger]))

    --- Prepare for the next run ---
    Set Sequence[tmpInteger] = Sequence[SequenceCurrent]
    Set SequenceCurrent = (SequenceCurrent - 1)

Uses some temporary variable, of type Integer. I called it "tmpInteger" here.

This will generate all numbers between 1 and SequenceTotal,
in some random order, every number appearing exactly once.

That's all there is to it. :cool:



What if you need this more than once?

Well, forget the second trigger above,
and use this one instead:

Code:
Actions
    Set tmpInteger1 = (Random integer number between 1 and SequenceCurrent)
    Set tmpInteger2 = Sequence[tmpInteger1]

    --- Do something with "tmpInteger2" ---
    Game - Display to (All players) the text: (String(tmpInteger2))

    --- Prepare for the next run ---
    Set Sequence[tmpInteger1] = Sequence[SequenceCurrent]
    Set Sequence[SequenceCurrent] = tmpInteger2
    Set SequenceCurrent = (SequenceCurrent - 1)
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        If - Conditions
            SequenceCurrent Equal to 0
        Then - Actions
            Set SequenceCurrent = SequenceTotal
        Else - Actions

Needs two temporary variables, both of type Integer.

This will, as before, generate every number exactly once.
And, once done, will start over with a new non-repeating random sequence
with every number between 1 and SequenceTotal exactly once.


Final note:
If you need more, or less, numbers, there's only two things to change:
- the array size of "Sequence"
- "SequenceTotal" (in the very first trigger)

Yes, it's that simple.


Have fun and happy mapping.


Yours,
AceHart


P.s.: We're actually generating a random permutation.

P.p.s.: Put here by popular demand ;)
 

Grundy

Ultra Cool Member
Reaction score
35
hey im bored at school just thought i'd show you guys how i make 2-dimensional arrays in the wc3 editor that only allows single dimensional arrays.
i did a search and couldnt find anything so if it's already on here somewhere dont blame me i did look.

if you want a 2d array (X rows, Y columns) you first have to make a regular array of size X*Y for this you could keep track of strength, agility, intelligence, for heroes of 10 different players you would want either 10 rows and 3 columns for 3 rows and 10 columns, doesnt really matter. the 10 is the heroes and the 3 is the stat.

here i'll say 3 rows with 10 columns
Code:
     [Hero1][Hero2][Hero3][Hero4][Hero5][Hero6][Hero7][Hero8][Hero9][Hero10]
[STR][  1  ][  2  ][  3  ][  4  ][  5  ][  6  ][  7  ][  8  ][  9  ][ 10  ]
[AGI][ 11  ][ 12  ][ 13  ][ 14  ][ 15  ][ 16  ][ 17  ][ 18  ][ 19  ][ 20  ]
[INT][ 21  ][ 22  ][ 23  ][ 24  ][ 25  ][ 26  ][ 27  ][ 28  ][ 29  ][ 30  ]
these numbers here will be the actual index of the values i want in my array. if i want to find hero5's agility i would need index 15. but it could be hard to try to remember every index of every stat from every hero. Or you could just write down a chart like this, but then you would have to look at it every time you want to use something. But if you want to use my way its much easier all you have to do is copy down the formula and change the row and column. so here it is:
Code:
HeroStats[((Row-1)*MaxColumns)+Column]
MaxColumns will always stay the same for each array but it can be different from another array. in this example MaxColumns would be 10.
now if i want to get Hero5's Agility, here 5 would be column 5 and agility is row 2, so you just click and put in 2 and 5 for the row and column in the editor and keep maxcolumns at 10 and you'd have this:
Code:
HeroStats[((2-1)*10)+5]
if you do the math you will see that the expression for the index will come out to 15. you can use this to find any element of the array.

sometimes its better to use multiple 1 dimesional arrays, but sometimes, like in loops, using a 2 dimensional array would be much easier when you do something like....
Code:
For each (Integer A) from 1 to 3, do (Actions)
    Loop - Actions
        For each (Integer B) from 1 to 10, do (Actions)
            Loop - Actions
                Set Array[((((Integer A) - 1) x 10) + (Integer B))] = (some value or expression)
 
S

ShaiTan-Enk

Guest
Really Fun Triggers

In this map are a series of fun and helpful triggers. That is, some are fun, and some are helpful.

Helpful Triggers:
*Use a very small number of triggers for any amount of waves (as in on a TD, which is what this map is).
*A kick trigger which brings up a menu that you can click on to decide who you want to kick.
*A trigger that stops anyone from being able to kick you. Aka it blocks you from being kicked.
*A trigger that unblocks people who have blocked themselves from being kicked. (Yeah, I know, I've gone insane)
*A trigger used to permanently ban people from playing the game. Only to be used in extreme cases.
*A trigger, or series of triggers, which are used to move attacking creeps if they get stuck. It uses their mana to tell them which region to head towards.
*Triggers that destroy anyone who is building in your area. They activate when you type "-destroy (your color)". Really helpful for TDs.
*Triggers that create a Solo/Team vote in the beginning of the game (The vote appears menu-style).
*Many more triggers that people may find useful, if they did not know how do to such things before looking in the trigger editor for this map.​

Fun Triggers:
*A trigger that brings up a cheat menu (menu!) with these options:
-Completely eradicate someone
-Steal gold from anyone (you have a choice)
-Steal buildings from anyone (you have a choice)
-Return stolen buildings
-Get more builders (it creates a builder chooser for whoever you want)
-Get gold (it gives gold to whoever you want)
-Mess with someone's head (it destroys 1 random unit belonging to that person every 30 seconds)​
*A trigger that lets you set yourself as admin - you get messages whenever someone accesses the cheat menu, and it tells you exactly what they are doing.
*A trigger that lets you type messages so that they appear as Game Displays. It's a really really fun trigger to use. The messages appear in red.
*A trigger that does the same thing, but you get to pick the color. You have to know html color codes to use this option. (Warcraft III uses html color codes, if with a slightly different beginning sequence).
*A trigger that lets you make yes/no votes in-game. The votes come up menu-style.
*A trigger that lets you make votes in-game where the possible choices are the colors of the people playing. The votes come up menu-style.​

A side note: When typing cheats/vote commands/commands to write messages that appear as Game Displays, it's generally considered wise to type to Observers so that other players dont learn the cheats.

Another side note: If you're thinking of playing this map, please don't, since it's only 1/2 done.
 

Attachments

  • DeatH tD 1 beta 1.31.w3m
    227.1 KB · Views: 1,746

AgentPaper

From the depths, I come.
Reaction score
107
Here is a map with a couple random triggers i have made for people requesting help in this forum, ill try to keep this updated

AgentPapers random list of helpful triggers!


Trigger descriptions, by catagory number:

1) Gives gold periodically to whoever has the most units in the middle.

2) Places the base for all players ingame in random locations.

3) Zooms any players camera out a bunch when they type -zoom.

4) Gives +2 to all stats of any heros that have not died in the past 5 minutes.

5) Makes a unit deal 20% of the attacked units remaining HP.

6) Boot System that uses player numbers and a dialog screen.

7) Gives players random heros when red types -allrandom or -ar

8) Revives a hero 30 seconds after it dies, and gives 100g to the killing player.

9) Makes the player's camera follow a unit in third-person.

10) Move system. (not yet finished, but functionalish)

11) Kills a unit if its mana hits 0.

12) First Blood, Double Kill, and Killing Spree.

13) Gives all heros +1 to all stats periodically.

14) Spawns monsters TD style.

15) Hero pick with dialogs using race-alignment-type.


Just copy and paste the category with the triggers you want. Make sure to enable the triggers
 

Attachments

  • (0) helper.net trigers.w3x
    30.6 KB · Views: 1,918
T

team.ism

Guest
Finding the X and Y coordinates

This is a simple little code that I came up with to find the x and y coordinates of a unit. This is useful to anybody who ever wondered what the x and y coordinates were.
 

Attachments

  • coordinates.w3x
    12.7 KB · Views: 480
D

Deathshadow

Guest
Here is a leader board system.
Code:
Kill Add   
   Events
        Unit - A unit Dies
    Conditions
    Actions
        Cinematic - Flash a speech indicator for (Killing unit) of color (0.00%, 100.00%, 0.00%) with 0.00% transparency
        Cinematic - Flash a speech indicator for (Dying unit) of color (100.00%, 0.00%, 0.00%) with 0.00% transparency
        Set Kill_Count[(Player number of (Owner of (Killing unit)))] = (Kill_Count[(Player number of (Owner of (Killing unit)))] + 1)
        Leaderboard - Change the value for (Owner of (Killing unit)) in (Last created leaderboard) to Kill_Count[(Player number of (Owner of (Killing unit)))]


Code:
LeaderBoard 
    Events
        Map initialization
    Conditions
    Actions
        Wait 0.50 seconds
        -------- Make a new leaderboard --------
        Leaderboard - Create a leaderboard for (All players) titled Kills
        Leaderboard - Show (Last created leaderboard)
        -------- Add Cops to the board --------
        Player Group - Pick every player in (All allies of Player 1 (Red)) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Picked player) slot status) Equal to Is playing
                    Then - Actions
                        Leaderboard - Add (Picked player) to (Last created leaderboard) with label (((( + (String((Player number of (Picked player))))) + )) + (Name of (Picked player))) and value Kill_Count[(Player number of (Picked player))]
                    Else - Actions
        -------- Add a line to split the two teams --------
        Leaderboard - Add Neutral Victim to (Last created leaderboard) with label -------------------... and value (Integer(-))
        -------- Add Robbers to the board --------
        Player Group - Pick every player in (All allies of Player 7 (Green)) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Picked player) slot status) Equal to Is playing
                    Then - Actions
                        Leaderboard - Add (Picked player) to (Last created leaderboard) with label (((( + (String((Player number of (Picked player))))) + )) + (Name of (Picked player))) and value Kill_Count[(Player number of (Picked player))]
                    Else - Actions
 
B

BlizzScripts

Guest
This is for Single Player , that now blizzard blocked cheats.j:
for now i will be posting iseedeadpeople
soon greedisgood (updating )
iseedeadpeople
Events
Time - Every 1.01 seconds of game time
Conditions
(bj_isSinglePlayer == true)
(Fog of war is enabled) Equal to False
Actions
Game - Display to (All players) the text: iseedeadpeople is not allow!
Custom script: call FogEnableOn()
 
S

soulbad

Guest
This trigger is for when you type a message containing a space a floating text will appear above your hero set P1talks and and p2talks to heros that are used by the players, this is good for rpgs. you can also keep going on and on all the way to p12talks and set that to a unit that is player 12's hero


Code:
 Talking
    Events
        Player - Player 1 (Red) types a chat message containing   as A substring
        Player - Player 2 (Blue) types a chat message containing   as A substring
        Player - Player 3 (Teal) types a chat message containing   as A substring
        Player - Player 4 (Purple) types a chat message containing   as A substring
        Player - Player 5 (Yellow) types a chat message containing   as A substring
        Player - Player 6 (Orange) types a chat message containing   as A substring
        Player - Player 7 (Green) types a chat message containing   as A substring
        Player - Player 8 (Pink) types a chat message containing   as A substring
        Player - Player 9 (Gray) types a chat message containing   as A substring
        Player - Player 10 (Light Blue) types a chat message containing   as A substring
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Triggering player) Equal to Player 1 (Red)
            Then - Actions
                Floating Text - Destroy (Last created floating text)
                Floating Text - Create floating text that reads (Entered chat string) above P1Talks with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
                Wait 2.00 seconds
                Floating Text - Destroy (Last created floating text)
            Else - Actions
And then repeat the if/then else all the way to however many players you want this for.
 

Attachments

  • Floating Text.w3x
    15.6 KB · Views: 515
T

Taures

Guest
I don't know if you need it or not but ive seen a few posts asking about how to trigger a gate to work for only x player(s) so I deicded id make one =D.

P.S. you have to make indivdual open/close triggers for each color when using multiple players on the same gate.
 

Attachments

  • Gate Trigger.w3m
    13 KB · Views: 483
T

The_ChRiS

Guest
Random Color Code Generator

I am pretty new to JASS and i have made a random color code maker.

Code:
function CreateRandomColorCode takes nothing returns nothing
 local string array sPick
 local string sstart = "|c"
 local string scode = ""
 local integer iPick = 0
 local integer iNum = 0
 local integer ispot = 0

    set iPick = GetRandomInt( 1,16 )
    loop
        exitwhen ispot == 8
        if (iPick == 1) then
            set sPick[ispot] = "a"
            set iPick = GetRandomInt( 1,16 )
            set ispot = (ispot + 1)
        endif
       
        if (iPick == 2) then
            set sPick[ispot] = "b"
            set iPick = GetRandomInt( 1,16 )
            set ispot = (ispot + 1)
        endif
 
        if (iPick == 3) then
            set sPick[ispot] = "c"
            set iPick = GetRandomInt( 1,16 )
            set ispot = (ispot + 1)
        endif

        if (iPick == 4) then
            set sPick[ispot] = "d"
            set iPick = GetRandomInt( 1,16 )
            set ispot = (ispot + 1)
        endif

        if (iPick == 5) then
            set sPick[ispot] = "e"
            set iPick = GetRandomInt( 1,16 )
            set ispot = (ispot + 1)
        endif

        if (iPick == 6) then
            set sPick[ispot] = "f"
            set iPick = GetRandomInt( 1,16 )
            set ispot = (ispot + 1)
        endif

        if (iPick == 7) then
            set sPick[ispot] = "0"
            set iPick = GetRandomInt( 1,16 )
            set ispot = (ispot + 1)
        endif

        if (iPick == 8) then
            set sPick[ispot] = "1"
            set iPick = GetRandomInt( 1,16 )
            set ispot = (ispot + 1)
        endif

        if (iPick == 9) then
            set sPick[ispot] = "2"
            set iPick = GetRandomInt( 1,16 )
            set ispot = (ispot + 1)
        endif


        if (iPick == 10) then
            set sPick[ispot] = "3"
            set iPick = GetRandomInt( 1,16 )
            set ispot = (ispot + 1)
        endif

        if (iPick == 11) then
            set sPick[ispot] = "4"
            set iPick = GetRandomInt( 1,16 )
            set ispot = (ispot + 1)
        endif

        if (iPick == 12) then
            set sPick[ispot] = "5"
            set iPick = GetRandomInt( 1,16 )
            set ispot = (ispot + 1)
        endif

        if (iPick == 13) then
            set sPick[ispot] = "6"
            set iPick = GetRandomInt( 1,16 )
            set ispot = (ispot + 1)
        endif

        if (iPick == 14) then
            set sPick[ispot] = "7"
            set iPick = GetRandomInt( 1,16 )
            set ispot = (ispot + 1)
        endif

        if (iPick == 15) then
            set sPick[ispot] = "8"
            set iPick = GetRandomInt( 1,16 )
            set ispot = (ispot + 1)
        endif
   
        if (iPick == 16) then
            set sPick[ispot] = "9"
            set iPick = GetRandomInt( 1,16 )
            set ispot = (ispot + 1)
        endif
    endloop
  
        if (ispot == 8) then
            set scode = (sstart+sPick[0]+sPick[1]+sPick[2]+sPick[3]+sPick[4]+sPick[5]+sPick[6]+sPick[7])
            set udg_COLORCODE = scode
        endif
endfunction


It is very simple, it simply randomly generates a value for each spot in the color code. It even sets the code as a easily accessed variable! It may not be much but it's my first true JASS function.

Edit: I just checked and this nifty guy can generate over 250 MILLION different codes. (WOW)
 
K

Kadgar

Guest
How To Create a Timer​

Code Made By Darksol​

This is a repeating countdown timer

This is the way to basically start the timer and create a window under Actions-->Countdown Timer= XX, XX= actions u can do w/ a timer window like change color of timer, pause timer, destory timer window ect. . .

The underlined parts of this trigger mean u can change them to a "One-shot timer" meaning timer will go away after 1 time: hence this trigger:

Code:
Untitled Trigger 002
    Events
        Time - Elapsed game time is [U]1.00 seconds[/U]
        Time - [U]Every 60.00[/U] seconds of game time
    Conditions
    Actions
        Countdown Timer - Create a timer window for (Last started timer) with title [U]Countdown Timer. . .[/U]
        Countdown Timer - Start (Last started timer) as a One-Shot that will expire in [U]60.00 seconds[/U]

This is a One Time (One-shot) Timer

Code:
Untitled Trigger 002
Events
Time - Elapsed game time is [U]1.00 seconds[/U]
Time - [U]Every 60.00[/U] seconds of game time
Conditions
Actions
Countdown Timer - Create a timer window for (Last started timer) with title [U]Countdown Timer. . .[/U]
Countdown Timer - Start (Last started timer) as a One-Shot that will expire in [U]60.00 seconds[/U]
 

Tonks

New Member
Reaction score
160
Mazes: Continue Trigger

This trigger allows players to have multiple chances in mazes. i.e, all the mazers are dead, but they still have 2 continues, they'll be able to respawn at the last checkpoint. NOTE: If you have checkpoints that kill all the mazers, then revive them, you will have to put in another action to turn off continues, then turn them back on once everyone has been revived.
This trigger has four parts to it, so you should probably create a seperate folder accordingly.
You will also need a variable named Continues. It will be an Integer Variable and it will have 3 for it's initial value. *Note that the initial value is the number of continues you will have*
Firstly, you must create a region called "Respawn".
Place the region in your first checkpoint, or starting area.
The four trigger will be labelled "Regular" "Leaderboard" "Defeat" and "Respawn".
Code:
Regular
    Events
        (Unit) dies
        [I]*Repeat for all maze units*[/I]
    Conditions
        (All units in (Units of type Mazer) are dead) equal to True
    Actions
        Set Continues = (Continues -1)
        Wait 2 Seconds
        If (Continues equal to -1) then do (Trigger- Run Defeat <Gen> ignoring conditions) else do (Trigger- Run Respawn <Gen> ignoring conditions)
Now we must create the second trigger, Leaderboard.
Code:
Leaderboard
    Events
        Elapsed game time is 0.00 seconds
    Conditions
        None
    Actions
        Leaderboard- Create a leaderboard for (All Players) Titled (Your title here)
        Leaderboard- Add Player 10 (Light Blue) to (Last Created Leaderboard) with label (Continues) and value (Continues) [I]*Note that the value is the VARIABLE continues, and the label is just a name.*[/I]
In the Leaderboard, it does not matter which player you choose. I just chose Light Blue because it's a nice color.
Now we must create the third trigger, Respawn.
Code:
Respawn
    Events
        None
    Conditions
        None
    Actions
        Game- Display to (all players) the text: ((String(Continues)) +  continues left!)
        Player Group- Pick every player in (All Players) and do (Camera- Pan camera for (picked player) to (Center of Respawn) over 0.25 seconds)
        Leaderboard- Change the value for Player 10 (Light Blue) in (Last Created Leaderboard) to Continues
        Wait 0.75 seconds
        Unit Group- Pick every unit in (Units of type Mazer) and do (Hero- Instantly Revive (Picked unit) at (Random point in Respawn), Show/Hide revival Graphics
Notice that I have no Event. That is because this trigger is just a counterpart to the Regular trigger. Regular will run this trigger if the mazers have continues left. Note: The first action in this, where it displays to all players Continues + continues left!, I used Concentrate Strings. Also, the "Continues" in ((String(Continues)) is the Variable Continues.
By now, you may have noticed a problem. "What about the respawn region?! What if we get to another checkpoint? Will we still revive at the start?" you may think. Well, to solve that, in each Checkpoint trigger you must make an action that moves the Respawn region to that checkpoint region. I suggest making the Respawn region small, so that units cannot accidentally spawn outside of the generic Checkpoint.
Now to create our final trigger part, Defeat!
Code:
Defeat
    Events
        None
    Conditions
        None
    Actions
        Leaderboard- Destroy (Last Created Leaderboard)
        Countdown Timer- Start (last started timer) as a One-Shot Timer that will expire in 10.00 seconds.
        Countdown Timer- Create a timer window for (last started timer) with title (Time to Talk:)
        Cinematic- Fade out over 10.00 seconds using texture Black Mask and color (0.00%, 0.00%, 0.00%) with 0.00% transparency
        Wait 10.00 Seconds
        Countdown Timer- Destroy (Last Created timer window)
        Player Group- Pick every player in (all players) and do (Game- Defeat (picked player) with the message: [I]*Your defeat message here*[/I])
This is another trigger that will not run by itself. It requires the Regular trigger to start it, and it will do so when you run out of continues. This trigger displays a Timer saying Time to Talk: 10.. 9.. 8.. and so on, until the screen blacks out and they are given your Defeat message.

I hope this trigger helps all Maze-Makers. If you have any questions about it, or any questions about other Maze triggers, you can PM me on this forum, or better yet, e-mail me at [email protected].
Good luck! :D
 
M

Matzio

Guest
Set the Daytime

Made a trigger to make Red able to change the game time.
It was a bit tricky to get this working, if you wrote 15.50 it sat the time to 15.30 because it's made of, what it's called... Whell, 10.
I had to make a converter that made 15.50 to 15.83.
First I had 3 Variables. But I changed it down to 2.
It's possible to make it only one variable, but then it'd be a very long row.

Code:
Day Time
    Events
        Player - Player 1 (Red) types a chat message containing set time:  as A substring
    Conditions
    Actions
        Set T_convert_Real = ((Real((Substring((Entered chat string), 14, 15)))) x ((10.00 / 6.00) / 100.00))
        Set T_convert = ((Real((Substring((Entered chat string), 11, 12)))) + T_convert_Real)
        Game - Display to (All players) the text: ((The Time of day is  + (Substring((Entered chat string), 11, 15))) + ( According to  + (Name of Player 1 (Red))))
        Game - Set the time of day to T_convert

Note the space "set time: "

I've attached the map.
I've changed that 24 game hours is the same as 24 real hours.
I was thinking, when all these 14 year olds are playing all night, he could change the time in the game to what's on his watch, then he'll see that it's dark and maybe he should go to bed... ;)
You could also see how a timer's made. I guess there's alot of timers here already.
I've written something to all the triggers.
In the Initialization trigger I've written answers to some possible questions.
 

Attachments

  • Set Time.w3x
    29.7 KB · Views: 389

Knights

You can change this now in User CP.
Reaction score
71
First Person Camera
This is quite like the Third Person one, but requires a different camera angle
and an offset.

Code:
[B]Events[/B]
    Time - Every 0.03 seconds of game time
[B]Conditions[/B]
    [I]None[/I]
[B]Actions[/B]
    For Each Integer A from 1 to 12
        Loop - Actions
            Set TempGroup = (Units Owned By (Player (Integer A)))
            Set RandomUnit = (Random unit from TempGroup)
            Custom Script: call DestroyGroup(udg_TempGroup)
            Set Pos = (Position of RandomUnit)
            Set PoRU = (Pos offset by (500) to (Facing angle of RandomUnit[Player(Integer A)) for (Player(Integer A))
            Custom Script: call RemoveLocation(udg_Pos)
            Set UnitAngle = (Facing of RandomUnit)
            Camera - Lock camera target for (Player(Integer A)) to RandomUnit, offset by (0.00, 0.00) using Default Rotation
            Camera - Set (Player(Integer A)) camera Rotation to UnitAngle over 0.00 seconds
            Camera - Pan camera to PoRU for (Player(Integer A)
            Custom Script: call RemoveLocation(udg_PoRU)
This will offset the camera to the unit plus 500 in the way its facing. That way you get the idea like you are in his head. TO make it work for you, change the offset, and the RandomUnit. That way, you will get it to work exactly for the unit you want and for the offset you would like.
 
Status
Not open for further replies.
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top