TheLegend
New Member
- Reaction score
- 10
I've come across an idea to make a vertical pathing system but i lack the proper ideas for it
a system short but effective that will create a vertical pathing network that will enable units to walk under bridges as well as over them, walk on other objects and units. It may sound complicated but it would make wc3 maps a lot more realistic. Making player units being able to jump on crates and from crates onto houses, walking under a bridge, trough a cave in the mountain, moving around houses and climbing onto the next floor of the house and so on
DOWNLOAD LINK AT THE BOTTOM OF THE POST
by storing units height, object height and terrain height and adjust the flight z of an unit to make it look like its on or under another object. I know this will be hard to make so please feel free to use this post to exchange ideas and progress and when we finish the project we could get enormous credit and rep for it. Ill update how far i get with this project and please feel free to experiment on your own.
Footman - height 92
Peasant - height 91
Knight - height 130
Bridge - height 256, fly height 50 (for cliff lvl 2)
NOTE: If you can calculate the height yourself and post in this Discussion for various units and if I have made a mistake correct me, i calculated by
making a lvl 1 cliff (i know the height is 128) using CTRL + right click hold + drag to adjust the camera so that the angle is 0 and change the scaling
of the unit so that the height is the same as the cliffs
- a system that would index possible z's of locations (not needed, the OZSYS works better than expected)
- Bridge height adjust system (complete)
- a new jump system with the new object height (im making it right now)
- someone to calculate existing units heights (new request)
- better models of bridges, houses and stuff
The Object Z System or OZSYS, used for detecting the occupied height of units (designed for a jump system), will be needed later. This requires
the users "help" to operate, the user has to create units for every object he wants to index and set the Point Value of that unit (Object Editor)
to the units height
The Bridge system or simply BRSYS will (if you did everything the OZSYS required of you, that is create a unit for the bridge) make the units walk on or under the bridges. IT WORKS STUNNING MATES, JUST STUNNING
made a test map with some units necessary for the system (a knight, bridge, crate (for later)), youll need NewGen to open
http://www.epicwar.com/maps/199037/
WHAT I'M AIMING FOR
a system short but effective that will create a vertical pathing network that will enable units to walk under bridges as well as over them, walk on other objects and units. It may sound complicated but it would make wc3 maps a lot more realistic. Making player units being able to jump on crates and from crates onto houses, walking under a bridge, trough a cave in the mountain, moving around houses and climbing onto the next floor of the house and so on
DOWNLOAD LINK AT THE BOTTOM OF THE POST
HOW I THINK THIS CAN BE DONE
by storing units height, object height and terrain height and adjust the flight z of an unit to make it look like its on or under another object. I know this will be hard to make so please feel free to use this post to exchange ideas and progress and when we finish the project we could get enormous credit and rep for it. Ill update how far i get with this project and please feel free to experiment on your own.
UNIT HEIGHTS
Footman - height 92
Peasant - height 91
Knight - height 130
Bridge - height 256, fly height 50 (for cliff lvl 2)
NOTE: If you can calculate the height yourself and post in this Discussion for various units and if I have made a mistake correct me, i calculated by
making a lvl 1 cliff (i know the height is 128) using CTRL + right click hold + drag to adjust the camera so that the angle is 0 and change the scaling
of the unit so that the height is the same as the cliffs
WHAT COULD BE USEFUL
- a system to get a object's height (complete)- a system that would index possible z's of locations (not needed, the OZSYS works better than expected)
- Bridge height adjust system (complete)
- a new jump system with the new object height (im making it right now)
- someone to calculate existing units heights (new request)
- better models of bridges, houses and stuff
SYSTEMS SO FAR
The Object Z System or OZSYS, used for detecting the occupied height of units (designed for a jump system), will be needed later. This requires
the users "help" to operate, the user has to create units for every object he wants to index and set the Point Value of that unit (Object Editor)
to the units height
JASS:
//////////////////////////////////////////////////////////////////////////////////////////
//TheLegend's Object height system //
//////////////////////////////////////////////////////////////////////////////////////////
//IMPORTANT INFO
//--------------------------------------------------------------------------------------//
//Before importing the system you have to replace every object with units that have that//
//objects model and add them into the init function at the bottom. This system is used //
//to get the minimum z on which a unit can stand at the location. This will enable the //
//user to create more advanced jump systems where the units will be able to jump onto //
//other units, walk under as well as over bridges, jump onto and over crates, houses, //
//rocks and so on. This library will provide the user with these functions: //
/* function GetMinimumZ(location,boolean,real,boolean) */
// -gets the minimum height if a new unit enters that location, the boolean will //
// determine will the terrain be included. Range is how far from the unit to scan //
// and the last bool is if the systen will include the fly height //
/* function GetUnitsZ(unit) */
// -gets the units vertical Z value (on which height it is) //
//--------------------------------------------------------------------------------------//
//IMPLEMENTATION
//--------------------------------------------------------------------------------------//
//You will need vJass or NewGen World editor to implement this. If you have it then just//
//create a trigger, convert it to custom text and replece everything there with this. //
//Before you run the system make sure all dodads, objects are replaced with units, you //
//will have to create units with their models since units are the only tracable things //
//in the world editor.And the system uses Units Point values to operate. You have to //
//define the unit heights ( Point value) but here is a hint how to orientate, the cliff //
//lvl 1 is 128 high //
//////////////////////////////////////////////////////////////////////////////////////////
library OZSYS
globals
private constant boolean enablesystem = true
private group tempunitgroup = CreateGroup()
private real tempreal
endglobals
public function GetUnitsZ takes unit u returns real
local location l
set tempreal = 0
set l = GetUnitLoc(u)
set tempreal = GetUnitFlyHeight(u) + GetLocationZ(l)
set l = null
return tempreal
endfunction
public function GetMinimumZ takes location l, boolean terrain,real range,boolean fly returns real
local integer flyon = 0
set tempreal = 0
set tempunitgroup = GetUnitsInRangeOfLocMatching(range, l,null)
if fly then
set flyon = 1
endif
loop
exitwhen FirstOfGroup(tempunitgroup) == null
if tempreal < GetUnitPointValue(FirstOfGroup(tempunitgroup)) + flyon*GetUnitFlyHeight(FirstOfGroup(tempunitgroup)) then
set tempreal = GetUnitPointValue(FirstOfGroup(tempunitgroup)) + flyon*GetUnitFlyHeight(FirstOfGroup(tempunitgroup))
endif
call GroupRemoveUnit(tempunitgroup,FirstOfGroup(tempunitgroup))
endloop
if terrain then
set tempreal = tempreal + GetLocationZ(l)
endif
return tempreal
endfunction
endlibrary
The Bridge system or simply BRSYS will (if you did everything the OZSYS required of you, that is create a unit for the bridge) make the units walk on or under the bridges. IT WORKS STUNNING MATES, JUST STUNNING
JASS:
//////////////////////////////////////////////////////////////////////////////////
//Bridge by TheLegend //
//////////////////////////////////////////////////////////////////////////////////
//INFO
//------------------------------------------------------------------------------//
//This system needs OZSYS to operate, if it is not included within the map you //
//found this then the map is a rip. The system will attempt to give units the //
//ability to walk under as well as over bridges, restrict fighting of units on //
//different "levels" of the bridge. NOTE that this is not a cinematic effect but//
//an addon to warcraft to make it better and more realistic, open new ways of //
//map games and so on //
//////////////////////////////////////////////////////////////////////////////////
library BRSYS initializer init uses OZSYS
globals
public group bridges = CreateGroup()
private integer indextotal = 1
endglobals
private struct unitindexer
integer id
unit u
location savedloc
endstruct
globals
private unitindexer array D
endglobals
private function destroyD takes unitindexer data returns nothing
local integer dataid = data.id
call data.destroy()
set indextotal = indextotal - 1
loop
set dataid = dataid + 1
set D[dataid - 1] = D[dataid]
exitwhen D[dataid].u == null
endloop
endfunction
private function boolexpr1 takes nothing returns boolean
return IsUnitInGroup(GetFilterUnit(),bridges) == false
endfunction
private function modandsort takes nothing returns nothing
local unitindexer temp = unitindexer.create()
local unit u
if GetTriggerUnit() == null then
set u = GetEnumUnit()
else
set u = GetTriggerUnit()
endif
call UnitAddAbility(u, 039;Amrf039;)
call UnitRemoveAbility(u, 039;Amrf039;)
if GetUnitTypeId(u) == 039;h001039; then
call GroupAddUnit(bridges,u)
else
set temp.id = indextotal
set temp.u = u
set D[indextotal] = temp
set indextotal = indextotal + 1
endif
endfunction
private function identify takes unit u returns integer
local integer unitid = 1
loop
exitwhen D[unitid].u == u
set unitid = unitid + 1
endloop
return unitid
endfunction
private function setunits takes nothing returns nothing
local location l = GetUnitLoc(GetEnumUnit())
local location l1
local group g = GetUnitsInRangeOfLocMatching(350, l,Not(Filter(function boolexpr1)))
local integer id = identify(GetEnumUnit())
local real height
local real x = GetUnitX(GetEnumUnit()) - 64 * Cos(GetUnitFacing(GetEnumUnit())*bj_DEGTORAD)
local real y = GetUnitY(GetEnumUnit()) - 64 * Sin(GetUnitFacing(GetEnumUnit())*bj_DEGTORAD)
set l = Location(x,y)
if FirstOfGroup(g) != null then
if D[id].savedloc == null then
set D[id].savedloc = l
endif
set l = GetUnitLoc(GetEnumUnit())
set l1 = GetUnitLoc(FirstOfGroup(g))
call SetUnitPathing( GetEnumUnit(), false )
set height = GetLocationZ(D[id].savedloc) - OZSYS_GetMinimumZ(l1,true,256,false)
if height <= 64 and height >= - 64 and GetLocationZ(l) != GetLocationZ(D[id].savedloc)then
set height = OZSYS_GetMinimumZ(l1,true,16,false) - GetLocationZ(l)
call SetUnitFlyHeight(GetEnumUnit(),height,0)
else
call SetUnitFlyHeight(GetEnumUnit(),0,0)
endif
else
call SetUnitFlyHeight(GetEnumUnit(),0,0)
call SetUnitPathing( GetEnumUnit(), true )
set D[id].savedloc = null
endif
call RemoveLocation(l)
call RemoveLocation(l1)
set height = 0
set id = 0
set x = 0
set y = 0
endfunction
private function bridgecheck takes nothing returns nothing
local group g = GetUnitsInRectMatching(GetWorldBounds(),Filter(function boolexpr1))
call ForGroup(g, function setunits)
call GroupClear(g)
endfunction
private function leftmap takes nothing returns nothing
call destroyD(D[identify(GetTriggerUnit())])
call GroupRemoveUnit(bridges,GetTriggerUnit())
endfunction
private function init takes nothing returns nothing
local group allunits = GetUnitsInRectMatching(GetWorldBounds(),null)
local trigger t = CreateTrigger()
call ForGroup(allunits, function modandsort)
call TriggerRegisterTimerEvent(t, 0.1, true)
call TriggerAddAction(t,function bridgecheck)
set t = CreateTrigger()
call TriggerRegisterEnterRectSimple(t, GetWorldBounds())
call TriggerAddAction(t,function bridgecheck)
call GroupClear(allunits)
set t = CreateTrigger()
call TriggerRegisterLeaveRectSimple(t, GetWorldBounds())
call TriggerAddAction(t,function leftmap)
set t = null
endfunction
endlibrary
AND NOW THE TEST MAP
made a test map with some units necessary for the system (a knight, bridge, crate (for later)), youll need NewGen to open
http://www.epicwar.com/maps/199037/