HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Need trigger help for my map

01-06-2009, 10:27 PM#1
JIonaTaTa
Need some help... How to make that every hero has random ability? I put trigger edited to look similar to this:

World-Editor Tutorials Site

but doesn't work :confused: There has not an icon in the hero for the ability >> not assigned ablility to the hero. That's my problem to be precise.

Also I read about leaks but I dont know how to check for this... Need help for that too :smile:

The trigger "Hero spawn and notifications":

Trigger:
Hero spawn and notifications
Collapse Events
Time - Elapsed game time is 2.00 seconds
Conditions
Collapse Actions
Game - Display to Player Group - Player 1 (Red) for 15.00 seconds the text: To kick someone typ...
Collapse Player Group - Pick every player in (All players) and do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
((Picked player) slot status) Equal to Is playing
Collapse Then - Actions
Set random_spell = (Random integer number between 1 and random_count)
Unit - Create 1 Pakamuru for (Picked player) at ((Picked player) start location) facing (Center of (Playable map area))
Unit Group - Pick every unit in (Units owned by (Picked player)) and do (Unit - Add spells[random_data[random_spell]] to (Picked unit))
Camera - Pan camera for (Picked player) to ((Picked player) start location) over 1.00 seconds
Set random_data[random_spell] = random_count
Set random_count = (random_count - 1)
Game - Display to (All enemies of Player 1 (Red)) for 10.00 seconds the text: Type -help to see a...
Collapse Else - Actions
Do nothing

Custom abilities for now are 4, soon they will be 12 (one for each player).
Attached Files
File type: w3xtest v0.01.w3x (23.0 KB)
01-07-2009, 12:03 AM#2
Zerzax
So far as I can tell, you haven't assigned the array members that store each ability via an index. So assign the value to random_data[random_spell] before trying to add it to a unit.

Don't use Do Nothing, it's an empty function. I hate Blizzard for making that function...
01-07-2009, 12:24 AM#3
Pyrogasm
What you should be doing is this:

Trigger:
Hero spawn and notifications
Collapse Events
Time - Elapsed game time is 2.00 seconds
Conditions
Collapse Actions
Game - Display to Player Group - Player 1 (Red) for 15.00 seconds the text: To kick someone typ...
Collapse For each (Integer A) from 1 to 12 do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Player((Integer A)) slot status) Equal to Is playing
Collapse Then - Actions
Set random_spell = (Random integer number between 1 and random_count)
Unit - Create 1 Pakamuru for Player((Integer A)) at Player((Integer A)) start location) facing (Center of (Playable map area))
Unit - Add spells[random_spell] to (Last created unit))
Camera - Pan camera for Player((Integer A)) to (Player((Integer A)) start location) over 1.00 seconds
Set spells[random_spell] = spells[random_count]
Set random_count = (random_count - 1)
Game - Display to (All enemies of Player 1 (Red)) for 10.00 seconds the text: Type -help to see a...
Else - Actions
What that does is store all the spells (I assume) in the array spells[]. Then, random_spell is set to an integer that will tell us which index of the spells[] array we'll be referring to. The spell is added to the unit and all that jazz, and then the picked spell is replaced by the last one on the list and the counter variable is reduced by 1 so that the same spell isn't picked twice.

The do nothing action is useless, by-the-way.
01-07-2009, 05:23 AM#4
JIonaTaTa
Well I stored all abilities in array like in the tutorial - in Map Init trigger and I think this is syntax error :)

Set spells[1]=Slimy Pillow
Set spells[1]=Double Vision
Set spells[1]=Pillow Stomp
Set spells[1]=Sleep Walk

After corrected numbers I found that it works but w/o randomness - every time the ability that was added to Player 1's hero is number 4, Sleep Walk

These are variables... I dont know if they have correct sizes or initial values:


btw this
Quote:
Unit - Add spells[random_spell] to (Last created unit)
will add ability only to the hero of last playing player or I'm wrong? Well If u have more desire can u check all triggers for errors... or I want too much :D

anyway u are faster in advices and help compared to hiveworkshop.com forums
01-07-2009, 05:57 AM#5
Pyrogasm
Go to WE preferences and uncheck the box that says "use fixed random seed". That'll fix the randomness errors.
Quote:
Originally Posted by JIonaTaTa
will add ability only to the hero of last playing player or I'm wrong? Well If u have more desire can u check all triggers for errors... or I want too much :D
No, see I changed the loop. Before it was a Pick All Players loop, now it's an Integer A loop. The way I rewrote it needs to be an integer A loop instead.
01-07-2009, 06:24 AM#6
JIonaTaTa
Thanks, randomness is fixed. Is that option only for test map or works in real multiplayer situation?

And which version is better (lag free, faster loading, etc) - from tut or your? I'm on the way to create map which has the smallest possible size and so on
01-07-2009, 06:43 AM#7
Pyrogasm
Neither one is laggy, but mine's better because it works :P

That option is only for testing maps; even if the box is checked, the map will still have normal randomness when played in single player or multi-player.
01-07-2009, 07:06 AM#8
JIonaTaTa
:P yeah

Well what we must do to have "real" randomness? Only your trigger is enough or we must do complex (call it crazy) dance around the campfire to work
01-07-2009, 12:24 PM#9
Zerzax
You mean actual randomization, right? Not randomization of the type "real", aka float. That function should do it properly...
01-07-2009, 01:31 PM#10
JIonaTaTa
Yes, of course... Thanks for additional info...

Btw I used before week ago a trigger for camera-lock that I found here but then every time player used scroll or rotation buttons camera resets and only lock on unit function aka chasecam worked.

Here's the trigger:
Trigger:
Camera
Collapse Events
Time - Elapsed game time is 2.20 seconds
Conditions
Collapse Actions
Collapse For each (Integer A) from 1 to 12, do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
((Player((Integer A))) slot status) Equal to Is playing
(Distance to target of (Current camera)) Not equal to 3000.00
Collapse Then - Actions
Camera - Set (Player((Integer A)))'s camera Distance to target to 3000.00 over 0.20 seconds
Camera - Set (Player((Integer A)))'s camera Angle of attack to Default camera angle of attack over 0.20 seconds
Camera - Set (Player((Integer A)))'s camera Rotation to Default camera rotation over 0.20 seconds
Else - Actions



I'm wondering now what are the default values. Google didn't help me enough for that case.

Edit: I'm adding new question - what means desync and sync camera?
01-07-2009, 11:10 PM#11
Anitarf
To get the default values, place a camera in the editor, then press C to go to ingame camera view, then rigtclick on oyur camera object in the list and set it to current camera view. Then edit it and you can copy out the default values.
01-08-2009, 01:29 PM#12
JIonaTaTa
Can u explain again which buttons in the editor must be pressed for that

I have only Start Locations and one doodad - Inn
Camera objects (heroes) are dynamicaly placed based on player slot statuses
btw I'm attaching newer version of map... well triggers in map
Attached Files
File type: w3xtest v0.01.w3x (25.6 KB)