• 0

    posted a message on Reaper Madness (Showcase 2: Physics)
    Quote from Kn4rcita: Go

    You can fix camera lag. I've seen camera render distances being modified in the following maps. Peredition, Mars Sara. You can look into the triggers for more info.

    make the target box larger to compensate for high lat.

    Cameara Jolting? Someone's going to come up with a solution in no time. It's probably in the animation.

    if you must give up, can you release your stuff so that others can make progress? It looks pretty damm impressive. Without jass eh?

    I have no problems with camera lag and my camera jolting issue is exclusive to a unit moving over the edge of a cliff, and is caused by the invisible ramp. I also already have larger hitboxes when connected to bnet to compensate for lag, however that does not address the delay when moving and jumping.

    Posted in: Project Workplace
  • 0

    posted a message on Bug in GE - UnitInventoryLastCreated()

    A bug in GE makes UnitInventoryLastCreated() unusable. The library definition specifies that it takes a unit parameter, but it doesn't. If you try to save your map with "Last Inventory Item Created" you will get an invalid parameter type error. The workaround I'm using for this is instead of selecting "Last Inventory Item Created" from the Function menu, I'm adding the Custom Script "UnitInventoryLastCreated()" in its place.

    Posted in: Galaxy Editor Bugs and Feedback
  • 0

    posted a message on [Trigger] How to Target with Mouselook (Tracelines)
    Quote from doos101: Go

    @rrowland, ur traceline still does not work @@...

    I did a periodic event every 0 secs and input Traceline(position of main unit, camera height: 1, 1); And the traceline_targetPoint is always at the main unit... My camera works just like urs its not pointing at the unit.

    That's because 1.0 is under the world height, which is 8.0 by default. Pass camera height as WorldHeight + 1.0 instead of 1.0.

    Posted in: Tutorials
  • 0

    posted a message on Triggering A.I to use skills

    @Layola: Go

    Oops, I forgot to re-add the if statement.

    Attack
        Events
            Unit - Any Unit Becomes idle
        Local Variables
            Target Unit = No Unit <Unit>
            Target Location = No Point <Point>
        Conditions
        Actions
            General - If (Conditions) then do (Actions) else do (Actions)
                If
                    Computer[(Owner of (Triggering unit))] == true
                Then
                    Variable - Set Target Unit = (Random Living unit from (Units in (Entire map) having alliance Enemy with player (Owner of (Triggering unit)) matching Excluded: Air, Missile, Dead, Hidden, with at most Any Amount))
                    Variable - Set Target Location = (Position of Target Unit)
                    Unit - Order Hero[(Owner of (Triggering unit))] to (High Templar - High Templar - Psionic Storm targeting (Position of Target Unit)) (Replace Existing Orders)
                Else
    
    Posted in: Miscellaneous Development
  • 0

    posted a message on [Trigger] How to Target with Mouselook (Tracelines)

    As a follow-up to my previous post, here's a way to double the maximum. Change your fast trigger to this:

    Fast Trigger
        Events
            Game - Map initialization
        Local Variables
        Conditions
        Actions
            Variable - Set Timer Elapsed = (Timer Elapsed + 1)
            General - Wait 0.0 Game Time seconds
            Trigger - Run Fast Trigger  (Ignore Conditions, Don't Wait until it finishes)
    

    This will double your maximum loops per second to 46. If you remove the Wait statement you will exceed 128 which will cause a stack overflow, so it's necessary.

    Posted in: Tutorials
  • 0

    posted a message on Triggering A.I to use skills

    The loop was unnecessary. This works:

    Attack
        Events
            Unit - Any Unit Becomes idle
        Local Variables
            Target Unit = No Unit <Unit>
            Target Location = No Point <Point>
        Conditions
        Actions
            Variable - Set Target Unit = (Random Living unit from (Units in (Entire map) having alliance Enemy with player (Owner of (Triggering unit)) matching Excluded: Air, Missile, Dead, Hidden, with at most Any Amount))
            Variable - Set Target Location = (Position of Target Unit)
            Unit - Order Hero[(Owner of (Triggering unit))] to (High Templar - High Templar - Psionic Storm targeting (Position of Target Unit)) (Replace Existing Orders)
    
    Posted in: Miscellaneous Development
  • 0

    posted a message on [Trigger] How to Target with Mouselook (Tracelines)
    Quote from sherardt: Go

    Rrowland thats not correct basically the fastest time you can implement is .0001 of a second well if you input 0.0 is actually refreshing as fast as possible which is even faster. I noticed with the traceline function there is no need to do it faster than .2 seconds because you will eat alot of ram the other method just redoing the same feature. This will cause latency problems later on with multi-player maps and for slower machines.

    Well just to make sure, I just ran a test:

    A variable to count how many times our fastest timer has elapsed:

    Timer Elapsed = 0 <Integer>
    

    Our fast timer:

    Every 0.0 seconds
        Events
            Timer - Every 0.00 seconds of Real Time
        Local Variables
        Conditions
        Actions
            Variable - Set Timer Elapsed = (Timer Elapsed + 1)
    

    Every 1 second of real time display how many times the fast timer has run and reset the count:

    Every 1 second
        Events
            Timer - Every 1.0 seconds of Real Time
        Local Variables
        Conditions
        Actions
            Debug - Display (Text(Timer Elapsed)) as debug output using Type 1, and Do display it in the game window
            Variable - Set Timer Elapsed = 0
    

    So every 0.00 seconds it will increase the integer by 1. After 1 second, it displays the number of iterations and then sets the integer back to 0.

    Here are the results (plugging in different times for the fast timer):
    0.00 seconds = 23 loops
    0.0001 seconds = 23 loops
    0.001 seconds = 23 loops
    0.01 seconds = 23 loops
    0.1 seconds = 8 loops

    Those results show that really 0.045 is actually the fastest time you can implement using real time. If we switch our fastest loop to game time and switch our game speed to 'fastest', we get the results:
    0.00 seconds = 23 loops
    0.0001 seconds = 23 loops
    0.001 seconds = 23 loops
    0.01 seconds = 23 loops
    0.1 seconds = 11 loops

    So yes, I was wrong that the shortest loop interval is 1/32 of a second, it is in fact worse at 1/23 of a second. Using game time does not affect this limit, only the rate at which you reach the limit.

    Posted in: Tutorials
  • 0

    posted a message on Victory / Defeat

    @WraithChaser: Go

    Make a global variable (in the trigger list on the left) named "mainUnit" of type "unit" and make it an array of size 2. After you spawn each unit, set the mainUnit of that player to Last Created Unit.

    mainUnit[0] = Unit that was created for player 1.
    mainUnit[1] = Unit that was created for player 2.

    If mainUnit[0] dies, player 2 wins
    If mainUnit[1] dies, player 1 wins

    Posted in: Miscellaneous Development
  • 0

    posted a message on Triggering A.I to use skills

    @Layola: Go

    The units also have to have the ability you're trying to make them cast.

    If you upload the map I'll take a look.

    Posted in: Miscellaneous Development
  • 0

    posted a message on [Trigger] How to Target with Mouselook (Tracelines)
    Quote from doos101: Go

    I think the whole traceline idea is great. But the problem with it is that we need to create a vector system in order to create a very realistic shooting system.

    Right now, what I've been doing is simply using the point that the center of the camera is looking at and create a sniper damage from the main unit to any unit within that point. Now this is the problem, because what happens if you are targeting the head of a unit, but that is actually pointing to a point far far away from the unit's head? Aha see, that is a problem! Hence we need to create a vector system, instead of using the dumb environment effect that blizzard creates, we need to create an actual missile that goes to that point. If the missile hits something, kill it and it will do damage.

    This map so far uses a line system, so it is much more accurate than sherardt's way of using circle region at the point clicked. It will create circle regions from main unit to target point and figure out which unit is the closest at that "line". But it doesn't make sense because you can pretty much target at a point beyond an enemy unit and still kill it if u get the angle right... So it does not replace the missile system I'm talking about.

    PRESS ESC for the 3rd person view

    You're talking about two different things. You're saying you want to treat bullets like missiles, in which case yes you'd use vectors. The minimum amount of time spent between steps is "0.0" which actually means 1/32 of a second (I believe) due to the fixed point (reals) system. Assuming that a bullet should span an entire map in less than 0.1 seconds, that means each step would be approximately 1/3 of the map. You can't simply check for a hit every step this way, or you would only ever hit a unit if the bullet happened to land on him at one of the wide steps. You would need to generate a heightmap of the entire map to get the planes of the terrain, and you'd have to create a box of planes around every unit that is shootable. Then you'd need to run some vector calculations to determine whether or not the bullet's directional vector intersects any of those planes. In the case of multiple, you'd have to figure out which one it hit first.

    The most obvious downside is you won't be able to see which unit the player is looking at without a traceline. You could implement both, but that's a much bigger load you're throwing on the processor.

    Posted in: Tutorials
  • 0

    posted a message on [Trigger] How to Target with Mouselook (Tracelines)
    Quote from Kanaru: Go

    I also haven't been able to get the camera to work the way I think it's supposed to. The map linked here that has it working doesn't really work because targeting is based off of mouse XYZ and doesn't seem to use the traceline. This of course means it won't be possible to get headshots or shoot at the sky for example.

    Here are my camera functions, straight from my code:

    // Initialize Cameras \\
    //--------------------------------------------------------------------------------------------------//
    void cf_InitCameras()
    {
    	int i = 0;
    	
    	while (i < PlayerGroupCount(PlayerGroupActive())) {
    		CameraSetValue(gv_players[i].playerID, c_cameraValueHeightOffset, -0.5, 0, 0, 0);
    		CameraSetValue(gv_players[i].playerID, c_cameraValueDistance, 3.0, 0, 0, 0);
    		CameraSetValue(gv_players[i].playerID, c_cameraValueNearClip, 0.3, 0, 0, 0);
    		CameraSetValue(gv_players[i].playerID, c_cameraValueFarClip, 200.0, 0, 0, 0);
    		CameraSetValue(gv_players[i].playerID, c_cameraValueFieldOfView, 75.0, 0, 0, 0);
    		
    		CameraSetMouseRotates(gv_players[i].playerID, true);
    		CameraForceMouseRelative(gv_players[i].playerID, true);
    		CameraUseHeightDisplacement(gv_players[i].playerID, false);
    		CameraUseHeightSmoothing(gv_players[i].playerID, false);
    		
    		VisRevealArea(gv_players[i].playerID, RegionEntireMap(), 0, false);
    		
    		i += 1;
       }
    
    	libNtve_gf_HideGameUI(false, PlayerGroupActive());
    }
    
    //--------------------------------------------------------------------------------------------------
    // Trigger: Update Camera
    //--------------------------------------------------------------------------------------------------
    
    bool gt_UpdateCamera_Func (bool testConds, bool runActions) {
    
    	int i = 0;
    
    	while (i < PlayerGroupCount(PlayerGroupActive())) {
    	
    		if(!gv_players[i].leftKeyDown){
    			UnitSetFacing(gv_players[i].mainUnit, CameraGetYaw(gv_players[i].playerID) + cf_GetWASDAngle(i), 0.0);
    		} else {
    			UnitSetFacing(gv_players[i].mainUnit, CameraGetYaw(gv_players[i].playerID), 0.0);
    		}
    		
    		CameraSetBounds(
    			PlayerGroupSingle(gv_players[i].playerID), 
    			RegionCircle(
    				PointWithOffsetPolar(
    					UnitGetPosition(gv_players[i].mainUnit),
    					0.0,
    					UnitGetFacing(gv_players[i].mainUnit)
    				),
    				0.001
    			), 
    			false
    	);
    		
    		if(CameraGetPitch(gv_players[i].playerID) < 270 && CameraGetPitch(gv_players[i].playerID) > 180) { 
    			CameraSetValue(
    				gv_players[i].playerID,
    				c_cameraValuePitch,
    				270,
    				0.0,
    				30.0,
    				10.0
    			); 
    		}
    		else if(CameraGetPitch(gv_players[i].playerID) > 90.0 && CameraGetPitch(gv_players[i].playerID) <= 180) {
    			CameraSetValue(
    				gv_players[i].playerID,
    				c_cameraValuePitch,
    				90.0,
    				0.0,
    				30.0,
    				10.0
    			); 
    		}
    		
    		i += 1;
       }
    
    	return true;
    }
    void gt_UpdateCamera_Init () {
       gt_UpdateCamera = TriggerCreate("gt_UpdateCamera_Func");
    	TriggerAddEventTimePeriodic(gt_UpdateCamera, 0.0, c_timeGame);
    }
    
    Posted in: Tutorials
  • 0

    posted a message on [Trigger] How to Target with Mouselook (Tracelines)
    Quote from sherardt: Go

    Rrowland I have a question for you? How did your trace line to affect a Mutalisk in that first video? I put some air units in the map and I have to aim low still to view their information?

    Yeah, you need to set a Z value for flying units. I went over this briefly in the tutorial, you will have to replace the 0.0 in

    lp_cameraHeight + lv_traceHeight - lv_unitWorldHeight >= 0.0 &&
    

    with the height of the unit. You will also need to replace the c_heightMapGround in

    lv_unitWorldHeight = WorldHeight(c_heightMapGround, UnitGetPosition(lv_closestUnit));
    

    with c_heightMapAir. The way I handled this is by creating structs (basically a variable with multiple variables inside) that describe each type of unit I will have in my game. Then at the beginning of the game I iterated through every unit and set their custom values to some of my custom values such as radius, heightmap, hitboxes etc.

    I store some enumerated values in constants to make my code more readable, here are the relative constants:

    //--------------------------------------------------------------------------------------------------
    // General
    //--------------------------------------------------------------------------------------------------
    
    const int   c_EnemyTypes 	= 4;
    const int   c_MaxPlayers	= 4;
    const fixed c_MaxRange      = 30.0;
    
    //--------------------------------------------------------------------------------------------------
    // Custom Unit Values
    //--------------------------------------------------------------------------------------------------
    
    const int c_CustomValues_UnitType 		=	0;
    const int c_CustomValues_OffsetZ 		=	1;
    const int c_CustomValues_Height 		=	2;
    const int c_CustomValues_HeightMap 		=	3;
    const int c_CustomValues_Radius 		=	4;
    const int c_CustomValues_PhysicsIndex 	=	5;
    

    Here are my two struct definitions:

    struct	Hitbox {
    	string name;
    	fixed radius;
    	fixed offsetX;
    	fixed offsetY;
    	fixed offsetZ;
    	fixed height;
    	fixed damageMultiplier;
    };
    
    struct	UnitInfo {
    	string name;
    	string portrait;
    	int heightMap;
    	Hitbox[10] hitboxes;
    };
    

    I initialize a variable as an array of structs. c_EnemyTypes represents how many unit hitboxes I have customized:

    UnitInfo [c_EnemyTypes]         	gv_enemyTypes;
    

    Next I initialize all of my custom unit info. This is run only once at the very beginning of the game:

    // Initialize Enemy Types \\
    //--------------------------------------------------------------------------------------------------//
    void cf_InitEnemyTypes()
    {
    	//Mutalisk
    	gv_enemyTypes[0].name = "Mutalisk";
    	gv_enemyTypes[0].portrait = "MutaliskPortrait";
    	gv_enemyTypes[0].heightMap = c_heightMapAir;
    	
    	gv_enemyTypes[0].hitboxes[0].name = "Body";
    	gv_enemyTypes[0].hitboxes[0].radius = 0.6;
    	gv_enemyTypes[0].hitboxes[0].offsetX = 0.0;
    	gv_enemyTypes[0].hitboxes[0].offsetY = 0.0;
    	gv_enemyTypes[0].hitboxes[0].offsetZ = 3.2;
    	gv_enemyTypes[0].hitboxes[0].height = 1.9;
    	gv_enemyTypes[0].hitboxes[0].damageMultiplier = 1.0;
    	
    	gv_enemyTypes[0].hitboxes[1].name = "Head";
    	gv_enemyTypes[0].hitboxes[1].radius = 0.5;
    	gv_enemyTypes[0].hitboxes[1].offsetX = 0.0;
    	gv_enemyTypes[0].hitboxes[1].offsetY = 0.0;
    	gv_enemyTypes[0].hitboxes[1].offsetZ = 4.0;
    	gv_enemyTypes[0].hitboxes[1].height = 0.6;
    	gv_enemyTypes[0].hitboxes[1].damageMultiplier = 2.5;
    	
    	
    	//Zergling
    	gv_enemyTypes[1].name = "Zergling";
    	gv_enemyTypes[1].portrait = "ZerglingPortrait";
    	gv_enemyTypes[1].heightMap = c_heightMapGround;
    	
    	gv_enemyTypes[1].hitboxes[0].name = "Body";
    	gv_enemyTypes[1].hitboxes[0].radius = 0.375;
    	gv_enemyTypes[1].hitboxes[0].offsetX = 0.0;
    	gv_enemyTypes[1].hitboxes[0].offsetY = 0.0;
    	gv_enemyTypes[1].hitboxes[0].offsetZ = -0.5;
    	gv_enemyTypes[1].hitboxes[0].height = 0.9;
    	gv_enemyTypes[1].hitboxes[0].damageMultiplier = 1.0;
    	
    	//Hydralisk
    	gv_enemyTypes[2].name = "Hydralisk";
    	gv_enemyTypes[2].portrait = "HydraliskPortrait";
    	gv_enemyTypes[2].heightMap = c_heightMapGround;
    	
    	gv_enemyTypes[2].hitboxes[0].name = "Body";
    	gv_enemyTypes[2].hitboxes[0].radius = 0.625;
    	gv_enemyTypes[2].hitboxes[0].offsetX = 0.0;
    	gv_enemyTypes[2].hitboxes[0].offsetY = 0.0;
    	gv_enemyTypes[2].hitboxes[0].offsetZ = -0.5;
    	gv_enemyTypes[2].hitboxes[0].height = 1.9;
    	gv_enemyTypes[2].hitboxes[0].damageMultiplier = 1.0;
    	
    	//Elite Reaper
    	gv_enemyTypes[3].name = "EliteReaper";
    	gv_enemyTypes[3].portrait = "ReaperPortrait";
    	gv_enemyTypes[3].heightMap = c_heightMapGround;
    	
    	gv_enemyTypes[3].hitboxes[0].name = "Body";
    	gv_enemyTypes[3].hitboxes[0].radius = 0.375;
    	gv_enemyTypes[3].hitboxes[0].offsetX = 0.0;
    	gv_enemyTypes[3].hitboxes[0].offsetY = 0.0;
    	gv_enemyTypes[3].hitboxes[0].offsetZ = -0.5;
    	gv_enemyTypes[3].hitboxes[0].height = 1.4;
    	gv_enemyTypes[3].hitboxes[0].damageMultiplier = 1.0;
    	
    	gv_enemyTypes[3].hitboxes[1].name = "Head";
    	gv_enemyTypes[3].hitboxes[1].radius = 0.2;
    	gv_enemyTypes[3].hitboxes[1].offsetX = 0.0;
    	gv_enemyTypes[3].hitboxes[1].offsetY = 0.0;
    	gv_enemyTypes[3].hitboxes[1].offsetZ = 0.55;
    	gv_enemyTypes[3].hitboxes[1].height = 0.31;
    	gv_enemyTypes[3].hitboxes[1].damageMultiplier = 2.5;
    }
    

    Then I apply the properties to all existing units by placing them into custom unit values:

    // Initialize Enemies (Existing on map creation) \\
    //--------------------------------------------------------------------------------------------------//
    void cf_InitEnemies()
    {
    	unitgroup lv_tempUnitGroup;
    	unit lv_tempUnit;
    	int i = 0;
    	int j = 0;
    	
    	while(i < c_EnemyTypes)
    	{
    		lv_tempUnitGroup = UnitGroup(gv_enemyTypes[i].name, c_playerAny, RegionEntireMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0);
    		while(j <= UnitGroupCount(lv_tempUnitGroup, c_unitCountAll))
    		{
    			lv_tempUnit = UnitGroupUnit(lv_tempUnitGroup, j);
    			UnitSetCustomValue(lv_tempUnit, c_CustomValues_UnitType, i);
    			UnitSetCustomValue(lv_tempUnit, c_CustomValues_OffsetZ, gv_enemyTypes[i].hitboxes[0].offsetZ);
    			UnitSetCustomValue(lv_tempUnit, c_CustomValues_Height, gv_enemyTypes[i].hitboxes[0].height);
    			UnitSetCustomValue(lv_tempUnit, c_CustomValues_HeightMap, gv_enemyTypes[i].heightMap);
    			UnitSetCustomValue(lv_tempUnit, c_CustomValues_Radius, gv_enemyTypes[i].hitboxes[0].radius);
    			j += 1;
    		}
    		
    		j = 0;
    		i += 1;
    	}
    }
    

    I also have a trigger to add these values to newly created units:

    //--------------------------------------------------------------------------------------------------
    // Trigger: Unit Is Created
    //--------------------------------------------------------------------------------------------------
    bool gt_UnitCreated_Func (bool testConds, bool runActions) {
    	int i = 0;
    	
    	while(i < c_EnemyTypes)
    	{
    		if(UnitGetType(EventUnit()) == gv_enemyTypes[i].name)
    		{
    			UnitSetCustomValue(EventUnit(), 0, i);
    			UnitSetCustomValue(EventUnit(), 1, gv_enemyTypes[i].hitboxes[0].offsetZ);
    			UnitSetCustomValue(EventUnit(), 2, gv_enemyTypes[i].hitboxes[0].height);
    			UnitSetCustomValue(EventUnit(), 3, gv_enemyTypes[i].heightMap);
    			UnitSetCustomValue(EventUnit(), 4, gv_enemyTypes[i].hitboxes[0].radius);
    		}
    		
    		i += 1;
    	}
        return true;
    }
    
    //--------------------------------------------------------------------------------------------------
    void gt_UnitCreated_Init () {
        gt_UnitCreated = TriggerCreate("gt_UnitCreated_Func");
        TriggerAddEventUnitCreated(gt_UnitCreated, null, null, null);
    }
    

    And now finally I am able to use these values in my traceline by using the custom values of the target I'm looking at:

    // Traceline \\
    //--------------------------------------------------------------------------------------------------//
    void cf_TraceLineOld(fixed pv_Height, fixed pv_Pitch, fixed pv_Yaw, point pv_Location, int pv_player)
    {
    	fixed lv_TraceHeight;
    	fixed lv_TraceDistance = 0.0;
    	fixed lv_TraceWorldHeight;
    	fixed lv_UnitWorldHeight;
    	region lv_TraceRegion;
    	region lv_UnitRegion;
    	point lv_TracePoint;
    	unit lv_ClosestUnit;
    	int i = 0;
    
    	while(lv_TraceDistance < c_MaxRange)
    	{
    		if(pv_Pitch < 90)
    		{
    			lv_TraceHeight = Tan(pv_Pitch) * lv_TraceDistance * (-1);
    		} else if(pv_Pitch > 270) {
    			lv_TraceHeight = Tan(360 - pv_Pitch) * lv_TraceDistance;
    		}
    		
    		lv_TracePoint = PointWithOffsetPolar(pv_Location, lv_TraceDistance, pv_Yaw);
    		
    		lv_TraceWorldHeight = WorldHeight(c_heightMapGround, lv_TracePoint);
    		
    		lv_TraceRegion = RegionCircle(lv_TracePoint, 1.5);
    		lv_ClosestUnit = libNtve_gf_ClosestUnitToPoint(lv_TracePoint, UnitGroup(null, 15, lv_TraceRegion, UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0));
    		lv_UnitRegion = RegionCircle(UnitGetPosition(lv_ClosestUnit), UnitGetCustomValue(lv_ClosestUnit, c_CustomValues_Radius));
    		lv_UnitWorldHeight = WorldHeight(FixedToInt(UnitGetCustomValue(lv_ClosestUnit, c_CustomValues_HeightMap)), UnitGetPosition(lv_ClosestUnit));
    		
    		if(lv_ClosestUnit != null && 
    		   lv_ClosestUnit != gv_players[pv_player].mainUnit && 
    		   RegionContainsPoint(lv_UnitRegion, lv_TracePoint) && 
    		   pv_Height + lv_TraceHeight - lv_UnitWorldHeight >= UnitGetCustomValue (lv_ClosestUnit, c_CustomValues_OffsetZ) && 
    		   pv_Height + lv_TraceHeight - lv_UnitWorldHeight <= UnitGetCustomValue (lv_ClosestUnit, c_CustomValues_OffsetZ) + UnitGetCustomValue (lv_ClosestUnit, c_CustomValues_Height))
    		{
    			gv_players[pv_player].currentTarget = lv_ClosestUnit;
    			gv_players[pv_player].currentTargetPoint = lv_TracePoint;
    			gv_players[pv_player].currentTargetHeight = pv_Height + lv_TraceHeight;
    			gv_players[pv_player].hasTarget = true;
    			
    			return;
    		}
    		
    		if(pv_Height + lv_TraceHeight <= lv_TraceWorldHeight)
    		{
    			gv_players[pv_player].currentTargetPoint = lv_TracePoint;
    			gv_players[pv_player].currentTarget = null;
    			gv_players[pv_player].hasTarget = false;
    			return;
    		}
    		
    		lv_TraceDistance += 0.5;
    	}
    	
    	gv_players[pv_player].currentTargetPoint = null;
    	gv_players[pv_player].currentTarget = null;
    	gv_players[pv_player].hasTarget = false;
    	return;
    }
    
    Posted in: Tutorials
  • 0

    posted a message on 'optimizing' triggers

    @ezbeats: Go

    Well, running fewer times and running less calculations are both equally efficient ways of optimizing code and should both be practiced. Whether one or the other is more efficient is entirely dependent on the function(s) in question. Your code should run as lightly as possible during any amount of load, and it should also avoid overloading itself at all.

    Posted in: Miscellaneous Development
  • 0

    posted a message on Triggering A.I to use skills

    @Layola: Go

    Yeah, you're using arrays wrong. Also take out the status = unused just because it's pointless.

    Revision:

    Events
            Unit - Any Unit Becomes idle
    Local Variables
            A = 0 <Integer>
            Target Unit = No Unit <Unit[6]>
            Target Location = No Point <Point[6]>
    Actions
            General - For each integer A from 1 to 6 with increment 1, do (Actions)
                Actions
                    Variable - Set Target Unit[A] = (Random Living unit from (Units in (Entire map) having alliance Enemy with player (Owner of (Triggering unit)) matching Excluded: Air, Missile, Dead, Hidden, with at most Any Amount))
                    Variable - Set Target Location[A] = (Position of Target Unit[A])
                    General - If (Conditions) then do (Actions) else do (Actions)
                        If
                            And
                                Conditions
                                    Target Unit[A] != No Unit
                                    Computer[A] == true
                        Then
                            Unit - Order Hero[A] to (High Templar - High Templar - Psionic Storm targeting (Center of (Unit group(Target Unit[A])))) (Replace Existing Orders)
                        Else
    
    Posted in: Miscellaneous Development
  • 0

    posted a message on [Trigger] How to Target with Mouselook (Tracelines)
    Quote from sherardt: Go

    I agree but I was also thinking of using it to draw a line for a projectile to follow, I was going to factor in gravity, and I have done some research already and Gravity isn't the same due to scaling of the game. I figure If the average person is about 2 m high it means that a ghost is about .6 of the map scale. this to me means that that is approximately equivalent to 2 meters. That means gravity is closer to a -1 unit per second. As far as wind this might be good in a golf game or if you were sniping at a long distance, but for something fairly close this wont matter. I was also thinking of using this to display information about units and am having no luck with that aspect.

    By wind resistance I'm referring to the friction caused by any object attempting to move through open air. This affects objects of all sizes moving in any direction, regardless of whether there is wind or not. The scale of its effect is dictated usually by mass and surface area of the object in the direction it's traveling, but for emulation purposes you can give it an absolute value on an object-by-object basis.

    Posted in: Tutorials
  • To post a comment, please or register a new account.