System The Rune System [TRS]

Furby

Current occupation: News poster
Reaction score
144
The Rune System
by FURBY

version 1.01a

Preface: Many friends was asking me if I can make something like this. So I decided to make system for this.

What does this do: This system allows creators of maps to simple add runes to regions choosed by creator also set a lot of stuffs around.

Features:
  • You are able to change time in which are runes spawned at first time
  • You are able to change time in which are runes respawned after each pick
  • You are able to change if is rune placed randomly or exactly in center of region
  • You are able to add new or remove existing runes and regions in which are runes spawned

Requires: Jass NewGen Pack

Changelog:
version 1.00
  • First release
version 1.01
  • Fixed code
version 1.01a
  • Scope instead of library
  • Private Init instead of public Init
  • Added nulling of timer in Init
How to use:
Copy the trigger called TRS from the attached map or create a trigger named TRS, convert it to custom text, and replace everything inside it with the code below. Then you can addm remove or edit values in Editable Zone in trigger you created.

System code:
JASS:
//==============================================================================
//==============================================================================
//
//  TRS - THE RUNES SYSTEM BY FURBY - v1.01a
//
//  MORE INFO ON THE THEHELPER.NET AND CLANMAPZ.COM
//
//  thanks to Romek and Artificial for helping
//
//==============================================================================
//==============================================================================
scope TheRuneSystem initializer Init
    globals
        private integer array TheRuneType
        private rect array TheRuneRect
        private real array TheRuneRespawn
        private boolean array TheRuneRandomPlace
        private item array TheRunes
        private timer array TheRuneTimer
        private boolean TheRuneDebugMode = false
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//  EDITABLE ZONE - EDITABLE ZONE - EDITABLE ZONE - EDITABLE ZONE
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
    
        //How many types of runes system allowing
        private constant integer CountTheRuneTypes = 4
        
        //How many regions for runes system allowing
        private constant integer CountTheRuneRects = 3
        
        //How long time from start of the map runes will spawn
        private constant real FirstSpawnTime = 30.
        
    endglobals
    private function SetGlobalArray takes nothing returns nothing
        local integer i
        //Rawcodes of the runes
        //Be sure if you changed count of rune types in globals, variable: CountTheRuneTypes - base 4
        set TheRuneType[1] = 'rhe3'
        set TheRuneType[2] = 'rma2'
        set TheRuneType[3] = 'rspd'
        set TheRuneType[4] = 'rspl'
      //set TheRuneType[5] = ...
        
        //Regions where are runes spawned
        //Be sure if you changed count of rune regions in globals, variable: CountTheRuneRects - base 3
        set TheRuneRect[1] = gg_rct_TheRuneOne
        set TheRuneRect[2] = gg_rct_TheRuneTwo
        set TheRuneRect[3] = gg_rct_TheRuneThree
      //set TheRuneRect[5] = ...
        
        //If item should spawn at random place in region
        //Be sure if you changed count of rune regions in globals, variable: CountTheRuneRects - base 3
        set TheRuneRandomPlace[1] = false
        set TheRuneRandomPlace[2] = false
        set TheRuneRandomPlace[3] = true
      //set TheRuneRandomPlace[4] = ...
        
        set i = 1
        loop
            exitwhen(i>CountTheRuneTypes)
            set TheRuneRespawn<i> = 15.
            set i = i + 1
        endloop    
        
    endfunction
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//  END OF EDITABLE ZONE - END OF EDITABLE ZONE - END OF EDITABLE ZONE
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------   
    private function TheRuneDebug takes string s returns nothing
        if TheRuneDebugMode==true then
            debug call BJDebugMsg(s)
        endif
    endfunction
    private function TheRuneDebugChange takes nothing returns nothing
        if GetEventPlayerChatString()==&quot;-TRS debug on&quot; then
            set TheRuneDebugMode=true
        elseif GetEventPlayerChatString()==&quot;-TRS debug off&quot; then
            set TheRuneDebugMode=false
        endif
    endfunction
    private function GetRuneSpawnX takes integer Id returns real
        if TheRuneRandomPlace[Id]==true then
            return GetRandomReal(GetRectMinX(TheRuneRect[Id]), GetRectMaxX(TheRuneRect[Id]))
        else
            return GetRectCenterX(TheRuneRect[Id])
        endif
    endfunction
    private function GetRuneSpawnY takes integer Id returns real
        if TheRuneRandomPlace[Id]==true then
            return GetRandomReal(GetRectMinY(TheRuneRect[Id]), GetRectMaxY(TheRuneRect[Id]))
        else
            return GetRectCenterY(TheRuneRect[Id])
        endif
    endfunction
    private function GetItemId takes item TheItem returns integer
        local integer i = 1
        loop
            exitwhen(i&gt;CountTheRuneRects)
            if TheItem == TheRunes<i> then
                return i
            endif
            set i = i + 1
        endloop
        return 0
    endfunction
    private function RespawnItem takes nothing returns nothing
        local integer i = 1
        call TheRuneDebug(&quot;Respawn timer expired&quot;)
        loop
            exitwhen(i&gt;CountTheRuneRects)
            if GetExpiredTimer()==TheRuneTimer<i> then
                call TheRuneDebug(&quot;Creating item with id &#039;&quot; + I2S(i) + &quot;&#039;&quot;)
                set TheRunes<i> = CreateItem(TheRuneType[GetRandomInt(1,CountTheRuneTypes)],GetRuneSpawnX(i),GetRuneSpawnY(i))
            endif
            set i = i + 1
        endloop
        call DestroyTimer(GetExpiredTimer())
    endfunction
    private function Act takes nothing returns nothing
        local item TheItem = GetManipulatedItem()
        set TheRuneTimer[GetItemId(TheItem)] = CreateTimer()
        call TimerStart(TheRuneTimer[GetItemId(TheItem)], TheRuneRespawn[GetItemId(TheItem)], false, function RespawnItem)
        call TheRuneDebug(&quot;Respawn timer of rune started with &#039;&quot; + R2S(TheRuneRespawn[GetItemId(TheItem)]) + &quot;&#039; seconds&quot;)
        set TheItem = null
    endfunction
    private function Cond takes nothing returns boolean
        local item TheItem = GetManipulatedItem()
        call TheRuneDebug(&quot;Picking of item detected&quot;)
        if GetItemId(TheItem)!=0 then
            call TheRuneDebug(&quot;Detected item is rune with id &#039;&quot; + I2S(GetItemId(TheItem)) + &quot;&#039;&quot;)
            return true
        endif
        call TheRuneDebug(&quot;Detected item is not rune&quot;)
        return false
    endfunction
    private function FirstSpawn takes nothing returns nothing
        local integer i = 1
        call TheRuneDebug(&quot;First spawn timer expired&quot;)
        call DestroyTimer(GetExpiredTimer())
        loop
            exitwhen(i&gt;CountTheRuneRects)
            call TheRuneDebug(&quot;Creating rune with id &#039;&quot; + I2S(i) + &quot;&#039;&quot;)
            set TheRunes<i> = CreateItem(TheRuneType[GetRandomInt(1,CountTheRuneTypes)],GetRuneSpawnX(i),GetRuneSpawnY(i))
            set i = i + 1
        endloop
    endfunction
    private function True takes nothing returns boolean
        return true
    endfunction
    private function Init takes nothing returns nothing
        local trigger t = CreateTrigger() 
        local integer i 
        local timer tim = CreateTimer()
        call SetGlobalArray()
        set i = 1
        call TheRuneDebug(&quot;Starting first spawn timer with &#039;&quot; + R2S(FirstSpawnTime) + &quot;&#039; seconds&quot;)
        call TimerStart(tim, FirstSpawnTime, false, function FirstSpawn)
        set i = 0
        loop
            exitwhen(i&gt;11)
            call TriggerRegisterPlayerUnitEvent(t, Player(i), EVENT_PLAYER_UNIT_PICKUP_ITEM, Filter(function True))
            set i = i + 1
        endloop
        call TriggerAddCondition(t, Filter(function Cond))
        call TriggerAddAction(t, function Act)
        //  Debug set
        set i = 0
        loop
            exitwhen(i&gt;11)
            call TriggerRegisterPlayerChatEvent( t, Player(i), &quot;-TRS debug &quot;, false )
            set i = i + 1
        endloop
        call TriggerAddAction(t, function TheRuneDebugChange)
        set tim = null
    endfunction
endscope
//==============================================================================
//  END OF TRS - THE RUNES SYSTEM
//==============================================================================</i></i></i></i></i>


Demo Map:
 

Attachments

  • TheRuneSystem[TRS].w3x
    27.2 KB · Views: 371

cr4xzZz

Also known as azwraith_ftL.
Reaction score
51
Good job, I've been waiting for someone to post something like this and this is what I wanted. :thup:
 

Romek

Super Moderator
Reaction score
963
I still think the Debug messages should be simple "BJDebugMsg" instead of your own private function.
If someone wants debug messages, they'll have debug mode on, else they'll have it off. No need for another constant.

Actually, that amount of messages isn't needed. It's obvious enough that the system is starting, or spawning stuff. It's what it's meant to do. And really, the same messages will show up for pretty much every user which didn't edit the code under the configurables.
 

WolfieeifloW

WEHZ Helper
Reaction score
372
Is it okay if I use this in my map furby777 [with credits of course]?
Didn't see in your first post if I was allowed to or not [add that in?].
That is, if my map goes anywhere :p .
 

Romek

Super Moderator
Reaction score
963
Is it okay if I use this in my map furby777 [with credits of course]?
Didn't see in your first post if I was allowed to or not [add that in?].
That is, if my map goes anywhere :p .
The whole point of these resources being here is so that you can use them.
Credit's aren't needed unless the Author states so, but they're always appreciated by system / spell makers.
 

WolfieeifloW

WEHZ Helper
Reaction score
372
Alright, just wanted to make sure.
I'll put you in the credits furby, unless you don't want to be.
Thanks for this system, +rep!
 

Furby

Current occupation: News poster
Reaction score
144
I am not asking for any credit. However I appreciate small credits in F9 part. ;)
 

Romek

Super Moderator
Reaction score
963
Approved.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Varine Varine:
    I ordered like five blocks for 15 dollars. They're just little aluminum blocks with holes drilled into them
  • Varine Varine:
    They are pretty much disposable. I have shitty nozzles though, and I don't think these were designed for how hot I've run them
  • Varine Varine:
    I tried to extract it but the thing is pretty stuck. Idk what else I can use this for
  • Varine Varine:
    I'll throw it into my scrap stuff box, I'm sure can be used for something
  • Varine Varine:
    I have spare parts for like, everything BUT that block lol. Oh well, I'll print this shit next week I guess. Hopefully it fits
  • Varine Varine:
    I see that, despite your insistence to the contrary, we are becoming a recipe website
  • Varine Varine:
    Which is unique I guess.
  • The Helper The Helper:
    Actually I was just playing with having some kind of mention of the food forum and recipes on the main page to test and see if it would engage some of those people to post something. It is just weird to get so much traffic and no engagement
  • The Helper The Helper:
    So what it really is me trying to implement some kind of better site navigation not change the whole theme of the site
  • 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 Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top