• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] My creature!

Status
Not open for further replies.
Level 9
Joined
Apr 6, 2008
Messages
436
Maybe it's not much, maybe it's just another bad spell, but I am so proud of my movement system pack! Though I still could improve it. Here it is.
Warcraft III Spells - Arrow keys movement system pack
I have three questions about it.



1- the Green movement system uses the points "source of current camera" and "target of current camera". It works fine with player 1 red, but what happens if I create a whole new green movement system for player 2 blue?
Will the editor understand whose current camera I am writing of?


2- Now I have removed all the leaks I could. I tried the red movement system with another player, and it work pretty well. The first time I tried the leaky version online the delay was too long and the movement looked cheesy and slow. Now it's much better, the delay is very very little. But it still exists. Can I do something else to make my triggers execute faster?

3- Would a JASS version be better, maybe faster?
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
1. Nope. You need to use "GetLocalPlayer()" in order to know whose camera you're manipulating.
2. There will always be delay on using arrowkeys in warcraft 3, whether you use GUI or jass. Blame blizzard for that :p
3. Ofcourse. A jass version would be faster. But not "any" jass version. I mean, if you'd make this from scratch in jass it would probably be faster, but it's not going to help at all if you just convert your GUI into jass.
 
Level 9
Joined
Apr 6, 2008
Messages
436
I can't understand the answer you gave to my first question. How can I use Getlocalplayer() to choose the player I'm referring to? Like, Getlocalplayer(Player1)? And that's a jass thing, and I'm not good at jassing. Could you tell me where to put Getlocalplayer()?
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
In a multiplayer game, if a trigger runs, it runs separately on all computers in the game. Therefor, if you use an action such as "Create a unit", all computers would "simultanously" create the unit, instead of only the host running the trigger and updating all other computers with the newly created unit.
However, the latter would require a lot of network traffic, which would probably cause lag and gamecrashes if an update wasn't received on certain computers.
GetLocalPlayer() returns a DIFFERENT player on all computers in the game. It returns the player that's playing on the machine. Like, if we're both in a game on the internet, GetLocalPlayer() would be "Eleandor" for me but "Horizontal" for you.

Thus, you could make a certain trigger run only for 1 player by doing:
  • Custom script: if GetLocalPlayer() == Player(1) then
  • Do Your Actions
  • Custom script: endif
Because GetLocalPlayer() returns a different player on each computer, the actions will only be executed if GetLocalPlayer = Player 2, which is only true on player 2's computer. The actions inside the 2 custom scripts could, in your case, get the "source of current camera" for only 1 player, because otherwise it would get different "sources" for each player which could cause conflicts.

Some important notes:
- Player(0) in jass is Player 1 in GUI, Player(1) in jass is Player 2 in GUI, etc.
- jass is still case sensitive, so "GetLocalPlayer() == player(1)" will cause a syntax error because "player" is supposed to be written with capital P
- Using GetLocalPlayer() like this will cause desynchronisations in certain circumstances. As I've said, the actions inside the scripts only run on a specific machine. For some actions there is no problem, but if you would, for instance, create a unit, the unit would be created for only 1 player. This will cause a disconnect for this player because if e.g. that unit would attack another unit, it would only happen on 1 computer, and will result in all other computers kicking you because you're now in "a different game".
 
Status
Not open for further replies.
Top