- Joined
- Dec 12, 2008
- Messages
- 7,385
«««««« 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
Requires: TimerUtils
Requires: Table & UnitIndexer
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: