System Alliance System

Doug

New Member
Reaction score
1
Dougleton Alliance System
version 1.5
by Doug


This is a vJASS player alliance system easy to implement as long as you have JASS New Gen Pack. Even if you're only experienced with GUI, you can easily implement this system into your map. The system allows players to ally or unally each other in game via -ally color and -unally color (-ally/unally player name or -ally number/-unally number even) chat messages.

Features

+ You can type out the full color name or abreviations when using -ally or -unally. Some examples: -ally lightblue -ally lb -unally orange -ally oj. Player numbers can also be use to ally. For example: -ally 4 You can now even use -ally player name!
+ You can toggle the Alliance system on or off for certain players.
+ A message displays saying who allied who or vise versa. You can toggle this message on or off and easily edit the string "has allied" or "has unallied."
+ Extremely easy to implement.

The Code

JASS:

//            
//           .^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^.
//          /| Dougleton Alliance System v1.5 |\
//  /^^^^^^/ |   Made by Dougleton@Azeroth    | \^^^^^^^^\
// /       \_.________________________________._/         \
// |                                                      | 
// |Simple system that allows players to ally or unally   | 
// |one another using -ally/unally color, number,         |
// |or player name.                                       |
// |You can toggle ally message display on or off in      |
// |the globals. To toggle the system on or off for       |
// |certain players edit struct DAS in the function       |
// |LoadDougletonAllianceSystem()                         |
// |                                                      |
// |Go to map.ruthlessreign.com for help with this system |
// <______________________________________________________>
// |                   Change log                         |
// <______________________________________________________>
// |v1.5  *Rewrote entire code.                           |  
// <______________________________________________________>

library DougletonAllianceSystem initializer InitDougletonAlly

globals
    //Set this to false if you do not want
    //the system displaying a message who
    //allied who, etc.
    private constant boolean Dougleton_Alliance_Messages_On = true 
       
    //Change the Ally or Unally message
    // ex. "Player 1 has unallied Player 2"
    private constant string AllyMessage = "has allied"             
    private constant string UnallyMessage = "has unallied"         
endglobals

struct DAS extends array
    string col   //Player's color code example "|cffFF8000"
    string sub1  //Substring1 example "orange"
    string sub2  //Substring2 example "oj"
    string num1  //Player Number example "5"
    string name  //Player Name 
    boolean on   //Player able to ally and be allied with?
endstruct
    
private function LoadDougletonAllianceSystem takes nothing returns nothing
    local integer i = 0
    set DAS[0].col = "|cffFF0000"
    set DAS[0].sub1 = "red"
    set DAS[0].sub2 = ""
    set DAS[1].col = "|cff0000FF"
    set DAS[1].sub1 = "blue"
    set DAS[1].sub2 = ""
    set DAS[2].col = "|cff00FFFF"
    set DAS[2].sub1 = "teal"
    set DAS[2].sub2 = ""
    set DAS[3].col = "|cff800080"
    set DAS[3].sub1 = "purple"
    set DAS[3].sub2 = "purp"
    set DAS[4].col = "|cffFFFF00"
    set DAS[4].sub1 = "yellow"
    set DAS[4].sub2 = "yel"
    set DAS[5].col = "|cffFF8000"
    set DAS[5].sub1 = "orange"
    set DAS[5].sub2 = "oj"
    set DAS[6].col = "|cff00FF00"
    set DAS[6].sub1 = "green"
    set DAS[6].sub2 = ""
    set DAS[7].col = "|cffFF00FF"
    set DAS[7].sub1 = "pink"
    set DAS[7].sub2 = ""
    set DAS[8].col = "|cff808080"
    set DAS[8].sub1 = "gray"
    set DAS[8].sub2 = "grey"
    set DAS[9].col = "|cff80FFFF"
    set DAS[9].sub1 = "lightblue"
    set DAS[9].sub2 = "lb"
    set DAS[10].col = "|cff008040"
    set DAS[10].sub1 = "darkgreen"
    set DAS[10].sub2 = "dg"
    set DAS[11].col = "|cff804000"
    set DAS[11].sub1 = "brown"
    set DAS[11].sub2 = ""
    loop
    exitwhen i > 11
        set DAS<i>.on = true
        set DAS<i>.num1 = I2S(GetPlayerId(Player(i))+1)
        set DAS<i>.name = GetPlayerName(Player(i))
        set i = i+1
    endloop
    // If you want to turn the alliance system off for specific players
    // below this comment is a good place to do it. ex set DAS[1].on=false
    // Turns it off for Player 2 Blue
    
endfunction

private function Dougleton_Ally_Or_Unally takes nothing returns nothing
    local string s = SubString(GetEventPlayerChatString(), 0, 50)
    local integer p = 11
    local boolean allying
    local integer state
    if DAS[GetPlayerId(GetTriggerPlayer())].on then
        if SubString(s, 0, 2) == &quot;-u&quot; then
            set s = SubString(s, 8, 50)
            set allying = false
            set state = bj_ALLIANCE_UNALLIED
        else
            set s = SubString(s, 6, 50)
            set allying = true
            set state = bj_ALLIANCE_ALLIED_VISION
        endif
        loop
        exitwhen p &lt; 0
            if s == DAS[p].sub1 or s == DAS[p].sub2 or s == DAS[p].num1 or s == DAS[p].name then
                if DAS[p].on then
                    call SetPlayerAllianceStateBJ( GetTriggerPlayer(), Player(p), state )
                    if Dougleton_Alliance_Messages_On then
                        if allying then
                            set s = AllyMessage
                        else
                            set s = UnallyMessage
                        endif
                    call BJDebugMsg( DAS[GetPlayerId(GetTriggerPlayer())].col + DAS[GetPlayerId(GetTriggerPlayer())].name + &quot;|r|cffFFFFFF &quot; + s + &quot; |r&quot; + DAS[p].col + DAS[p].name)
                    endif
                endif
                set p = -1
            else
                set p = p-1
            endif
        endloop
    endif
endfunction

private function InitDougletonAlly takes nothing returns nothing
    local integer i = 0
    local trigger t = CreateTrigger(  )
    call LoadDougletonAllianceSystem()
    loop
    exitwhen i &gt; 11
        call TriggerRegisterPlayerChatEvent( t, Player(i), &quot;-ally&quot;, false )
        call TriggerRegisterPlayerChatEvent( t, Player(i), &quot;-unally&quot;, false )
        set i = i+1
    endloop
    call TriggerAddAction( t, function Dougleton_Ally_Or_Unally)
endfunction
endlibrary



</i></i></i>


Quick Implement

If you're experienced with JASS all you need to do is copy this code into your map header or a trigger box and it is ready to use! If you're not very experienced with JASS, but know the basics of GUI here is a simple process to implement this system:
1. Download the system map file by clicking here.
2. Copy the trigger Dougleton Alliance System and then paste it into your map. Remember this is coded in vJASS so you will need Jass New Gen Pack for this to work.


 

Attachments

  • DougletonAllianceSystemv1_5.w3x
    19.4 KB · Views: 332

Azlier

Old World Ghost
Reaction score
461
You cannot simply copy this into your map header. Why use a library if all you are going to take advantage of are some global variables? The ally and unally triggers will simply not work. Inefficient, as well, with all the SubString hubbub.
 

Doug

New Member
Reaction score
1
You don't copy it into the header you copy each piece into a trigger. Why not use a library?
 

Azlier

Old World Ghost
Reaction score
461
You said:
If you're expereinced with Jass all you need to do is copy that library into your map along with the ally and unally triggers.

Looky there. A good, easy to import script only requires you to highlight all the text and paste it anywhere they like, whether it be the map header or even a normal trigger box.
 

Azlier

Old World Ghost
Reaction score
461
You neglected to mention that the trigger pages must have exact trigger names, otherwise you get syntax errors.
 

Azlier

Old World Ghost
Reaction score
461
And you didn't make it so that a simple copy and paste does the trick why...?
 

Doug

New Member
Reaction score
1
Hmm if its possible i would like to know how. Im guessing it wouldn't be too hard from what you're saying. Im kinda new to vJass so cut me some slack here.
 

Azlier

Old World Ghost
Reaction score
461
JASS:
function InitTrig_JASS_Ally takes nothing returns nothing
    local integer i =0
    set gg_trg_JASS_Ally = CreateTrigger(  )
    loop
    exitwhen i &gt; 11
        call TriggerRegisterPlayerChatEvent( gg_trg_JASS_Ally, Player(i), &quot;-ally&quot;, false )
        set i = i+1
    endloop
    call TriggerAddAction( gg_trg_JASS_Ally, function Dougleton_Ally)
endfunction


Should be

JASS:
function InitTrig_JASS_Ally takes nothing returns nothing
    local integer i =0
    local trigger t = CreateTrigger(  )
    loop
    exitwhen i &gt; 11
        call TriggerRegisterPlayerChatEvent( t, Player(i), &quot;-ally&quot;, false )
        set i = i+1
    endloop
    call TriggerAddAction( t, function Dougleton_Ally)
endfunction

You see what I did there? It can be safely ported into the map header now.
 

Doug

New Member
Reaction score
1
If you do it that way, can it be put in a regular trigger box as well?
 

Azlier

Old World Ghost
Reaction score
461
Bah, ignore my upper post. It wouldn't work.

Here is a good version.

JASS:
scope Ally initializer Init

private function Init takes nothing returns nothing
    local integer i =0
    local trigger t = CreateTrigger(  )
    loop
    exitwhen i &gt; 11
        call TriggerRegisterPlayerChatEvent( t, Player(i), &quot;-ally&quot;, false )
        set i = i+1
    endloop
    call TriggerAddAction( t, function Dougleton_Ally)
endfunction

endscope


I'd read up on the intricates of scopes and libraries. In modern JASS, all code should exist within one.
 

Doug

New Member
Reaction score
1
Sweet dude, i'm going to fix this up then. Thanks for teaching me this trick.

Edit: Ok fixed up!
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Varine Varine:
    How can you tell the difference between real traffic and indexing or AI generation bots?
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air
  • The Helper The Helper:
    New dessert added to recipes Southern Pecan Praline Cake https://www.thehelper.net/threads/recipe-southern-pecan-praline-cake.193555/
  • The Helper The Helper:
    Another bot invasion 493 members online most of them bots that do not show up on stats
  • Varine Varine:
    I'm looking at a solid 378 guests, but 3 members. Of which two are me and VSNES. The third is unlisted, which makes me think its a ghost.
    +1
  • The Helper The Helper:
    Some members choose invisibility mode
    +1
  • The Helper The Helper:
    I bitch about Xenforo sometimes but it really is full featured you just have to really know what you are doing to get the most out of it.
  • The Helper The Helper:
    It is just not easy to fix styles and customize but it definitely can be done
  • The Helper The Helper:
    I do know this - xenforo dropped the ball by not keeping the vbulletin reputation comments as a feature. The loss of the Reputation comments data when we switched to Xenforo really was the death knell for the site when it came to all the users that left. I know I missed it so much and I got way less interested in the site when that feature was gone and I run the site.
  • Blackveiled Blackveiled:
    People love rep, lol
    +1
  • The Helper The Helper:
    The recipe today is Sloppy Joe Casserole - one of my faves LOL https://www.thehelper.net/threads/sloppy-joe-casserole-with-manwich.193585/
  • The Helper The Helper:
    Decided to put up a healthier type recipe to mix it up - Honey Garlic Shrimp Stir-Fry https://www.thehelper.net/threads/recipe-honey-garlic-shrimp-stir-fry.193595/

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top