• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Solved] P2 Joins = Actions, P3 Joins = Actions.

Status
Not open for further replies.
Level 4
Joined
Dec 31, 2014
Messages
68
Hello all, a simple trigger here.
The map I am working on is Singleplayer/Multiplayer RPG and players can choose their starting class before they spawn.
I want that depending on when the 2nd or 3rd player unit spawns it does specific actions, but that if Player 3 enters before Player 2 it doesn't overwrite the actions which would happen when Player 3 enters. (Hope this makes sense)

Basically I want; more players = Raised strength of enemies (I already have this sorted out in my current triggers).

What I have is 1 trigger for when a unit owned by Player 2 enters, and another trigger for when a unit owned by Player 3 enters but the order in which players joins messes it up.

Can I ask for some guidance for the easiest way to do this? It's not desperate I have it happen when the players unit spawns but if I can, that would be preferred. (Also if it can be 1 trigger all the better)
Thanks
 

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,184
So basically you want to do something when a certain unit is created. And this something is unique to each player.

I don't see the problem.
JASS:
//not actual code
Units enters map
    if unit type is equal to footman (example)
        if owner of triggering unit is player 1
            do stuff
        if owner of triggering unit is player 2
            do something else
 
Level 4
Joined
Dec 31, 2014
Messages
68
Right, sorry that it wasn't clear, also sorry for the delay in responding.

When the map loads each player gets a dialog menu where they can select what hero they will be using for their playthrough.

I want that when a 2nd or 3rd player units enters the level, it triggers 'multiplayer modes'. One of the things that I want to change when another player enters is the handicap for enemies for example (I'll keep it simple for now).

I want that when a 2nd player enters, that handicap becomes 120%
when a 3rd player enters I want the handicap to become 150%

Now the problem;
If say 3 people decide to play the map.
Player 1 chooses their class and enters the map = Fine
If Player 3 chooses and enters the map BEFORE Player 2 the game will make that handicap 150%
If/when Player 2 chooses and enters the Handicap will become 120%

Because there are 3 players the handicap should be 150% not 120%.

I hope that's clearer now, sorry for the confusion.
 
Level 2
Joined
Sep 16, 2014
Messages
17
Simply make a integer var that acts as a counter - Any player joins,increase it by 1,strength depends on this vars value.

Example: Player 1 joins-var is now (lets call it PlayerCounter) PlayerCounter=0(base state)+1=1
Player 3 joins-PlayerCoutner=1+1=2
Player 2 joins-PlayerCounter=2+1=3
.
.
.

You can make handicap be like 100+20*PlayerCounter or something like that,making it go:100% for 1 player,120% for 2,140% for 3...
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,207
Slots have nothing to do with the problem. You count the number of players which enter and use that to determine the handicap.

Make an integer like "entered_players". When a player enters, you increment it by 1 (set it to itself + 1 using arithmetic function). You then use that number to determine the handicap after every time any player enters. The order players enter in then makes no difference at all.
 
Status
Not open for further replies.
Top