HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Strange Player Problem

06-22-2004, 04:42 AM#1
GosuSheep
i have a racing game where u can fire a bomb at another person that is racing... it worked before, but my friend wanted me to make it 8 players instead of just 4 players.. i redid the trigger but it keeps attacking one of the items (which is player 12)

Events
Player - Player 1 (Red) Presses the Down Arrow key
Player - Player 2 (Blue) Presses the Down Arrow key
Player - Player 3 (Teal) Presses the Down Arrow key
Player - Player 4 (Purple) Presses the Down Arrow key
Player - Player 5 (Yellow) Presses the Down Arrow key
Player - Player 6 (Orange) Presses the Down Arrow key
Player - Player 7 (Green) Presses the Down Arrow key
Player - Player 8 (Pink) Presses the Down Arrow key
Conditions
HasItem[(Player number of (Triggering player))] Equal to True
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Items[(Player number of (Triggering player))] Equal to Sheep Bomb
ItemUsed[(Player number of (Triggering player))] Equal to False
Then - Actions
Set HasItem[(Player number of (Triggering player))] = False
Trigger - Run ItemLead <gen> (ignoring conditions)
Set ItemUsed[(Player number of (Triggering player))] = True
Unit - Create 1 Sheep Bomb for Player 11 (Dark Green) at (Position of Unit[(Player number of (Triggering player))]) facing Default building facing degrees
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Triggering player) Equal to Player 1 (Red)
Then - Actions
Set BombvarRed[(Player number of (Triggering player))] = (BombvarRed[(Player number of (Triggering player))] + 1)
Set BombHit[((10 x (Player number of (Triggering player))) + BombvarRed[(Player number of (Triggering player))])] = (Last created unit)
Else - Actions
Do nothing
For each (Integer A) from 1 to BombvarRed[(Player number of (Triggering player))], do (Actions)
Loop - Actions
Unit - Make BombHit[((10 x (Player number of (Triggering player))) + (Integer A))] Invulnerable
Player Group - Pick every player in (All players matching (((Triggering player) Not equal to (Picked player)) and ((Player number of (Picked player)) Less than 9))) and do (Unit Group - Pick every unit in (Random 1 units from (Units owned by (Picked player))) and do (Unit - Order BombHit[((10 x (Player number of (Triggering player))) + (Integer A))] to Attack Once (Picked unit)))
Game - Display to (All players) the text: (String((Unit-type of (Picked unit))))
Else - Actions
Do nothing
Set ItemUsed[(Player number of (Triggering player))] = False



the red is the problem area.... i dont know why it attacks a player 12 unit instead of a player 1-8 unit... so weird = \

replies are greatly appreciated
06-22-2004, 08:53 AM#2
BBDino
I havent looked very hard at your trigger but i asuem you resized any arrays to take into regard the new players?
06-22-2004, 02:44 PM#3
th15
The array size field doesn't actually limit anything. It just prevents too much memory from being used (I believe that it is the size the array will be initialized at but can be expanded at any time).

Player Group - Pick every player in (All players matching (((Triggering player) Not equal to (Picked player)) and ((Player number of (Picked player)) Less than 9)))

You have a big problem here. References in conditions should always use "Matching unit" unless you wish to refer something OUTSIDE of those conditions. What the action above is trying to do is compare the number of a "Picked Player" when you have not actually picked any player.

In this case you would need to rewrite this action to the following:

Player Group - Pick every player in (All players matching (((Triggering player) Not equal to (matching player)) and ((Player number of (matching player)) Less than 9)))

This is just a problem, I can't tell if its what causes the trigger to fail (God i hate 2-dimensional arrays). All I can tell you that this is one of your definite mistakes.
06-22-2004, 03:47 PM#4
Vexorian
Array size only determines what indexes are going to be initialized at map initialization
06-22-2004, 04:26 PM#5
GosuSheep
Thank you... it was the matching player thing