• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

*_¯=_=¯vJASS System Workshop¯=_=¯_*

Status
Not open for further replies.
«««««« vJASS System Workshop »»»»»»

vJASS System Workshop

If you have any vJASS system requests, you can post them here.
I'll take anything from very simple to moderately complex
I can't guarantee that your request would be accepted, but I'll try
my best to create bugless, leakless, and efficient script for your use.


NOTES
1- The scripts I write will be available for any other users so I don't have to rewrite systems or continuously redirect users to the code.
2- You must use the given form to request a system.
3- I don't take spell requests.
4- I will NOT do anything in GUI
5- If your request is very very similar or identical to an existing resource, I MIGHT redirect you to it.
6- If you want, I'll write your system in JASS so that it can be used without JNGP
7- I have the complete right to reject a request.
8- Please don't ask how much time your request will take. I'll post it when it's done.
9- You have to wait your turn.
10- No camera systems.. there are already enough of those in the Spells section..



I might reject your request if:
1- It's impossible
2- You didn't use the form
3- Your request goes against what I stated in the above Notes
4- It's far too difficult and requires a VERY long time to create (ex: A system that hooks all your BJs and tells you how to change them. There are 924 BJs..)


Form
Name: <system_name>
Code: <JASS or vJASS> (vJASS is preferred, but it's no problem)
Complexity: <Very complex, complex, simple, very simple> (This won't affect request acception)
Description <You need to describe your system request>


Members
Since I'm not a machine, I'm obviously unable to manage all the requests.
If you've got the right skills (any sort of vJASS knowledge), feel free to join.
Currently, there are no members :|


Extras (Optional requests to assist him)
-Nestharus: SpellBook Generator
-Nestharus: FlatFlier
-Nestharus: CliffBound
-Nestharus: SlopeSpeed
-Nestharus: GetCoordsForSteinerCircumEllipse
-Nestharus: Bonus
-Nestahrus: EffectEngine

Queque
-N/A


JASS:
/*******************************************************
*    Name: Spawn System
*    Author: Magtheridon96
*    Version: 0.1
*
*    Copyright 2011
*
*    This system will respawn dying units that must 
*    be configured after a certain amount of time at 
*    an offset from the dying location.
*
********************************************************/
library SpawnSystem initializer init requires TimerUtils
    globals
        // The type of units we are going to spawn
        private integer array SpawnTypes
        // The number of unit types you gave in the Config function
        private constant integer NUMBER = 4
        // The time interval between a unit's decay and his spawning
        private constant real SpawnWait = 3.0
        // How far away will the new unit spawn from the dead one
        private constant real DISTANCE = 500.0
        // From what offset angle will the unit spawn
        private constant real OFFSETANGLE = 45.0 // He will spawn 45 degrees north of the dying unit
    endglobals
    
    private function Config takes nothing returns nothing
        // here, you should configure ALL the spawn types
        // you can have up to 8190
        set SpawnTypes[1]='hpea' // peasant
        set SpawnTypes[2]='hkni' // knight
        set SpawnTypes[3]='hsor' // sorceress
        set SpawnTypes[4]='hspt' // Spell Breaker
    endfunction
    
    // A struct is like a data storage
    // Jasshelper compiles it to become a huge group of arrays =P
    private struct spawn
        // the unit
        unit u
        // his X
        real x
        // his Y
        real y
        // his facing angle
        real a
        // his type
        integer id
        // which player
        player p
        // This is the method that I'm using to spawn the units
        // They will spawn and move to the dying units location
        static method spawning takes nothing returns nothing
            local timer t=GetExpiredTimer()
            local thistype this=GetTimerData(t) // In TimerUtils, you can attatch integers to timers. Thistype is the exact same thing as an integer.
            set .u=CreateUnit(.p,.id,.x+DISTANCE*Sin(OFFSETANGLE*bj_DEGTORAD),.y+DISTANCE*Cos(OFFSETANGLE*bj_DEGTORAD),.a)
            call IssuePointOrder(.u,"move",.x,.y) // Issue him to move to the dying units position
            call ReleaseTimer(t) // releasing the timer
            call .destroy()
            set t=null
        endmethod
        // This is the create method.
        // I'm storing all the data inside this struct so it can 
        // be accessed after the timer expires since you can't give 
        // a timer a function with parameters.
        static method create takes integer i, real ux, real uy, real an, player o returns thistype
            local thistype this=thistype.allocate() // allocating the instance
            local timer t=NewTimer() // creating a timer (TimerUtils function)
            set this.x=ux // saving the X
            set this.y=uy // saving the Y
            set this.a=an // saving the angle
            set this.id=i // saving the type id
            set this.p=o
            call SetTimerData(t,this)
            call TimerStart(t,SpawnWait,false,function thistype.spawning) // I'm using thistype instead of the struct name for senseless reasons :P
            set t=null
            return this // I return the instance
        endmethod
        // we create a destroy method so we can remove 
        // instances of the struct
        method destroy takes nothing returns nothing
            set .u=null // nulling the non-scalar variables (Scalar: integer, real, ..)
            set .p=null
            call .deallocate() // deallocating the instance
        endmethod
    endstruct
    
    private function Action takes nothing returns boolean
        local unit un=GetTriggerUnit() // we take the unit
        local integer id=GetUnitTypeId(un) // We take the type of the unit
        local integer i=1 // It should be the first number you used for the SpawnTypes array
        local spawn s
        // we loop to check see if the unit needs to be respawned
        loop
            exitwhen i>NUMBER // we exit when we tryed all the possible spawn types
            if id==SpawnTypes[i] then // if we found that the unit is included in this system, then
                set s=spawn.create(id,GetUnitX(un),GetUnitY(un),GetUnitFacing(un),GetOwningPlayer(un))
                set un=null
                return false
            endif
            set i=i+1
        endloop
        set un=null
        return false
    endfunction
    
    private function init takes nothing returns nothing
        // we create a trigger
        local trigger t=CreateTrigger()
        // we give it a "Unit Dies" event
        call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_DECAY)
        // since conditions are faster than actions, we just put all our code in a 
        // condition and make it return false at the end
        call TriggerAddCondition(t,Condition(function Action))
        // we call the configuration
        call Config()
        // we null the trigger to save memory
        set t=null
    endfunction
endlibrary

Requires: TimerUtils

JASS:
//====================================================
//
//    Name: Ability Logger
//    Author: Magtheridon96
//    Version: v0.3
//
//    This system logs all the abilities a unit gains 
//    and removes all those that were removed.
//    Its API is completely object oriented. In fact, 
//    it doesn't need one. All you need to do is take 
//    the ability id data from it.
//
//    To loop through a units abilities:
//          > ALog[GetUnitId(your_unit)].tb[i]
//
//    Where "i" is your index. "i" must be initially 0.
//
//    If you want to loop through all units registered, 
//    you should loop through the linked list.
//
//====================================================
library AbilityLogger requires Table, UnitIndexer
	globals
        private constant boolean MAP_HAS_UNLEARN_ABILITY = false
        private integer array n
        private integer array p
	endglobals
    
    static if MAP_HAS_UNLEARN_ABILITY then
        globals
            private constant integer UNLEARN = 'Aret' // Set this to the Id of the Unlearn ability (if there is one)
        endglobals
    endif
    
	private module Init
		private static method onInit takes nothing returns nothing
			local trigger t=CreateTrigger()
			call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_HERO_SKILL)
			call TriggerAddCondition(t,Condition(function thistype.rl))
            call RegisterUnitIndexEvent(Condition(function thistype.in),UnitIndexer.INDEX)
            call RegisterUnitIndexEvent(Condition(function thistype.de),UnitIndexer.DEINDEX)
            static if MAP_HAS_UNLEARN_ABILITY then
                set t=CreateTrigger()
                call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_SPELL_EFFECT)
                call TriggerAddCondition(t,Condition(function thistype.ev))
            endif
			set t=null
		endmethod
	endmodule
    
	struct ALog extends array
		integer id
		integer c
		static integer array k
		Table tb
        
		static method operator [] takes integer i returns thistype
			return k[i]
		endmethod
        
		private method b takes integer i returns nothing
            static if MAP_HAS_UNLEARN_ABILITY then
                local integer j=1
                local boolean b=false
            endif
			set c=c-1
			loop
				exitwhen i>c
                static if MAP_HAS_UNLEARN_ABILITY then
                    loop
                        exitwhen b or j>c-i
                        if tb[i+j]!=0 then
                            set tb[i]=tb[i+j]
                            set j=1
                            set tb[i+j]=0
                            set b=true
                        endif
                        set j=j+1
                    endloop
                    set b=false
                    set i=i+1
                else
                    set tb[i]=tb[i+1]
                    set i=i+1
                endif
			endloop
		endmethod

		method remove takes integer i returns nothing
			local integer j=0
			loop
				exitwhen j>c
				if tb[j]==i then
					call this.b(j)
				endif
				set j=j+1
			endloop
		endmethod
        
		method add takes integer i returns nothing
			set tb[c]=i
			set c=c+1
		endmethod
        
		private static method create takes integer i returns thistype
			local thistype this=i

			set this.c=0
			set this.id=i
			
			set n[this]=0
			set p[this]=p[0]
			set n[p[0]]=this
			set p[0]=this

			set k[this]=this
			set tb=Table.create()

			return this
		endmethod
        
        private static method rl takes nothing returns boolean
            call thistype[GetUnitId(GetTriggerUnit())].add(GetLearnedSkill())
            return false
        endmethod
        
        static if MAP_HAS_UNLEARN_ABILITY then
            // This evaluates the presence of all the abilities.
            // This is to correct the list after all the learned 
            // abilities are removed due to the use of an ability 
            // similar to that of Tome of Retraining.
            // If you have such a tome/ability in your map, 
            // set the boolean to true.
            static method ev takes nothing returns boolean
                local unit u=GetTriggerUnit()
                local integer i=GetUnitId(u)
                local thistype this=thistype[i]
                local integer j=thistype[i].c
                local integer h=0
                if GetSpellAbilityId()==UNLEARN then
                    loop
                        exitwhen j<0
                        if GetUnitAbilityLevel(u,tb[j])<=0 then
                            set tb[j]=0
                            set h=j
                        endif
                        set j=j-1
                    endloop
                    call b(h)
                endif
                set u=null
                return false
            endmethod
        endif
        
		private method destroy takes nothing returns nothing
			call tb.destroy()
			set n[p[this]]=n[this]
			set p[n[this]]=p[this]
		endmethod
        
        private static method in takes nothing returns boolean
            call thistype.create(GetIndexedUnitId())
            return false
        endmethod
        private static method de takes nothing returns boolean
            call thistype[GetIndexedUnitId()].destroy()
            return false
        endmethod
        
		implement Init
	endstruct
    
	private function A takes unit u, integer a returns boolean
		call ALog[GetUnitId(u)].add(a)
        return false
	endfunction
	private function B takes integer a, unit u returns boolean
		call ALog[GetUnitId(u)].add(a)
        return false
	endfunction
	private function C takes unit u, integer a returns boolean
		call ALog[GetUnitId(u)].remove(a)
        return false
	endfunction
	private function D takes integer a, unit u returns boolean
		call ALog[GetUnitId(u)].remove(a)
        return false
	endfunction

	hook UnitAddAbility A
	hook UnitAddAbilityBJ B
	hook UnitRemoveAbility C
	hook UnitRemoveAbilityBJ D
	hook UnitRemoveBuffsBJ D
endlibrary

Requires: Table & UnitIndexer

 
Last edited:
Level 7
Joined
Apr 11, 2011
Messages
173
Name: Camera moving by Mouse Movement.
Code: VJass
Complexity: Complex or simple if you don't mind just converting a map I already have to hashtables.
Description: Able to move your camera around like a first player shooter by the mouse and must be MPI and prepared for 5+ players while if it is possible able to move a unit around and have the camera locked to a unit per player.
 
Level 17
Joined
Jan 21, 2010
Messages
2,111
Name: spawn system
Code: neither vjass or jass, i want to learn both of them
Complexity: complex
Description: i need a different spawn system, it needs to be like this:
1. A forest troll died
2. If the corpse is vanished, then make a new dark troll come out from the forest and walk towards the postion of the the forest troll
3. The spwaned unit Need to be configurable, and the point where the Spawned unit created also must be configurable
4. And it needs to be a learnable by vjass noob (me)
 
@Vehster
Accepted (But you might want to check the Spells section first ;))

@rysnt11
Accepted (It's not so complex ;P)

@mckill2009
Thanks ^^

EDIT:
Ok. I have good news and bad news.
The bad news is that I ignored the order of the list.
The good news is that I finished rynst11's Spawn System.


JASS:
/*******************************************************
*    Name: Spawn System
*    Author: Magtheridon96
*    Version: 0.1
*
*    Copyright 2011
*
*    This system will respawn dying units that must 
*    be configured after a certain amount of time at 
*    an offset from the dying location.
*
********************************************************/
library SpawnSystem initializer init requires TimerUtils
    globals
        // The type of units we are going to spawn
        private integer array SpawnTypes
        // The number of unit types you gave in the Config function
        private constant integer NUMBER = 4
        // The time interval between a unit's decay and his spawning
        private constant real SpawnWait = 3.0
        // How far away will the new unit spawn from the dead one
        private constant real DISTANCE = 500.0
        // From what offset angle will the unit spawn
        private constant real OFFSETANGLE = 45.0 // He will spawn 45 degrees north of the dying unit
    endglobals
    
    private function Config takes nothing returns nothing
        // here, you should configure ALL the spawn types
        // you can have up to 8190
        set SpawnTypes[1]='hpea' // peasant
        set SpawnTypes[2]='hkni' // knight
        set SpawnTypes[3]='hsor' // sorceress
        set SpawnTypes[4]='hspt' // Spell Breaker
    endfunction
    
    // A struct is like a data storage
    // Jasshelper compiles it to become a huge group of arrays =P
    private struct spawn
        // the unit
        unit u
        // his X
        real x
        // his Y
        real y
        // his facing angle
        real a
        // his type
        integer id
        // which player
        player p
        // This is the method that I'm using to spawn the units
        // They will spawn and move to the dying units location
        static method spawning takes nothing returns nothing
            local timer t=GetExpiredTimer()
            local thistype this=GetTimerData(t) // In TimerUtils, you can attatch integers to timers. Thistype is the exact same thing as an integer.
            set .u=CreateUnit(.p,.id,.x+DISTANCE*Sin(OFFSETANGLE*bj_DEGTORAD),.y+DISTANCE*Cos(OFFSETANGLE*bj_DEGTORAD),.a)
            call IssuePointOrder(.u,"move",.x,.y) // Issue him to move to the dying units position
            call ReleaseTimer(t) // releasing the timer
            call .destroy()
            set t=null
        endmethod
        // This is the create method.
        // I'm storing all the data inside this struct so it can 
        // be accessed after the timer expires since you can't give 
        // a timer a function with parameters.
        static method create takes integer i, real ux, real uy, real an, player o returns thistype
            local thistype this=thistype.allocate() // allocating the instance
            local timer t=NewTimer() // creating a timer (TimerUtils function)
            set this.x=ux // saving the X
            set this.y=uy // saving the Y
            set this.a=an // saving the angle
            set this.id=i // saving the type id
            set this.p=o
            call SetTimerData(t,this)
            call TimerStart(t,SpawnWait,false,function thistype.spawning) // I'm using thistype instead of the struct name for senseless reasons :P
            set t=null
            return this // I return the instance
        endmethod
        // we create a destroy method so we can remove 
        // instances of the struct
        method destroy takes nothing returns nothing
            set .u=null // nulling the non-scalar variables (Scalar: integer, real, ..)
            set .p=null
            call .deallocate() // deallocating the instance
        endmethod
    endstruct
    
    private function Action takes nothing returns boolean
        local unit un=GetTriggerUnit() // we take the unit
        local integer id=GetUnitTypeId(un) // We take the type of the unit
        local integer i=1 // It should be the first number you used for the SpawnTypes array
        local spawn s
        // we loop to check see if the unit needs to be respawned
        loop
            exitwhen i>NUMBER // we exit when we tryed all the possible spawn types
            if id==SpawnTypes[i] then // if we found that the unit is included in this system, then
                set s=spawn.create(id,GetUnitX(un),GetUnitY(un),GetUnitFacing(un),GetOwningPlayer(un))
                set un=null
                return false
            endif
            set i=i+1
        endloop
        set un=null
        return false
    endfunction
    
    private function init takes nothing returns nothing
        // we create a trigger
        local trigger t=CreateTrigger()
        // we give it a "Unit Dies" event
        call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_DECAY)
        // since conditions are faster than actions, we just put all our code in a 
        // condition and make it return false at the end
        call TriggerAddCondition(t,Condition(function Action))
        // we call the configuration
        call Config()
        // we null the trigger to save memory
        set t=null
    endfunction
endlibrary

Requires: TimerUtils

I explained ALL the script since you're a beginner who wants to learn vJASS ^^


@Vehster
Your system is going to have the following functions:
-> DamageEffect (When you take damage, your camera will slightly .. sway)
-> RunningEffect (Realistically Moves your camera as if you were running)
-> DeathEffect (Falls sideways to the ground)

You should just configure WHICH unit the camera is locked to for each player.
Your system will be finished soon :)
 
Last edited:
Ditch that purple colour,back with yellow.
Done ;P
good luck on that mouse camera...
It's actually REALLY complicated :p
The work around is to create like 256 trackables depending on the players camera xD
Till now, I finished the main camera buffer (Locking the camera to a unit will also lock the angle)
I'm trying my best (without trackables)

EDIT: I won't be submitting any requests for about a week now (My finals are this week)
 
Last edited:
that's why no one makes it, because it needs lots of trackables which make it pretty much laggy in SP, and all the more in MP...

its doable, but the set-backs far exceed the supposed to be effects...

So, by NOT doing it, I'd be doing Vehster a favor ;)
I'm sorry Vehster, the system you're requesting can cause EPIC lag :(
I have no choice but to reject it :( Don't worry, if you search the spells section,
you'd find some VERY amazing camera systems :)
 
if only Blizzard would add support for mouse position in wc3...
Way ahead of you dude xD ... jk :p
Maybe we should make a system that plots an X,Y axis on the screen (virtually) and uses trackables to detect mouse position.. we could find a way to minimize the lag (taking advantage of GetlocalPlayer =P)
 
Level 7
Joined
Apr 11, 2011
Messages
173
So you reject my request because it is too hard?
It can't be that complex otherwise if so that is proving the return bug is much faster then hashtables.

"So, by NOT doing it, I'd be doing Vehster a favor ;)
I'm sorry Vehster, the system you're requesting can cause EPIC lag :(
I have no choice but to reject it :( Don't worry, if you search the spells section,
you'd find some VERY amazing camera systems :) "

By not doing it, your doing me no favor...
I don't mind how much lag it can cause, someone I know has done this before and it was easily useable in multiplayer and I would be using it but it is broken by the patch.
I don't want the boring normal camera systems..... I can easily enough create my own, however the trackables I can not.

Thank you anyways, I don't find a need to request anything on hive anymore though.
 
yeah, its doable without lag on earlier versions of wc3 because of Reinventing the Craft... but since RTC is now broken, there would be no way to do it in wc3 which isn't laggy... do you know how many aspiring FPS closed down because of that fact?

I don't mind how much lag it can cause
--> so you don't care about the players?
 
Not just lag, but delay ... which would be horrible...
I might work out something for this in the future if my C++ career takes off ^^
I'm sorry I couldn't take your request :(
I would gladly take any other request if you have one :) (I won't be working on anything for the next week due to my exams, but I'll accept all your other requests :))
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
Here are some systems I'm eventually going to need to make/fix.

I have many, many more systems that need to be fixed and or created. I'm only listing the simplest ones I can think of ^^.

Ofc, I need these to be written with proper initialization, good use of systems, and to be as insanely efficient as possible (even 1-2 char var names).

------------------------------------------------------------------------------------------------------------------------
*********************************************************************************************
------------------------------------------------------------------------------------------------------------------------

Name: FlatFlier
Code: vJASS
Complexity: simple

Description:
Don't really have time to work on my flat flying script. The only thing annoying about this is that units of different movement types are messed with by terrain in different ways. The unit shouldn't bump around when flying over terrain ^)^.

Should have proper initialization (if any)
Should probably run on a UnitIndexer (for initial height retrieval relative to terrain z)

Please, if it is avoidable, don't do a SetUnitZ wrapper. Should work with SetUnitFlyHeight (I wasn't able to get that working and I don't think that it's quite possible to get that working, so more than likely will need a SetUnitZ wrapper).

This is useful for the Position stuff.
------------------------------------------------------------------------------------------------------------------------
*********************************************************************************************
------------------------------------------------------------------------------------------------------------------------

Name: Spellbook Maker
Code: Lua
Complexity: very simple

Description:
A system for making spell books =). Probably a snippet. Should also support spell book wrapping for abilities.

This is useful for a lot of things o-o, lol... get into the Lua field dope : P
------------------------------------------------------------------------------------------------------------------------
*********************************************************************************************
------------------------------------------------------------------------------------------------------------------------

Name: Ability Logger
Code: vJASS
Complexity: simple

Description:
Store a collection of all abilities on a given unit.

As an ability is added to a unit or a unit learns an ability etc, add to that collection.

Don't worry about default abilities, only abilities that are added/learned.

This is useful for save/load.
------------------------------------------------------------------------------------------------------------------------
*********************************************************************************************
------------------------------------------------------------------------------------------------------------------------

Name: Cliff Bound
Code: vJASS
Complexity: simple

Description:
If z height is too large relative to a unit's z-coordinate and that unit, that unit will not be able to go up it.

In the previous Cliff Bounds, units could scale up a cliff diagonally.

This should work properly with destructables (like staircases, walls, pedestals, etc) and terrain.

You can take the code out of my current one and fix it up.

This is obviously useful for easier terraining and avoidance of spamming pathing blockers.

Should be able to have terrain collision events for flying units.

A unit should be able to be flagged as flying or hovering (neither is ground).
------------------------------------------------------------------------------------------------------------------------
*********************************************************************************************
------------------------------------------------------------------------------------------------------------------------

Name: Slope Speed
Code: vJASS
Complexity: simple

Description:
Given a gravity, a unit will travel more slowly up steeper slopes and more quickly down steeper slopes. For near vertical, they should fall going down and not be able to scale it going up.

There should also be some sort of impact event as well as the total force of the unit. Include acceleration.

It should be able to properly handle units with a fly height > 0.

Other possible interesting things: unit flagged as flying or hovering. Hovering would have a slow decent (safe landing) where as flying would have no decent.
------------------------------------------------------------------------------------------------------------------------
*********************************************************************************************
------------------------------------------------------------------------------------------------------------------------

Name: GetQuadSteinerCircumEllipseAreaIntersectionWithCircle
Code: vJASS
Complexity: simple code, complex math

Description:
Given 8 coordinates to form 4 steiner circumellipses in 4 quadrants (only using a portion of those) and 2 coordinates w/ a radius to form a circle, get the total area of intersection between the masses of circumellipses and the circle.

This goes to my custom combat system help... I've needed help figuring out the math on this for a long time
------------------------------------------------------------------------------------------------------------------------
*********************************************************************************************
------------------------------------------------------------------------------------------------------------------------


That's all for now =). Getting these scripts done would really be a lot of help for my map ^^ as it lessens the pile of systems I need to do by a tad ^)^.

That's 6 less scripts I'd have to write ; P.

When I start getting my CombatSuite stuff designed and MagicSuite stuff designed, I'll be sure to come here for like 20 more scripts ^)^.
 
@Nestharus
WOW ^^
All your requests are Accepted
Although, I may put the last one on a "Pending" list until I figure out the math behind
it all :p
Also, I can't write your Spell Book System in LUA, so is it okay if I write it in vJASS?
One other thing;
How do you want the API of AbilityLogger?
And is it ok if Ability Logger requires SpellBookMaker?
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
Also, I can't write your Spell Book System in LUA, so is it okay if I write it in vJASS?

It can't be done in vJASS.. the spell book system would be for generating the spellbook objects =P. Can you generate spellbook objects in vJASS? no ;p

And is it ok if Ability Logger requires SpellBookMaker?

no, it shouldn't need it

How do you want the API of AbilityLogger?

Object Orientated. It should just log abilities and then you should be able to loop through them and retrieve the ids given a unit.

Put abilities on a linked list (no table necessary).

edit
this is a big help btw =).
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
This includes a link to the Lua manual and goes over some of the basics.
http://www.hiveworkshop.com/forums/jass-ai-scripts-tutorials-280/lua-object-generation-191740/

Oh yea, while you're at it... these are 2 more scripts I'll need to eventually make, but not using them in my current map. I would use them in other maps and they are just generally really useful. Have had plenty of requests to get these up for the Lua stuff and UnitIndexer =).

------------------------------------------------------------------------------------------------------------------------
*********************************************************************************************
------------------------------------------------------------------------------------------------------------------------

Name: Bonus
Code: vJASS/Lua
Complexity: Medium

Description:
A library similar to the other bonus libs that includes every possible wc3 bonus. Use spellbook hacks and etc to hide things like thorns aura for damage return % bonus or w/e. Be sure to pick out all of the best possible abilities for the job.

Abilities should be generated via an Lua installation script and the Lua create object stuff.
------------------------------------------------------------------------------------------------------------------------
*********************************************************************************************
------------------------------------------------------------------------------------------------------------------------

Name: Effect
Code: vJASS/Lua
Complexity: Medium

Description:
Stackable effects such as stuns that can be applied to a unit.

Abilities that make a unit go to sleep or w/e should be generated via Lua and object generation scripts like LUA_GET_VAR_OBJECT.

Effects should last for a specified time (0 for infinite) and should be able to be taken off.

Effects should be stackable (putting 2 of the same effect on a unit will just increase the time that the unit has that effect).

Effects should include things like sleep, stun, poison, slow, slow attack etc.
------------------------------------------------------------------------------------------------------------------------
*********************************************************************************************
------------------------------------------------------------------------------------------------------------------------
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
So yea.. you have a few probs with the 2 scripts you wrote..

Spellbooks one fails obviously since it doesn't even do what it's supposed to do. There should be 0 vjass.

And the other one doesn't log all abilities. Remember that heroes can learn abilities?

Not sure how you'd deal with unlearning abilities =).


Also, with your current design of AbilityLogger, I'd have to 100% rewrite it anyways..

Needs to have a linked list of spells. Struct needs to extend array with allocation. Functions shouldn't take a unit, but rather a unit id. Remember to properly clean up deindexed units and properly allocate a list for indexed units.

And etc, etc. That's just the start ^)^.

At this point, both scripts have to be trashed and 100% rewritten ;D.

If you're not up to it, I can get to writing these eventually. I just gave you a list of a few of the systems I'm planning to update/write, most of them being highly useful in plenty of maps ^)^.

Ofc, by doing them, you would be giving me more time to work on the complex systems =P.

edit
be sure to submit the scripts I requested you write to JASS section since all of these scripts can be applied in a great deal of maps ^)^
 
I'm working on it :p
Btw, I posted those scripts before I got to know exactly what you wanted xD
I'm rewriting both :)
@Nestharus
Both requests Accepted
Btw, LUA can be a bit messy =P
I finished learning some of the basics. That spell book is just going to be a small
interface where you can create a spell book object and add spells to it (not much but pretty useful)
 
Last edited:
It's Lua, not LUA, just to let you know =P

It's weird seeing you type LUA all the time =).

LOL
I don't think the capitalization will affect the acronym, but anyway.. =P
Btw, before I give you AbilityLogger, here's some Pseudo code. Tell me if my algorithm
will suit your needs ^^

JASS:
// A unit gains an ability in some way
    // if the struct instance doesn't exist, I'll create it.
        // in the struct, I..
        set this = id // Knowing that id is in the parameter list and it corresponds to the unit id
        // I then:
        set next[this]=0
        set prev[this]=prev[0]
        set next[prev[0]]=this
        set p[0]=this
        // The list has been updated :)
        // I return the new instance
    // after the instance is initializer for the unit,
    // I then add the ability to ANOTHER list that goes with each struct instance.
    set nextQ[curr]=0
    set prevQ[curr]=prevQ[0]
    set nextQ[prevQ[0]]=curr
    set prevQ[0]=curr
    // After I register the ability, any handles will be nulled (as if I used any :P)

Its based on integers ONLY and uses NO handles whatsoever (other than 1 trigger handle :p)
Also, it has 1 character long variable names ^^
That should be perfect for a speed freak like you xD

EDIT:

THIS WORKSHOP IS TEMPORARILY STANDING BY. YOU MAY STILL GIVE REQUESTS,
BUT YOU SHOULD WAIT A WHILE LONGER BEFORE YOU GET THEM. Everything will resume
very soon after I finish my exams (I have 4 left).

@Nestharus: You'll have all those requests complete in a matter of time :p
And one other thing, the FlatFlier thing you wanted.. it's a simple edit of your old one that
stops units from bumping into terrain =P (You did everything else right :))
 
Last edited:
Level 31
Joined
Jul 10, 2007
Messages
6,306
Ehm, about the FlatFlier..

I didn't say bump into terrain, I said bumping over terrain.

Put in noisy terrain and run a flying unit with FlatFlier enabled over it. You'll see what I mean.

Run a ground unit next.

The ground unit will fly over flatly. The flying unit will being going up and down like a roller coaster.


Also, your algorithm needs a bit of work for the AbilityLogger..

As a unit is indexed, a list is created for it. That list is permanently allocated (only created if it doesn't already exist).

As a unit is deindexed, the list is cleared (ranged operations tutorial).

As an ability is added, it is added to 1 list, the list on that unit.

As an ability is removed, it's just removed from that list.

The ability id is logged into a hashtable so that the specific node on the list can be retrieved (only way to do it to avoid O(n) search). This hashtable should be running on table, and each unit should have a table associated with it (remember 1 ability may be on multiple units).

In this way, all abilities on a unit may be looped through ^)^.

Designing systems is half the work that goes into system creation =P. Getting the hang of this? : )
 
Status
Not open for further replies.
Top