| 12-31-2005, 05:23 PM | #1 |
Hi. I don't really have a clue how to make this trigger run for a local player. I'm not a JASS person. Could someone help me with this? Credit is given of course. BTW I'm sorry about the mess but then again I'm not a JASS person ![]() I've left the GUI trigger just in case and and the JASS trigger has been modified to the best of my abilities to clean it up. ![]() JASS Code:
function Trig_Create_Copy_2_Actions takes nothing returns nothing
if GetLocalPlayer() == Player(0) then
// Starting point (The button left corner of the map)
set udg_Trackable_Point[0] = Location(GetRectMinX(GetEntireMapRect()), GetRectMinY(GetEntireMapRect()))
// The space between each trackable
set udg_Temp_Real3[0] = 100.00
// Loop 1 variables
set udg_Integer_Loop[1] = 1
set udg_Integer_Loop[2] = 40
// Loop 2 variables
set udg_Integer_Loop[3] = 1
set udg_Integer_Loop[4] = 40
// Loop 1
loop
exitwhen udg_Integer_Loop[1] > udg_Integer_Loop[2]
// Loop 2
loop
exitwhen udg_Integer_Loop[3] > udg_Integer_Loop[4]
// Used for indexing later on
set udg_Integer = ( udg_Integer + 1 )
// Stores the location (Point) of the trackable
set udg_Trackable_Point[udg_Integer] = OffsetLocation(udg_Trackable_Point[0], ( udg_Temp_Real3[0] * I2R(udg_Integer_Loop[2]) ), ( udg_Temp_Real3[0] * I2R(udg_Integer_Loop[4]) ))
// Places the trackable (100xy apart)
set udg_Trackable[udg_Integer] = CreateTrackable("units\\nightelf\\Wisp\\Wisp.mdl", GetLocationX(udg_Trackable_Point[udg_Integer]), GetLocationY(udg_Trackable_Point[udg_Integer]), 0)
// Closing of loops
set udg_Integer_Loop[3] = udg_Integer_Loop[4] + 1
endloop
set udg_Integer_Loop[1] = udg_Integer_Loop[2] + 1
endloop
// This trigger adds trackable events to another trigger
set udg_Integer_Loop[1] = 1
set udg_Integer_Loop[2] = udg_Integer
loop
exitwhen udg_Integer_Loop[1] > udg_Integer_Loop[2]
call TriggerRegisterTrackableHitEvent( gg_trg_Events, udg_Trackable[udg_Integer_Loop[2]] )
set udg_Integer_Loop[1] = udg_Integer_Loop[2] + 1
endloop
endif
endfunction
//===========================================================================
function InitTrig_Create_Copy_2 takes nothing returns nothing
set gg_trg_Create_Copy_2 = CreateTrigger( )
call TriggerAddAction( gg_trg_Create_Copy_2, function Trig_Create_Copy_2_Actions )
endfunctionGUI (for reference) Code:
Create
Events
Conditions
Actions
Custom script: if GetLocalPlayer() == Player(0) then
-------- Starting point (The button left corner of the map) --------
Set Trackable_Point[0] = (Point((Min X of (Entire map)), (Min Y of (Entire map))))
-------- The space between each trackable --------
Set Temp_Real3[0] = 100.00
-------- Places trackables on the map at a distance of 100xy apart --------
For each (Integer A) from 1 to 40, do (Actions)
Loop - Actions
For each (Integer B) from 1 to 40, do (Actions)
Loop - Actions
Set Integer = (Integer + 1)
Set Trackable_Point[Integer] = (Trackable_Point[0] offset by ((Temp_Real3[0] x (Real((Integer A)))), (Temp_Real3[0] x (Real((Integer B))))))
Set Trackable[Integer] = (Create trackable object using path units\nightelf\Wisp\Wisp.mdl at Location ((X of Trackable_Point[Integer]),(Y of Trackable_Point[Integer])) facing 0.00)
For each (Integer A) from 1 to Integer, do (Actions)
Loop - Actions
Trigger - Add to Events <gen> the event (Trackable Object - Trackable[(Integer A)] is clicked)
Custom script: endif |
| 12-31-2005, 05:35 PM | #2 |
You can't create anything for just the local player, causes desyncs. And trackables don't work at all in multiplayer anyways |
| 12-31-2005, 05:44 PM | #3 |
Trackables do work in multiplayer. A guy tested it and it does, check Kattana's tutorial at the Jass Vault, it has been updated to include this. The problem is just that stuff like GetTriggerPlayer() doesn't work with the trackables. |
| 12-31-2005, 05:58 PM | #4 |
Well I thought that was the meaning of do not work in multiuplayer? I at least remember that Kattana knew that they worked in multiplayer but impractical because you don't know which player clicked them |
| 12-31-2005, 06:08 PM | #5 |
you can ofcourse make 1 entirely the same map 8 times in 1 map and use trackable arrays and stuff, but ye.. rather impractical. |
| 12-31-2005, 06:29 PM | #6 |
Of course it is impractical, but it works. |
| 12-31-2005, 06:47 PM | #7 |
I'm going for impractical. I'm going to do this for 12 players. |
| 12-31-2005, 07:03 PM | #8 |
also, trying to save the map with the trigger like that will probably cause worldedit to crash. you need to close the if statements. see http://wc3wiki.game-advance.net/wiki/Beginning_JASS for more info |
| 01-01-2006, 05:40 AM | #9 | |
Quote:
I thought I did. Near the end of the function I have a endif to close it. |
| 01-02-2006, 07:17 PM | #10 |
Impractical? When you can make functions that do everything automatically, you can place a working multiplayer trackable with the call of a single function. How much system resources it takes, that's another thing. I'm toying in my mind with a game concept that would use trackables for the interface, but until I make a test to see how thousands of them (if I remember correctly, there's no function to destroy them) affect game performance, I can't know if I can make it this way or should I just use keyboard movement. |
| 01-02-2006, 10:25 PM | #11 |
I don't have any proof but I've tried using moving models (wisp) and still models (checkered box) and it seemed to work better with none moving models. |
