• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Retrieve Cursor Position

Status
Not open for further replies.
Level 4
Joined
Jul 15, 2009
Messages
29
I'm working on an rts/fps where you play against eachother normally but at any time you can jump in the game and be one of your units in first person mode. However, I think the best way to do the first person mode would be to use the mouse for looking around and shooting while arrow keys move your unit.

Is there any function in NORMAL WC3 JASS that will allow me to get the mouse position? also, a detecting a click function would be great, too. Could someone write me something up?

Thanks, satient.
 
Basically, unless it is a small map, it will be very hard to create a decent FPS system without the help of RtC natives.

But if you do want to detect it, you'd have to resort to the unfinished trackable API.
JASS:
constant native GetTriggeringTrackable takes nothing returns trackable

    constant gameevent EVENT_GAME_TRACKABLE_HIT                 = ConvertGameEvent(7)
    constant gameevent EVENT_GAME_TRACKABLE_TRACK               = ConvertGameEvent(8)
        
native CreateTrackable      takes string trackableModelPath, real x, real y, real facing returns trackable
native TriggerRegisterTrackableHitEvent takes trigger whichTrigger, trackable t returns event
native TriggerRegisterTrackableTrackEvent takes trigger whichTrigger, trackable t returns event

Trackable Hit is when a click occurs and trackable track is hovering over a position. Trackables are not destroyable, thus, for about every ~10,000 or so it can chunk off about 10 or so fps based on your system. [and that was tested in an empty map =P ]

However, if you are determined enough you can make it work. I'll make a brief explanation.

Trackables are developed via models. Hence takes string trackableModelPath.

When you input a model's path, they will be able to track when you select that model. Say you make a peasant. Each time you click a part of the trackable peasant's body, it will register the trackable "Hit" event. When you hover over the trackable peasant's body, it will register the trackable "Track" event. Now, sometimes we don't want a trackable model though, since we want it to be invisible. Well, blizzard included nifty invisible platforms.

JASS:
 "Doodads\\Terrain\\InvisiblePlatformSmall\\InvisiblePlatformSmall.mdl"
 "Doodads\\Terrain\\InvisiblePlatform\\InvisiblePlatform.mdl"

The small one is a small platform, and the second one is a normal sized platform. That is what you have to work with.

I suggest taking a look at this tutorial:
Trackables (Mouse Detection)

And taking a look at these systems:
[System] TrackMapSystem
[Snippet] Trackable2

TrackMap's are for the general layout and method for creating trackables over an area and trackable2 shows a useful method for z and creating for players.

Generally, for an FPS system you would probably need to create grid-like trackables over the map and then have several layers for the camera's up and down movement. Overall, that's why I suggest using RtC. (Although, I don't know how multiplayer friendly that is) Else your map will lag.

Also note that creating about 1000 or so trackables with Z using the destructible technique will most likely crash a user or at least make a very long lag spike. =)
 
Status
Not open for further replies.
Top