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

Colored Ping Quest System v1.0.0.3

  • Like
Reactions: LovG and GywGod133
Well i bring yet another system. This is made for those maps with a lot of quests.
It is a colored ping system. Rather than having all quests show the same color you can simply change colors by using a short command (- questName). Its as simple as that. ( the - space command is changeable.)
You can also ping the location again instead of those games were u have to remember the exact location u simply do (-ping questName). Also changeable.

This system allows you to easily see which quest is which.
I've played some maps with 10 quests at a time. Well that was always i pain if i wanted to do a specific one. With this each quest gets its own unique color. ( you can change the colors and the amount of possible colors for pings using RGB values.)

The full list of functions / Custom script are in the top of the main code. There are explanations on how to use them.

This is GUI Friendly and easy to import.

Importing Steps
1) copy the config trigger first.
2) delete the variables that i put under the comments that said to delete them in the config trigger after posted.
3) copy the code trigger second.
4) set the string to what you want and try it out.
5) Make sure all quests are created after 0.01 time elapsed in your map when u use this resource.

  • ColoredPingConfig
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Here you can change the colors if u want they are in RGB values. Don't set red to 255 when green and blue are 0. --------
      • -------- I preset these colors. Feel free to change them. Also make sure to change the last index if u add or remove the amount of indexed colors. --------
      • -------- red --------
      • Set pingColorRed[1] = 255
      • Set pingColorGreen[1] = 2
      • Set pingColorBlue[1] = 2
      • -------- blue --------
      • Set pingColorRed[2] = 0
      • Set pingColorGreen[2] = 65
      • Set pingColorBlue[2] = 255
      • -------- teal --------
      • Set pingColorRed[3] = 27
      • Set pingColorGreen[3] = 229
      • Set pingColorBlue[3] = 184
      • -------- purple --------
      • Set pingColorRed[4] = 83
      • Set pingColorGreen[4] = 0
      • Set pingColorBlue[4] = 128
      • -------- yellow --------
      • Set pingColorRed[5] = 255
      • Set pingColorGreen[5] = 255
      • Set pingColorBlue[5] = 0
      • -------- orange --------
      • Set pingColorRed[6] = 254
      • Set pingColorGreen[6] = 137
      • Set pingColorBlue[6] = 13
      • -------- green --------
      • Set pingColorRed[7] = 31
      • Set pingColorGreen[7] = 191
      • Set pingColorBlue[7] = 0
      • -------- pink --------
      • Set pingColorRed[8] = 228
      • Set pingColorGreen[8] = 90
      • Set pingColorBlue[8] = 170
      • -------- gray --------
      • Set pingColorRed[9] = 148
      • Set pingColorGreen[9] = 149
      • Set pingColorBlue[9] = 150
      • -------- light blue --------
      • Set pingColorRed[10] = 125
      • Set pingColorGreen[10] = 190
      • Set pingColorBlue[10] = 241
      • -------- dark green --------
      • Set pingColorRed[11] = 15
      • Set pingColorGreen[11] = 97
      • Set pingColorBlue[11] = 69
      • -------- brown --------
      • Set pingColorRed[12] = 77
      • Set pingColorGreen[12] = 41
      • Set pingColorBlue[12] = 3
      • -------- Last index --------
      • Set pingColorCodesMaxIndex = 12
      • -------- --------
      • -------- This string is the string that players enter to change the ping of the quest name they enter. --------
      • -------- I have it set to (- ) --------
      • -------- So to make this work the player must type in (- ) then the quest name. So lets say the quest name is The Horde. They must type in (- The Horde) --------
      • -------- Caps does matter so make sure they know that. Also make sure they know the exact name u entered to be the quest name. --------
      • Set changeQCPString = -
      • -------- --------
      • -------- --------
      • -------- This string is the string that players enter to ping the quest location again. --------
      • -------- I have it set to (-ping ) --------
      • -------- So to make this work the player must type in (-ping ) then the quest name. So lets say the quest name is The Horde. They must type in (-ping The Horde) --------
      • -------- Caps does matter so make sure they know that. Also make sure they know the exact name u entered to be the quest name. --------
      • Set pingAgainQCPString = -ping
      • -------- --------
      • -------- --------
      • -------- Delete everything under here after posting --------
      • Set changeQCPLength = 0
      • Set pingAgainQCPLength = 0
      • Set pingIntegerColorIndex[0] = 0
      • Set pingLocations[0] = pingLocations[0]
      • Set pingQuestColoredDuration[0] = 0.00
      • Set pingQuestColoredX[0] = 0.00
      • Set pingQuestColoredY[0] = 0.00
      • Set pingQuestIntArray[0] = 0
      • Set pingQuestNameIndex = 0
      • Set pingString[0] = <Empty String>
JASS:
    // Colored Ping Quest System  by deathismyfriend
    // version 1.0.0.3

    
    // This function sets the ping on the minimap just like u would normally do.
    // To use this u need to use custom script. its rather easy tho. Here is how u call it in custom script.
    // Custom script:   call AddQuestColoredPingsLoc( string questName, location loc, real duration)
    // the things in the parenthesis are the arguements. 
    // So for for example call AddQuestColoredPingsLoc(  "Your Quest Name",  udg_tempPoint,  10.00)
    // This will set the quest name to Your Quest Name. This is how u will do commands for the ping of the quest.
    // it will set the position to a tempPoint u have made and the time to 10.00 till it disapears.
    // function AddQuestColoredPingsLoc takes string questName, location loc, real duration returns nothing
    
    // This function sets the ping on the minimap just like above but u use X/Y values rather than locations that leak.
    // Custom script:   call AddQuestColoredPingsXY( string questName, real x, real y, real duration)
    // function AddQuestColoredPingsXY takes string questName, real x, real y, real duration returns nothing
    
    // This function allows you to change the quests ping location at any point in the game you want.
    // changes the location and duration
    // Custom script:   call ChangeQuestPingColorLoc( string questName, location loc, real duration)
    // function ChangeQuestPingColorLoc takes string questName, location loc, real duration returns nothing
    
    // This function changes the ping location on the minimap just like above but u use X/Y values rather than locations that leak.
    // Custom script:   call ChangeQuestPingColorXY( string questName, real x, real y, real duration)
    // function ChangeQuestPingColorXY takes string questName, real x, real y, real duration returns nothing
    
    // This function allows you to delete the ping after the quest has been completed.
    // Custom script: call function RemoveQuestColoredPing( string questName)
    // function RemoveQuestColoredPing takes string questName returns nothing
    
    function SetPingColorIndex takes nothing returns integer
        local integer r = GetRandomInt( 1, udg_pingColorCodesMaxIndex)
        local integer i = udg_pingIntegerColorIndex[ r]
        
        // this array keeps track of the indexes used for the color codes.
        set udg_pingIntegerColorIndex[ r] = udg_pingIntegerColorIndex[ udg_pingColorCodesMaxIndex]
        
        // this integer keeps track of the # of available color codes.
        set udg_pingColorCodesMaxIndex = udg_pingColorCodesMaxIndex - 1
        return i
    endfunction
    
    function GetPingColorIndex takes string questName returns integer
        local integer L = 1
        loop
            exitwhen L > udg_pingQuestNameIndex
            if udg_pingString[ L] == questName then
                return L
            endif
            set L = L + 1
        endloop
        return 0
    endfunction
    
    function RegisterPingColorXYDuration takes integer i, real x, real y, real duration returns nothing //  i is the index
        set udg_pingQuestColoredDuration[ i] = duration
        set udg_pingQuestColoredX[ i] = x
        set udg_pingQuestColoredY[ i] = y
    endfunction
    
    function AddQuestColoredPingsLoc takes string questName, location loc, real duration returns nothing
        local integer i
        local real x = GetLocationX( loc)
        local real y = GetLocationY( loc)
        set udg_pingQuestNameIndex = udg_pingQuestNameIndex + 1
        if udg_pingQuestNameIndex >= udg_pingColorCodesMaxIndex then
            set udg_pingQuestNameIndex = 1
        endif
        set udg_pingString[ udg_pingQuestNameIndex] = questName
        
        // the integer array links the quest string with the integer used for the pings colors.
        set udg_pingQuestIntArray[ udg_pingQuestNameIndex] = SetPingColorIndex()
        
        // i set this to a variable to make the code easier to read.
        set i = udg_pingQuestIntArray[ udg_pingQuestNameIndex]
        call RegisterPingColorXYDuration( udg_pingQuestNameIndex, x, y, duration)
        call PingMinimapEx( x, y, duration, udg_pingColorRed[ i], udg_pingColorGreen[ i], udg_pingColorBlue[ i], false)
    endfunction
    
    function AddQuestColoredPingsXY takes string questName, real x, real y, real duration returns nothing
        local integer i
        set udg_pingQuestNameIndex = udg_pingQuestNameIndex + 1
        if udg_pingQuestNameIndex >= udg_pingColorCodesMaxIndex then
            set udg_pingQuestNameIndex = 1
        endif
        set udg_pingString[ udg_pingQuestNameIndex] = questName
        
        // the integer array links the quest string with the integer used for the pings colors.
        set udg_pingQuestIntArray[ udg_pingQuestNameIndex] = SetPingColorIndex()
        
        // i set this to a variable to make the code easier to read.
        set i = udg_pingQuestIntArray[ udg_pingQuestNameIndex]
        
        // These are keyed to the same index as the pingString index
        call RegisterPingColorXYDuration( udg_pingQuestNameIndex, x, y, duration)
        call PingMinimapEx( x, y, duration, udg_pingColorRed[ i], udg_pingColorGreen[ i], udg_pingColorBlue[ i], false)
    endfunction
    
    function ChangeQuestColoredPing takes nothing returns boolean
        local string entered = GetEventPlayerChatString()
        local integer old
        local integer new
        local integer i
        local integer i1
        local integer r
        
        // QCP means quest colored ping
        if SubString( entered, 0, udg_changeQCPLength) == udg_changeQCPString then
        
            // loads the old index key that was used for the colors.
            set i = GetPingColorIndex( SubString( entered, udg_changeQCPLength, StringLength( entered)))
            if i != 0 then
                
                // the integer array links the quest string with the integer used for the pings colors.
                // this is the old value.
                set old = udg_pingQuestIntArray[ i]
                set r = GetRandomInt( 1, udg_pingColorCodesMaxIndex)
                set new = udg_pingIntegerColorIndex[ r]
                
                // Now I have to change out the integers.
                set udg_pingIntegerColorIndex[ r] = old
                
                // this is now the new value.
                set udg_pingQuestIntArray[ i] = new
                set i1 = udg_pingQuestIntArray[ i]
                call PingMinimapEx( udg_pingQuestColoredX[ i], udg_pingQuestColoredY[ i], udg_pingQuestColoredDuration[ i], udg_pingColorRed[ i1], udg_pingColorGreen[ i1], udg_pingColorBlue[ i1], false)
            else
                call DisplayTextToPlayer( GetTriggerPlayer(), 0, 0, "Sorry the quest name you have entered does not exist in the Ping Color Database.")
            endif
        endif
        return false
    endfunction
    
    // changes the location and duration
    function ChangeQuestPingColorLoc takes string questName, location loc, real duration returns nothing
        local integer i = GetPingColorIndex( questName)
        call RegisterPingColorXYDuration( i, GetLocationX( loc), GetLocationY( loc), duration)
    endfunction
    
    // changes the location and duration
    function ChangeQuestPingColorXY takes string questName, real x, real y, real duration returns nothing
        local integer i = GetPingColorIndex( questName)
        call RegisterPingColorXYDuration( i, x, y, duration)
    endfunction
    
    function QuestColoredPingRepeat takes nothing returns boolean
        local string entered = GetEventPlayerChatString()
        local integer i
        local integer i1
        
        // QCP means quest colored ping
        if SubString( entered, 0, udg_pingAgainQCPLength) == udg_pingAgainQCPString then 
        
            // loads the old index key that was used for the colors.
            set i = GetPingColorIndex( SubString( entered, udg_pingAgainQCPLength, StringLength( entered)))
            if i != 0 then
                set i1 = udg_pingQuestIntArray[ i]
                call PingMinimapEx( udg_pingQuestColoredX[ i], udg_pingQuestColoredY[ i], udg_pingQuestColoredDuration[ i], udg_pingColorRed[ i1], udg_pingColorGreen[ i1], udg_pingColorBlue[ i1], false)
            else
                call DisplayTextToPlayer( GetTriggerPlayer(), 0, 0, "Sorry the quest name you have entered does not exist in the Ping Color Database.")
            endif
        endif
        return false
    endfunction
    
    function RemoveQuestColoredPing takes string questName returns nothing
        local integer i = GetPingColorIndex( questName)
        
        // de-index everything
        set udg_pingString[ i] = udg_pingString[ udg_pingQuestNameIndex]
        set udg_pingString[ udg_pingQuestNameIndex] = null
        set udg_pingQuestColoredX[ i] = udg_pingQuestColoredX[ udg_pingQuestNameIndex]
        set udg_pingQuestColoredX[ udg_pingQuestNameIndex] = 0.00
        set udg_pingQuestColoredY[ i] = udg_pingQuestColoredY[ udg_pingQuestNameIndex]
        set udg_pingQuestColoredY[ udg_pingQuestNameIndex] = 0.00
        set udg_pingQuestColoredDuration[ i] = udg_pingQuestColoredDuration[ udg_pingQuestNameIndex]
        set udg_pingQuestColoredDuration[ udg_pingQuestNameIndex] = 0.00
        
        // Now add the old index key for the colors back into the group to allow it to be picked again.
        // this integer keeps track of the # of available color codes.
        set udg_pingColorCodesMaxIndex = udg_pingColorCodesMaxIndex + 1
        // this array keeps track of the indexes used for the color codes. I add the one that was used for that quest back to the array to be used again.
        set udg_pingIntegerColorIndex[ udg_pingColorCodesMaxIndex] = udg_pingQuestIntArray[ i]
        set udg_pingQuestIntArray[ i] = udg_pingQuestIntArray[ udg_pingQuestNameIndex]
        set udg_pingQuestIntArray[ udg_pingQuestNameIndex] = 0
        
        // Finally reduce the index
        set udg_pingQuestNameIndex = udg_pingQuestNameIndex - 1
    endfunction

    function ColoredPingSetup takes nothing returns nothing
        local timer tmr = GetExpiredTimer()
        local integer L = 0
        local trigger t = CreateTrigger()
        local trigger t1 = CreateTrigger()
        
        // This loop checks if the color was set to the attacked unit color ping and changes it slightly.
        loop
            exitwhen L > udg_pingColorCodesMaxIndex
            set udg_pingIntegerColorIndex[ L] = L
            
            // This sets the index used to determine which color gets paired with which quest.
            if udg_pingColorRed[ L] == 255 and udg_pingColorGreen[ L] == 0 and udg_pingColorBlue[ L] == 0 then
                set udg_pingColorRed[ L] = 254
            endif
            set L = L + 1
        endloop
        
        set L = 0
        
        loop
            exitwhen L > 11
            if GetPlayerSlotState( Player( L)) == PLAYER_SLOT_STATE_PLAYING and GetPlayerController( Player( L)) == MAP_CONTROL_USER then
                call TriggerRegisterPlayerChatEvent( t, Player(L), udg_changeQCPString, false)
                call TriggerRegisterPlayerChatEvent( t1, Player(L), udg_pingAgainQCPString, false)
            endif
            set L = L + 1
        endloop
        
        set udg_changeQCPLength = StringLength( udg_changeQCPString)
        set udg_pingAgainQCPLength = StringLength( udg_pingAgainQCPString)
        call TriggerAddCondition( t, Condition( function ChangeQuestColoredPing))
        call TriggerAddCondition( t1, Condition( function QuestColoredPingRepeat))
        call DestroyTimer( tmr)
        set tmr = null
        set t = null
        set t1 = null
    endfunction

    //===========================================================================
    function InitTrig_ColoredPingCode takes nothing returns nothing
        local trigger t = CreateTrigger()
        local timer tmr = CreateTimer()
        call TimerStart( tmr, 0.00, false, function ColoredPingSetup)
        set tmr = null
    endfunction


version 1.0.0.3
Changed things suggested by purge.​
version 1.0.0.2
Fixed a documentation bug.​
version 1.0.0.1
Made some changes as doomlord pointed out.​
version 1.0.0.0
First version released​


Keywords:
quest, quest system, ping, ping system, colored ping, colored pings, GUI, GUI friendly, Jass, deathismyfriend, dimf
Contents

Just another Warcraft III map (Map)

Reviews
15:17, 7th Aug 2013 PurgeandFire: Approved. An original idea and properly executed. Old: Review: http://www.hiveworkshop.com/forums/2395400-post14.html

Moderator

M

Moderator

15:17, 7th Aug 2013
PurgeandFire: Approved. An original idea and properly executed.

Old:
Review:
http://www.hiveworkshop.com/forums/2395400-post14.html
 
Level 16
Joined
Dec 15, 2011
Messages
1,423
REVIEW
[tr][td]
rating_p.gif


Resource Status: Approvable
Review Date: 05:40, 7 August 2013 (GMT +7)
GENERAL
  • You could improve your thread presentation to earn some aesthetic points.
PROS
  • The system seems solid and very useful. I definitely recommend this for those huge RPG maps.
  • It is vanilla JASS and GUI-friendly <3
  • Configuration is available.
CONS
  • Put importing instructions in the map.
  • Be consistent in how you place code comments. Either place it above the code line or next to it. Messing it up causes reduction in readablity.
  • You really need to improve your code's readability. You are supposed to write functions like this call KillUnit(unitArr[1]) not call KillUnit( unitArr[ 1]). It makes your code looks unappealing.
  • Global variables should be NamedLikeThis, not namedLikeThis. Locals are namedLikeThis, not NamedLikeThis (That is right, I am looking at you local integer L).
  • Add more spacing to the code. The more spacing there is, the better the readability. For example:
    JASS:
            loop
                exitwhen L > udg_pingColorCodesMaxIndex
                set udg_pingIntegerColorIndex[ L] = L // This sets the index used to determine which color gets paired with which quest.
                if udg_pingColorRed[ L] == 255 and udg_pingColorGreen[ L] == 0 and udg_pingColorBlue[ L] == 0 then
                    set udg_pingColorRed[ L] = 254
                endif
                set L = L + 1
            endloop
            set L = 0
            loop
                exitwhen L > 11
                call TriggerRegisterPlayerChatEvent( t, Player(L), udg_changeQCPString, false)
                call TriggerRegisterPlayerChatEvent( t1, Player(L), udg_pingAgainQCPString, false)
                set L = L + 1
            endloop
    JASS:
            loop
                exitwhen L > udg_pingColorCodesMaxIndex
    
                set udg_pingIntegerColorIndex[L] = L
    
                // This sets the index used to determine which color gets paired with which quest.
    
                if udg_pingColorRed[L] == 255 and udg_pingColorGreen[L] == 0 and udg_pingColorBlue[L] == 0 then
                    set udg_pingColorRed[L] = 254
                endif
    
                set L = L + 1
            endloop
    
            set L = 0
    
            loop
                exitwhen L > 11
                call TriggerRegisterPlayerChatEvent(t, Player(L), udg_changeQCPString, false)
                call TriggerRegisterPlayerChatEvent(t1, Player(L), udg_pingAgainQCPString, false)
                set L = L + 1
            endloop
  • In function ColoredPingSetup, local trigger t1 is not nulled.
  • PingQuestColoredPingAgain seems weird as a function name. How about QuestColoredPingRepeat?
  • "Sorry the quest name you have entered does not exist in the Ping Color Database." Well this certainly could be improved but hey, I have never seen an apologetic system before :3
  • Local string sub is never used in the ChangeQuestColoredPing function.
[/TD][/tr]
That is all I can see for now. Feel free to speak up if you feel like I misread your code somewhere :)
 
Last edited:
Level 29
Joined
Oct 24, 2012
Messages
6,543
Put importing instructions in the map. Always forget that lol.

Be consistent in how you place code comments. Either place it above the code line or next to it. Messing it up causes reduction in readablity. Ok

You really need to improve your code's readability. You are supposed to write functions like this call KillUnit(unitArr[1]) not call KillUnit( unitArr[ 1]) . It makes your code looks unappealing. I use the space because i believe its easier to read. Its also easier to edit.

Global variables should be NamedLikeThis, not namedLikeThis. Locals are namedLikeThis, not NamedLikeThis (That is right, I am looking at you local integer L ).
Actually, GLOBAL_CONSTANTS_LIKE_THIS, globalVariablesLikeThis, localVariablesLikeThis, StructsLikeThis, ModulesLikeThis, FunctionsLikeThis, etc...
I keep the L like that because if u look at the link mag posted they say in there 1 letter words when using locals can be capitalized or not.

Add more spacing to the code. The more spacing there is, the better the readability. For example: I normally do have more spacing. I was really tired and drunk when i did this lol and will fix. I dont like having as much spacing as u tho lol sry.

In function ColoredPingSetup, local trigger t1 is not nulled. Will fix lol. Same problem as above.

PingQuestColoredPingAgain seems weird as a function name. How about QuestColoredPingRepeat?
"Sorry the quest name you have entered does not exist in the Ping Color Database." Well this certainly could be improved but hey, I have never seen an apologetic system before :3 Thats a good change to the name i couldn't think about names lol. For the message i like people to know what stopped working when something gets messed up.

Local string sub is never used in the ChangeQuestColoredPing function. oops lol
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
using a blank string more than once will cause it to bug.

i use the string to load the data and save the data because the only other way i could think of was to return a unique integer like creating a struct does. But that requires the person to type in that unique integer and for the triggerer using the system to use that integer everytime. I thought that the string were better suited.

You can however make dummy strings. Just make sure there is only one ping instance with each string allowed.

If you are using this to just ping with a different color a blank string will be fine if u ping the location then remove the instance right after like this.

  • Custom script: call AddQuestColoredPingsXY( "", 0, 0, 60)
  • Custom script: call RemoveQuestColoredPing( "")
i also have to update as i missed putting the remove function at the top with the others.
 
Nice idea for the system. Apart from what Doomlord said, I only have a few things to say:

- You should only register the chat events for players who are playing. Computer players and empty slots cannot enter chat messages.
- JassHelper will convert the following to work (it'll add "Condition" around it)
JASS:
call TriggerAddCondition( t, function ChangeQuestColoredPing)
        call TriggerAddCondition( t1, function QuestColoredPingRepeat)

However, if you open ^that on the regular editor, it will bring up an error. You have to add Condition() around it yourself.
- You should have a function to force a ping in an area, without a chat message (like what Chaosy said). Some map maker might want to ping right when the user receives the quest, or after some checkpoint, instead of just when the player types the chat message.

Other than that, nice. It will be ready to be approved.
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
Nice idea for the system. Apart from what Doomlord said, I only have a few things to say:

- You should only register the chat events for players who are playing. Computer players and empty slots cannot enter chat messages.
- JassHelper will convert the following to work (it'll add "Condition" around it)
JASS:
call TriggerAddCondition( t, function ChangeQuestColoredPing)
        call TriggerAddCondition( t1, function QuestColoredPingRepeat)

However, if you open ^that on the regular editor, it will bring up an error. You have to add Condition() around it yourself.
- You should have a function to force a ping in an area, without a chat message (like what Chaosy said). Some map maker might want to ping right when the user receives the quest, or after some checkpoint, instead of just when the player types the chat message.

Other than that, nice. It will be ready to be approved.

1) that makes sense. I just thought it would be more work to check if the player is playing and if the player is a user rather than creating it for all players.

2) i never knew that thanks. Looks like i gotta fix some of my other systems lol.

3) When u use the add quest to ping. It creates the ping right when its added.

This one creates the ping when the quest is registered. AddQuestColoredPingsLoc
same with the x/y function

Edit: updated
 
1) that makes sense. I just thought it would be more work to check if the player is playing and if the player is a user rather than creating it for all players.

2) i never knew that thanks. Looks like i gotta fix some of my other systems lol.

3) When u use the add quest to ping. It creates the ping right when its added.

This one creates the ping when the quest is registered. AddQuestColoredPingsLoc
same with the x/y function

Edit: updated

(1) It can save up to 22 handles (e.g. if the player plays single player), which is not too shabby. :)

(2) Haha yeah, I just recently tested it and found it out.

(3) Oh, my mistake. That should be just fine.
 
Top