• 🏆 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!

problem with changing unit control

Status
Not open for further replies.
Level 4
Joined
Jun 29, 2004
Messages
64
i want it so that when a player leaves, his units change control, but i want it so they only change control to his allies that are still playing the game, because sometimes it is changing it to his allies that have left the game already, and sometimes it doesnt change control all all..

this is my code

Unit Group - Pick every unit in (Units owned by nextpersondoom) and do (If (((Random player from (All allies of (Triggering player))) slot status) Equal to Is playing) then do (Unit - Change ownership of (Picked unit) to (Matching player) and Change color) else do (Do nothing))


tell me what is wrong please.
 
Level 22
Joined
May 11, 2004
Messages
2,863
Try this:

Event:
Map initialization
Conditions:
(player1) is playing equal to false / Player slot 1 is equal to not playing/unused
Action:
if/then/else
If (Player2) is equal to playing, then Player- make player 2 treat player 1 as an ally with full shared unit control or else Do nothing
(repeat action until all players are covered...make sure "do nothing" is inputted in the "or else" section or further actions will not spring. Repeat entire trigger until all players are covered at map start)

-VGsatomi
 
Level 8
Joined
Apr 3, 2004
Messages
507
You could make that ever so slightly slicker by doing a For loop encompassing the player numbers of all the players and putting the actions inside that, referring to Player (Integer A) and the player that's left, instead of pasting the code in several times.
 
Level 4
Joined
Jun 29, 2004
Messages
64
i dont think you understood right. this doesnt have to do with map initialization. i am trying to change unit control to an ally of a player when he leaves in the middle of the game. ....so theres 3 allys, one of them leaves, i want his units to go to split between the remaining 2 allys. see?
 
Level 4
Joined
Jun 29, 2004
Messages
64
it may be easy for you but i am a new map maker and i dont know anything about for loop a fuctions thats why i came to this forum. if someone can tell me the exact trigger or spend a minute or 2 and make a test map with the trigger on it and link me to it i will appreciate it a lot.
 
Level 13
Joined
May 5, 2004
Messages
1,330
drumminforev said:
i want it so that when a player leaves, his units change control, but i want it so they only change control to his allies that are still playing the game, because sometimes it is changing it to his allies that have left the game already, and sometimes it doesnt change control all all..

this is my code

Unit Group - Pick every unit in (Units owned by nextpersondoom) and do (If (((Random player from (All allies of (Triggering player))) slot status) Equal to Is playing) then do (Unit - Change ownership of (Picked unit) to (Matching player) and Change color) else do (Do nothing))

1. To your trigger: You used "Matching Player", but I can't see a matching-condition anywhere, and without the events/conditions I can't help there.

2. To Panto's last: It's not that difficult. There's an event called "Player - [SpecificPlayerHere] leaves the game". From here you should be able to build an action like VGsatomi said that checks whos playing and who not and give the units to the active players. Do this for every player.
 
Level 4
Joined
Jun 29, 2004
Messages
64
to the last guy that said player group. that would not work since it would throw control to enemy units since there are 4 teams of 3

to darky. i dont have any matching player conditions, i just am not that good with triggers so i thought matching player was supposed to go right there.
 
Level 7
Joined
Jul 30, 2004
Messages
451
drumminforev said:
to the last guy that said player group. that would not work since it would throw control to enemy units since there are 4 teams of 3

to darky. i dont have any matching player conditions, i just am not that good with triggers so i thought matching player was supposed to go right there.

i'd do it with player groups personally, just make one for each team... but if u want to use ur current trigger it would be fixed to something like (i don't have the editor open right now so this is coming from the top of my head)

set up a int variable, nTemp (could use player too, but i use ints all the time)

event -
player leaves the game
cond -
none
action -
pick every unit in (units owned by triggering player) and do
+ set nTemp = player number of (random player from (allies of triggering player) matching (matching player slot status equal to playing))
unit - change ownership of (picked unit) to (convert player number to player (nTemp) ) and change color

if u wanted it to give every unit to a random player instead of distrubuting hte units randomly u would put the set nTemp thing before the pick every units
 
Level 4
Joined
Jun 29, 2004
Messages
64
my map is havening major issues. the triggers only work half of the time, so i am including a link to download my map if anyone can help correct the code.

several problems i have (this is a footmen wars type map)
1) when a player leaves the game, all his units chang ownership to a random ally that is playing, that work, and he begins to spawn zombies no matter what unit he was previously spawning, and half of the time it continues spawning regular units, which isnt what it supposed to do after he left , but i dont know how to get the units to spawn in ownership of the chosen ally, because they are still concidered the left players units which makes them useless

2) when a player gets his town hall kill, it should create a visibility modifier so he can see whole map, and that works, but when he leaves , since it is sharing changing unit ownership, the visibiility chances also, but i want it to be removed for the specific player.

3)when a player is defeated it should also spawn zombies, but somtimes it spawns zombies, sometimes regular units

4) left players or defated players should have their name removed from the scored board, but it does not always remove them...why?


here is the map
http://www.angelfire.com/vamp/out/problemed_map.w3x
 
Level 7
Joined
Jul 30, 2004
Messages
451
ok well i just don't have the patience right now to go through ur stuff and correct it, but ur player choosing system is very strange, that would prob be the largest problem, and remove some waits, since inbetween waits variables can change and mess up things

if noone has solved it by tommorow i'll fix it for u, but i'm just lazy right now
 
Level 4
Joined
Jun 29, 2004
Messages
64
well i have done the best i can which is why i came to this forum to post for help. the waits are just inbetween messages to chat players mainly.

anyone who can spend a couple minutes looking it would be nice if you did.
 
Level 7
Joined
Jul 30, 2004
Messages
451
*edit* JEEZ i hate the old-method of ifs and loops, i just saw something that i couldn't see before cause it was a long statement

i would redo the triggers and send it to u, but u have a lot of ifs and loops that use the 'old method' (at doesn't create another stream of actions) which is really tedious to edit, and i'll be frank, i'm lazy
 
Level 7
Joined
Jul 30, 2004
Messages
451
Panto said:
So, maybe if he were to go through and edit the triggers to use the Multiple versions of If and For loops, we could take another look at it?

i dunno if u were being sarcastic or not, but it would definately make things a lot easier to use expandable ifs and loops -- needless to say i don't mind going through someones map and fixing stuff granted its not in a anoying to edit format

anyways, i fixed what u asked i think, i dunno i couldn't really test it since computer players don't tend to leave the game (i guess i could have defeated them now that i think about it, o well), but it should be better than before at least... theres still problems with ur defeat trigger i think, as well as some other stuff i noticed but i forgot by now. anyways i'll see where i can host it... link in a sec hopefully

i dunno if yahoo thingy works (+ its really old and i never use it), but i put it in there,

if it doesn't work i'll just find a free webhost or email it to u or something

er, chagned link to http://www.angelfire.com/wa3/myclam/prbmapfx.w3x , i hope that works
 
Level 8
Joined
Apr 3, 2004
Messages
507
No, I meant it in earnest. It's entirely reasonable to take a look at someone's trigger-work, but when it's difficult to understand or read the work, it makes the job of helping them more difficult. Thus, people who want help should try to have things constructed in a sensible and easy-to-understand format, and make comments in the triggers as necessary.
 
Status
Not open for further replies.
Top