SC2Mapster Forums

Resources > Tutorials

[Trigger] How to Target with Mouselook (Tracelines)

    #82 Sep 12, 2010 at 01:53 UTC - 0 likes
    Quote from JerreyRough: Go

    Sorry for the double post...

    I've done everything to the letter in the main post. But I am still getting a "Implicit cast not allowed" error on the "lv_closestUnit != gv_mainUnit " line. I cannot figure it out and, if I keep the line, cannot save the file. I'll remove the line for now, but I'm going to need to fix this and I don't know how. Again, I've followed everything to the letter yet I continue to get this error. I've also re-done this in a new testing-only map and it still doesn't work (because of this error, I cannot save it and show you the error). I've kept all the original names in this second map.

    That error tells me your Closest Unit and Main Unit variables are not both Unit variables.

    We are currently recruiting skilled individuals for Wired for Blood:

    • 3D Animator(s)
    • UI Artists
    #83 Sep 22, 2010 at 20:45 UTC - 0 likes

    @rrowland: Go

    Hi, Im trying to use parts of this system, but I rather want a somewhat 'top-down' perspective but still rotating with the mouse - and just shooting in the direction of the camera, but not height relative. Im kind of lost, anyone has any ideas on how to achieve this?

    #84 Oct 26, 2010 at 12:41 UTC - 0 likes

    is the reason the maps wont save is because the line

    lv_closestUnit != gv_mainUnit

    doesnt account for the fact that the mainUnit is an array for most people? therefore the line should read:

    lv_closestUnit != gv_mainUnit[lp_player]

    Please update your script to identify that by using an array the array number must also be identified

    Last edited Oct 26, 2010 by RageQit

    Give me a hey hey if u see me on HoN (cabboose)

    #85 Jan 08, 2011 at 22:40 UTC - 0 likes

    Hey guys. I am making a third person shooter and the line lv_closestUnit != gv_mainUnit doesn't work! I have tried and tried and tried. It keeps giving me errors even thought I looked over the tutural like 10 times! PLEASE HELP.

    Want to be a member of a team who makes fun maps? Join Team War! We are a small, but idea filled new clan and we'd love new members.

    http://www.sc2mapster.com/teams/team-war/

    #86 Apr 04, 2011 at 22:32 UTC - 0 likes

    I'm making a hero arena and want to use tracelines to target the other players. Similar to smashcraft. I want the unit to be where the line starts from and the point clicked to be where the line ends. So it could be more than 50 units or less. How would I deal with this?

    #87 Jul 26, 2011 at 20:00 UTC - 0 likes

    I seem to be having a problem with this;

    All of the lines that read [lp_player] give me the error that '[' cannot be used in the array.

    #88 Nov 23, 2012 at 11:36 UTC - 0 likes

    FIXED

    Last edited Nov 25, 2012 by admielke
    #89 Nov 25, 2012 at 04:43 UTC - 0 likes

    @rrowland: Go

    Quote from rrowland: Go

    In a recurring function (Every 0.0 seconds, etc). This is useful if you want to use the current target information to display info to the player about the unit they're looking at. You can see an example of this in my Reaper Madness videos. You can then use the SAME information (You don't have to run the traceline twice) to determine which unit or piece of terrain to shoot when the player hits the attack key (such as left mouse click).

    Could you go more into this? I would like to just create a dialog item that displays the health (bar and percentage) of the traceline_currentTarget.

    One other question if it is possible to do head shots? Maybe figure the height of each enemy mob and do an If Than Else* action to check to see what the traceline_currentTargetHeight is if it is between the specific "head" area. Is there any way to check to do a data reference on the "head" attachment origin of the traceline_currentTargetUnit through the Attachment Methods tab of the Data Editor.

    #90 Mar 26, 2013 at 01:20 UTC - 0 likes

    @rrowland: Go

    hi if someone can helpi that will be apreciated

    i dont understand this part

    Next we'll want to start in on our code. As explained earlier, we will be checking each point in small intervals in a loop. So, we need to set up the loop. Create a variable named "Trace Distance" (real) and set its initial value to 0.0. This variable will keep track of how far along the imaginary line we are. Now we'll set up our loop:

    while(lv_traceDistance < 50.0) { While Trace Distance is under our max range, 50, we want to run everything between the squiggly brackets: {} This is where all of our future code is going to go. lv_traceDistance += 0.5; At the end of the loop we increment our distance from the camera by 0.5 units. Since the maximum distance is 50.0, this loop will run up to 100 times. }

    i dont understand what to do wit this what is it while(lv_traceDistance < 50.0) { While Trace Distance is under our max range, 50, we want to run everything between the squiggly brackets: {} This is where all of our future code is going to go. lv_traceDistance += 0.5; At the end of the loop we increment our distance from the camera by 0.5 units. Since the maximum distance is 50.0, this loop will run up to 100 times. }

    sorry for bad english

You must login to post a comment. Don't have an account? Register to get one!