Infinitegde
O.O
- Reaction score
- 86
Oasis - Object Attachment System v 1.5
By Infinitegde
[YOUTUBE]<object width="320" height="265"><param name="movie" value="http://www.youtube.com/v/6JzlxDq_rf4&hl=en&fs=1&color1=0x5d1719&color2=0xcd311b"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/6JzlxDq_rf4&hl=en&fs=1&color1=0x5d1719&color2=0xcd311b" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="320" height="265"></embed></object>[/YOUTUBE]
[YOUTUBE]<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/DS6MuL0ckOI&hl=en&fs=1&color1=0x5d1719&color2=0xcd311b"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/DS6MuL0ckOI&hl=en&fs=1&color1=0x5d1719&color2=0xcd311b" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object>[/YOUTUBE]
-3 new skills created solely from this system.
-Sorry about the green spinning thing at the end, it got really choppy bc I was trying to capture a higher quality video then the last but after hosting on youtube doesnt look like it made a difference.
Table of ContentsBy Infinitegde
[YOUTUBE]<object width="320" height="265"><param name="movie" value="http://www.youtube.com/v/6JzlxDq_rf4&hl=en&fs=1&color1=0x5d1719&color2=0xcd311b"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/6JzlxDq_rf4&hl=en&fs=1&color1=0x5d1719&color2=0xcd311b" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="320" height="265"></embed></object>[/YOUTUBE]
[YOUTUBE]<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/DS6MuL0ckOI&hl=en&fs=1&color1=0x5d1719&color2=0xcd311b"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/DS6MuL0ckOI&hl=en&fs=1&color1=0x5d1719&color2=0xcd311b" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object>[/YOUTUBE]
-3 new skills created solely from this system.
-Sorry about the green spinning thing at the end, it got really choppy bc I was trying to capture a higher quality video then the last but after hosting on youtube doesnt look like it made a difference.
I.History
II. Description
III. Documentation
IV. Future Developments
V. Screenshots
VI. Module Summary
VII. Code
VIII. Modules (next post)
I.History
1/22/09: Ver 1
1/24/09: Ver 1.2- Added CopyAll, and introduced Supplementary package for ease of use.
1/24/09: Updated Test Map. Slipped in the GetAttached() function(stores it into global array GA).
6/15/09: Ver 1.3
- Revampage. Completely changed.
- Some old functionality lost.
- New Action system created.
8/29/09: Ver 1.4
-Another major revampage.
-Streamlined a few bulky periodic functions to decrease lag.
-Made System Modular.
9/1/09: Ver 1.5
-Fixed some compatibility issues with the modules with ver 1.4
-Fixed some issues in the system.
-Added More Modules.
-Updated some functions.
-Updated Documentation.
II. Description
Requires: Timer32,a dummy model(in test map).
GUI/JASS/vJASS: vJass
An object attachment system. Allows for various manipulations and attachments.
III. Documentation
Implementation:
1.Create a Trigger named OASIS.
2.Convert to Custom text.
3.Replace everything in there with OASIS System.
4.Import dummy.mdx into map and ensure the path is still "war3mapImported\dummy.mdx".(you can get dummy.mdx from test map).
// If you dont know how to use object merger look at the next two lines.
5.Save the file with JNGP, and ensure that jasshelper ran.
6.Close, reopen the map, and comment out the line below.
//! external ObjectMerger w3u uloc oadd umdl "war3mapImported\dummy.mdl" ufoo 0 uabi 'Aloc' uaen 0 ucbs 0 ucpt 0 ushu ""
Basic objects:
Node and UNode.
Basic Creation:
Nodes and Unodes dont have much use in themself. You would have to import an object module like "shape." Documentation on creation can be found in the module.
However standard creation is as such:
JASS:
local ObjectType a = createObjectTypeonUnit(args)
Basic Destruction:
JASS:
call obj.remove()
Basic Manipulation:
Data: (usually set for callback on destruction)
Decay Time:
JASS:
set obj.dtime = 30
//Destroys itself after 30 seconds.
OnDestructionDo:
JASS:
set obj.callback = DamageAllInArea
where "DamageAllInArea" is a function that takes obj dyingobj and integer data. Example:
Complete List of Basic Members:
JASS:
obj super=0 // set .super = another object to attach it.
real dtime =-1// set this as expiration time.
integer data=0//data that is accepted by callback.
OASISCallBack callback =0//callback function.
boolean destroysuper=true//boolean on whether or not to destroy the object this one is attached to.
method addAction takes Action a returns nothing//Adds an action.
method remove takes nothing returns nothing//Removes a specific action.
method removeAllActions takes nothing returns nothing//Removes All Actions.
method operator X takes nothing returns real// Get X Position
method operator Y takes nothing returns reall// Get Y Position
method operator Z takes nothing returns reall// Get Z Position
method operator U takes nothing returns unitl// Get U. If none then returns null.
method operator X= takes real r returns nothing// Set X Position
method operator Y= takes real r returns nothing// Set Y Position
method operator Z= takes real r returns nothing// Set Z Position
method operator U= takes unit u returns nothing// Set Unit if possible.
method changeUnit takes OASISAffectUnit o returns nothing//Allows for change to eyecandy units. Does not effect root unit.
//Usage Example:
call obj.changeUnit(SetScaleSmall)
//where SetScaleSmall is
function SetScaleSmall takes unit u returns nothing
call SetScaleUnit(u,.2,.2,.2)
endfunction
Advanced Manipulation:
Action System:
From ver 1.4, the Action system has completely become modular. However, the basic creation of it is standardized like so:
JASS:
call AddActionBlah(obj,args...)
Mostly use function interfaces.
IV. Future Developments
-3D polygon module.
-More Actions.
V.Screenshots
None atm.
VI.Module Summary
Objects-
shape//A sphere with n number of units in a ring and z layers.
advshape// advanced shape ZRotations.
single//a single unit that rotates and expands in n and z directions.
polypoint//Polygon or pathway that can have multiple points
advpolypoint//same as above EXCEPT it can be expanded, rotated around a central point
explode//creates a mini explosion with numerous customizable options
Actions-
UDFunc //Unit Death Function
Translate //Translate Function
TimedEvent //Timer Function
EnumUnits //PicksEveryUnit Function
Combined Documentation:
JASS:
//Shape:==============================
//Documentation:
// 2 Creation functions:
// function CreateShapeinPlace takes real x,real y,real z,string sfx,integer nVertice, integer zVertice,real radius returns shape
// function CreateShapeonUnit takes unit u,string sfx,integer nVertice, integer zVertice,real radius returns shape
// The first creates a static shape at x,y,z, with nVertice amount of edges and zVertice amount of zlayers with radius as a radius.
// The second creates a dynamic shape that follows unit u around with nVertice amount of edges and zVertice amount of zlayers with radius as a radius.
// Special Members:
// .Rotate= dps where dps is degrees per second. Rotates the shape.
// .Expand= valps where valps is dist per second. Expands the radius.
// .zOffset= height, independent of source.
//demonstration:
local shape s = CreateShapeInPlace(0,0,100,"random",10,5,100)
set s.Rotate=120
set s.Expand=1
//Advanced Shape:==============================
//Documentation:
// 2 Creation functions:
// function CreateAdvShapeInPlace takes real x,real y,real z,string sfx,integer nVertice, integer zVertice,real radius returns shape
// function CreateAdvShapeOnUnit takes unit u,string sfx,integer nVertice, integer zVertice,real radius returns shape
// The first creates a static shape at x,y,z, with nVertice amount of edges and zVertice amount of zlayers with radius as a radius.
// The second creates a dynamic shape that follows unit u around with nVertice amount of edges and zVertice amount of zlayers with radius as a radius.
// Special Members:
// .Rotate= dps where dps is degrees per second. Rotates the shape.
// .ZRotate= dps where dps is degrees per second. Rotates the shape on the Z-axis. I failed at fixing the ZRotation. Maybe I'll fix it later.
// .Expand= valps where valps is dist per second. Expands the radius.
// .zOffset= Height from attached pos.
//demonstration:
local advshape s = CreateAdvShapeInPlace(0,0,100,"random",10,5,100)
set s.Rotate=120
set s.ZRotate=10
set s.Expand=1
//Single Mod:==============================
//Documentation:
// 2 Creation functions:
// function CreateSingleInPlace takes real x,real y,real z,string sfx,integer deg, integer zdeg,real radius returns single
// function CreateSingleOnUnit takes unit u,string sfx,integer deg, integer zdeg,real radius returns single
// The first creates a static single around x,y,z, with sfx offset by radius at deg and zdeg.
// The second creates a dynamic singlethat follows unit u around with sfx offset by radius at deg and zdeg.
// Special Members:
// .Rotate= dps where dps is degrees per second. Rotates the unit.
// .ZRotate= dps where dps is degrees per second. Rotates the unit on Zaxis.
// .Expand= valps where valps is dist per second. Expands the radius.
// .zOffset= height, independent of source.
//demonstration:
local advshape s = CreateShapeinPlace(0,0,100,"random",10,5,100)
set s.Rotate=120
set s.ZRotate=10
set s.Expand=1
//Polypoint Mod============================================
//-can create static polygons or pathways. Puts less load on the computer then advpolypoint.
//Documentation:
// Demonstration on Creation:
local polypoint p = polypoint.create()
call p.addPoint(0,0)//Adds a point
call p.addPoint(0,500)//Adds a point
call p.addPoint(500,500)//Adds a point
call p.addPoint(500,0)//Adds a point
set p.Speed=10 // Speed of units.
call p.begin("SFX",10) //Creation method.
// This creates a square at 0,0 with each of its sides being length 500. 10 units rotate around the square move 10 units per second.
// Special Members:
// .Speed= dps where dps is dist per second. Units on the shape move at this speed.
// .close= boolean // If true, the pathway will automatically close itself if false, it will not and units will jump from the last point to the starting point.
// .zOffset= height.
//Advanced Polypoint Mod==============================================
//-can create rotating, expanding, and dynamic polygons or pathways. More load on the cpu then reg polypoint.
//Documentation:
// Demonstration on Creation:
local advpolypoint p = PolyPointOnUnit(GetTriggerUnit())
call p.addPRelated(-500,-500) // This has the same function as .addPoint except it does it in relation to the center point.
call p.addPoint(p.X-500,p.Y+500) // The above line created a point at -500,-500 to the center. This one creates it at -500,500 to the center.
call p.addPRelated(500,500) //Adds a point at 500,500 to center.
call p.addPoint(p.X+500,p.Y-500)//Adds a point at 500,-500 to center.
set p.Rotate = 10 //Sets rotation of entire polypoint around center point at 10 degrees per second.
set p.Expand = 10 //Sets Expansion of entire polypoint around center point at 10 dist per second.
set p.Speed=10 // Speed of units.
call p.begin("SFX",10) //Creation method.
// This creates a square at 0,0 with each of its sides being length 500. 10 units rotate around the square move 10 units per second.
// Special Members:
// .Rotate= dps where dps is degrees per second.
// .Expand= dps where dps is dist per second.
// .Speed= dps where dps is dist per second. Units on the shape move at this speed.
// .close= boolean // If true, the pathway will automatically close itself if false, it will not and units will jump from the last point to the starting point.
// .zOffset= height.
//Explosion Mod===============================
//-Creates an explosion at or on a unit with numerous customizable options.
//Creation:
local explode A = ExplodeOnUnit(unit u , real zOffset)
set A.g=1.1
set A.scale = .5
set A.minang=90
set A.maxang=180
set A.minz=0
set A.maxz=10
call A.Start(0,"SFX",40,90,5,callbackfuncthattakesunitu,false)
//What all this did was created an explosion on unit u with zOffset for a height. It created an explosion that shoots out particles in the 2nd quadrant or in the angle range 90-180.
//It also fired the particles at an angle of 80-90 degrees in the zdirection. (When using Z the common conventions are reversed and 0 means firing at the zenith, while 90 means firing parallel to ground)
//the A.Start function takes duration meaning duration of explosion. If its 0 then it will just create the explosion and no more particles will be fired.
//the next input is just the model.
// 3rd is min speed and 4th is maxspeed
//5th is the max amount of particles.
//6th is a callback function that calls when the particle reaches its destination.
//7th this boolean, if false, will cause the particle to continue till it hits the ground. If true, it will destroy the particle at the peak of its jump.
//Not all of these NEED to be customized, a simple explosion can be.
local explode A = ExplodeOnUnit(unit u , real zOffset)
call A.Start(0,"SFX",40,90,5,callbackfuncthattakesunitu,false)
//it would work fine, create an explosion that fires in ALL direction, in a sphere.
//Actions:
// function DestroyObjOnUD takes obj which returns nothing // Destroys object on root unit death.
// function AddUDFunc takes obj which, UDFUNCFI callback returns nothing // Allows you to add a custom death function. Function must take unit u, and obj m.
// function AddTranslation takes obj o, real x, real y, real time, TransFI onFinish returns nothing // Moves obj o to x,y over time seconds. When finished it call function onFinish which must take obj m.
// function AddTimedEvent takes obj which, real period, boolean periodic, TimedEventFI E returns nothing // Creates a timed event that fires on period seconds or every period seconds.
// where E is a function that takes obj m.
// function AddEnumUnits takes obj which, real period, EnumUnitsFI E returns nothing // Every period seconds it will call function E (that takes unit u, where unit u is every eyecandy unit in the object).
VII.Code
JASS:
//==========================================================================================
//===================== OASIS- Object Attachment System V 1.5 ============================
//===================== By Infinitegde ============================
//==========================================================================================
//Import Instructions:
//1.Create a Trigger named OASIS.
//2.Convert to Custom text.
//3.Replace everything in there with OASIS System.
//4.Import dummy.mdx into map and ensure the path is still "war3mapImported\dummy.mdx".
//5.Save your map with JNGP, and ensure that jasshelper ran.
//6.Close, reopen the map, and comment out the line below.
//! external ObjectMerger w3u uloc oadd umdl "war3mapImported\dummy.mdl" ufoo 0 uaen 0 ucbs 0 ucpt 0 ushu "" umxp 0 umxr 0 umvf 0
//==========================================================================================
//You can change these variables.
globals
constant integer MAXUNITSPERFIG = 50
endglobals
library OASISMODULES
//Insert modules here.
endlibrary
//==========================================================================================
//==========================================================================================
//==================== Begin Oasis Main Engine ===========================================
//==========================================================================================
//==========================================================================================
library OASIS initializer init
globals
constant integer ODID = 'oadd'
private real maxX
private real minX
private real maxY
private real minY
private location l
endglobals
function interface OASISCallBack takes obj o, integer d returns nothing
function interface OASISAffectUnit takes unit u returns nothing
struct obj
obj super=0
boolean toDestroy=false
real time =0
real dtime =-1
integer data=0
OASISCallBack callback =0
Action a =-1
boolean destroysuper=true
method addAction takes Action a returns nothing
local Action b
set a.super = this
if(.a==-1)then
set .a=a
return
endif
set b=.a
loop
exitwhen b.next==-1
if(a==b)then
return
endif
set b=b.next
endloop
set b.next = a
set a.prev = b
endmethod
method remove takes nothing returns nothing
set .toDestroy=true
endmethod
method removeAction takes Action a returns nothing
local Action b = .a
loop
exitwhen b==a or b.next==-1
set b=b.next
endloop
set b.prev.next = b.next
set b.next.prev = b.prev
call b.destroy()
endmethod
method removeAllActions takes nothing returns nothing
local Action b = .a
loop
exitwhen b.next==-1
set b=b.next
call b.prev.destroy()
endloop
call b.destroy()
endmethod
stub method operator X takes nothing returns real
return 0.0
endmethod
stub method operator Y takes nothing returns real
return 0.0
endmethod
stub method operator Z takes nothing returns real
return 0.0
endmethod
stub method operator U takes nothing returns unit
return null
endmethod
stub method operator X= takes real r returns nothing
set .super.X=r
endmethod
stub method operator Y= takes real r returns nothing
set .super.Y=r
endmethod
stub method operator Z= takes real r returns nothing
set .super.Z=r
endmethod
stub method operator U= takes unit u returns nothing
set .super.U=u
endmethod
stub method changeUnit takes OASISAffectUnit o returns nothing
endmethod
stub method periodic takes nothing returns boolean
local Action b
set .time = .time+.03215
if(.time> .dtime and .dtime!=-1)then
call .callback.execute(this,.data)
set .toDestroy= true
endif
if(.a!=-1)then
set b=.a
loop
exitwhen b==-1 or b==0
if(b.checkValid())then
call b.doFunc()
endif
set b= b.next
endloop
endif
if(.toDestroy)then
if .destroysuper then
call .super.remove()
endif
if .a!= -1 then
call .removeAllActions()
endif
call .destroy()
endif
return .toDestroy
endmethod
endstruct
private function init takes nothing returns nothing
set maxX=GetRectMaxX(bj_mapInitialPlayableArea)
set maxY=GetRectMaxY(bj_mapInitialPlayableArea)
set minX=GetRectMinX(bj_mapInitialPlayableArea)
set minY=GetRectMinY(bj_mapInitialPlayableArea)
endfunction
function SetSafeX takes unit u, real X returns nothing
if(X>maxX) then
set X = maxX-1
endif
if(X<minX) then
set X = minX+1
endif
call SetUnitX(u,X)
endfunction
function SetSafeY takes unit u, real X returns nothing
if(X>maxY) then
set X = maxY-1
endif
if(X<minY) then
set X = minY+1
endif
call SetUnitY(u,X)
endfunction
function SetSafeZ takes unit u, real X returns nothing
set l = GetUnitLoc(u)
call UnitAddAbility(u,'Amrf')
call SetUnitFlyHeight(u,X-GetLocationZ(l),0)
call UnitRemoveAbility(u,'Amrf')
call RemoveLocation(l)
set l = null
endfunction
function GetUnitZ takes unit u returns real
local real Z
set l = GetUnitLoc(u)
set Z = GetUnitFlyHeight(u)+GetLocationZ(l)
call RemoveLocation(l)
set l = null
return Z
endfunction
//==================================Begin Base Module===========================================
struct unode extends obj
unit u=null
static method create takes unit u returns unode
local unode s = unode.allocate()
set s.u=u
return s
endmethod
method operator X takes nothing returns real
return GetUnitX(.u)
endmethod
method operator Y takes nothing returns real
return GetUnitY(.u)
endmethod
method operator Z takes nothing returns real
return GetUnitZ(.u)
endmethod
method operator U takes nothing returns unit
return .u
endmethod
method operator X= takes real r returns nothing
call SetSafeX(.u,r)
endmethod
method operator Y= takes real r returns nothing
call SetSafeY(.u,r)
endmethod
method operator Z= takes real r returns nothing
call SetSafeZ(.u,r)
endmethod
method operator U= takes unit u returns nothing
set .u=u
endmethod
implement T32
endstruct
struct node extends obj
real x
real y
real z
static method create takes real x, real y, real z returns node
local node s = node.allocate()
set s.x=x
set s.y=y
set s.z=z
return s
endmethod
method operator X takes nothing returns real
return .x
endmethod
method operator Y takes nothing returns real
return .y
endmethod
method operator Z takes nothing returns real
return .z
endmethod
method operator X= takes real r returns nothing
set .x=r
endmethod
method operator Y= takes real r returns nothing
set .y=r
endmethod
method operator Z= takes real r returns nothing
set .z=r
endmethod
method operator U= takes unit u returns nothing
endmethod
implement T32
endstruct
//==================================Action System===============================================
struct Action
Action prev=-1
Action next=-1
obj super
stub method checkValid takes nothing returns boolean
return true
endmethod
stub method doFunc takes nothing returns nothing
endmethod
endstruct
//==================================Unit System===============================================
struct OASISUnit
unit u
effect s
OASISUnit prev=-1
OASISUnit next=-1
method onDestroy takes nothing returns nothing
call KillUnit(.u)
call DestroyEffect(.s)
call RemoveUnit(.u)
endmethod
endstruct
endlibrary
New test map.
Attachments
-
105.5 KB Views: 248