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: 380

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
964
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
964
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
964
Approved.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      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