View Full Version : Scripting help
BardoK
11-16-2007, 5:29 PM
Hello everyone i'm brand new to these forums and i'm in need of some help so here are my questions...
1 - Cloaked beacons (I want only the glowing part)
I've tried the enable doodad state, create observer, wait 0, remove observer and it didn't work...? can anyone help me with that...
2 - Timers
I'm making a game where I want a countdown to show up top starting at 1 minute and counting down... after it reachs the end it will give you civilians at a location... and then restart... perserving the trigger to run constintly
3 - Scoreboard
Also in this game I want a score board that shows the kills for everybody EXCEPT player 7 and 8.. and every 10 kills gives 1 mineral for upgrading... how would I go about displaying it and adding the minerals?
Thank you for your consideration/help and if I have anymore questions i'll post them :)!
SuiCidAl-KiSmEt
11-16-2007, 7:05 PM
1. It's 'Disable' doodad state, not enable. And the observer must at least be out in the open for about around .75-2 seconds. 0, is way too fast.
2. The code is this.
Trigger 1:
C: Elapsed time is at least 1 game seconds. *
A:Set 'switch 1'
Trigger 2:
C: 'Switch 1' is set.
C: Count down Timer is at most 0 game seconds.
A: Count down Timer: Add 60 game seconds.
A: Create 1 Terran Civilian at 'Civ' for Player 1.
* Can vary to any other condition.
The switch trigger is necessary to run the correct count down timer.
You cannot exempt certain human players from having a scoreboard from being shown. It's either you have a scoreboard displaying all (active) human players or for none. Although, you can disable a scoreboard from being shown for computer players and computer players only. There is a specific trigger for this, if you look for it.
Usually questions like these here wouldn't been answered descriptively, but these two are commonly bleak for newbies.
BardoK
11-16-2007, 7:26 PM
Well player 7 and 8 are neutral/computer people... could you please explain how to set up the scoreboard/mineral thing tho? I don't know how :|
SuiCidAl-KiSmEt
11-16-2007, 7:46 PM
Try looking at this. (http://www.warboards.org/showpost.php?p=540994&postcount=1)
Just obviously replace the trigger with adding a mineral besides gas. And your good.
btw, other people here as gave out these information before, since that past 6 years, a lot of things have already been answered here. There is a Search feature in the forums, that could be helpful in finding things, whenever you feel desperate enough to use it...
And I forgot,
Welcome to Warboards.
BardoK
11-16-2007, 9:11 PM
The commands you gave for the timer
2. The code is this.
Trigger 1:
C: Elapsed time is at least 1 game seconds. *
A:Set 'switch 1'
Trigger 2:
C: 'Switch 1' is set.
C: Count down Timer is at most 0 game seconds.
A: Count down Timer: Add 60 game seconds.
A: Create 1 Terran Civilian at 'Civ' for Player 1.
Right when the map begins it creates 1 civilian :|? and even if there is no second player it adds civilians anyways??? I want it to only add the civilians if theres an actual human present...
This is what i'm trying to do...
I don't mind that at the beginning of the game it spawns 3 civilians... but if i'm the only one playing... why does it spawn 3 civilians for blue, green, orange, etc etc when it shouldn't since they aren't there??? how would i go about editing the trigger so it only gives me the civilians but STILL works online for other players... I tryed making it a seperate trigger for everyone but that doesn't work because then my timer works and no one elses :| don't understand help me please?
SuiCidAl-KiSmEt
11-16-2007, 9:44 PM
I don't mind that at the beginning of the game it spawns 3 civilians... but if i'm the only one playing... why does it spawn 3 civilians for blue, green, orange, etc etc when it shouldn't since they aren't there??? how would i go about editing the trigger so it only gives me the civilians but STILL works online for other players... I tryed making it a seperate trigger for everyone but that doesn't work because then my timer works and no one elses :| don't understand help me please?Auh. A common mistake and misunderstanding of triggers. I can tell right off the back what you did. You see, you put the triggers under for "All Players" did you? Triggers that involve spawning new units and possibly other few other triggers, under that force, "All Players" or "Force 'x'", the game will count all of the players with a starting location and count it into the trigger. This is the only negative effect that fits from your description, if not, tell me if you did something else.
For my sake, I'll just assume you put the trigger under "All Players". If you did put it under a team force, just realize it's the almost the same if you put it under "All Players".
Example, say if you set up three players on the map, it will multiply integers in some triggers to how many players are in "All Players". Ex, 3 players + spawn 1 civilian = (3x1) = 3 Civilians.
To do this correctly, all you need to do is move the trigger to force "Player 1". This way, it will become Player 1 + spawn 1 civilian = (1x1) = 1 Civilian. You can put it to the appropriate player too if it's not player 1. If you put it under Player 2 for another example, it still counts as a single player, so it will also be = to 1.
Why is like that? It add more dynamics for making maps if your specific. If you use your imagination, you can make some nice balanced "defense maps" under that "All Players" settings. Although, sometimes it's better to put some triggers under "All Players", just don't worry to put any triggers under that force as long as you know what to expect when do.
Right when the map begins it creates 1 civilian :|? and even if there is no second player it adds civilians anyways??? I want it to only add the civilians if theres an actual human present...
That should stop when you place the trigger under "Player 1" instead of "All Players" as stated above. And change the condition I stated with an asterisks (*) at the end, change to anything else like when a player commands a buildings or something.
Anything else?
BardoK
11-16-2007, 10:18 PM
So the command should be like this
Player 1
Trigger 1:
C: Elapsed time is at least 1 game seconds. *
A:Set 'switch 1'
Trigger 2:
C: 'Switch 1' is set.
C: Count down Timer is at most 0 game seconds.
A: Count down Timer: Add 60 game seconds.
A: Create 1 Terran Civilian at 'Civ' for Player 1.
Player 2
Trigger 1:
C: Elapsed time is at least 1 game seconds. *
A:Set 'switch 1'
Trigger 2:
C: 'Switch 1' is set.
C: Count down Timer is at most 0 game seconds.
A: Count down Timer: Add 60 game seconds.
A: Create 1 Terran Civilian at 'Civ2' for Player 2.
Player 3
Trigger 1:
C: Elapsed time is at least 1 game seconds. *
A:Set 'switch 1'
Trigger 2:
C: 'Switch 1' is set.
C: Count down Timer is at most 0 game seconds.
A: Count down Timer: Add 60 game seconds.
A: Create 1 Terran Civilian at 'Civ3' for Player 3.
All in a row right so they should all work just fine on-line?
And about the scoreboard... all I wanted to know is exactly how to get one set-up :)... and once your kills reached 10... it would give you 1 mineral... any simple way of setting this up for 6 players?
I thank you for your time and patience... and i tryed searching some of this but i'm terrible at that :( hence why i signed up here to get help
SuiCidAl-KiSmEt
11-16-2007, 10:31 PM
Great, you got the concept. But actually, to save some space, you can put Trigger 1 under All Players, you don't need the extra Trigger 1s. The switch functions are global, so it doesn't matter where it's at. Other then that you look like your doing fine.
Na, there isn't any other simpler way besides copying triggers to each other player if you want it to equal right. I'm not really an expert in trigger counting (for the kill board...counter), I'm gonna have to test that out. Or hopefully some other member that knows would come and say something...
SuiCidAl-KiSmEt
11-17-2007, 12:03 AM
Here is a method similar to what your doing. Look at the triggers. This is a recent post somewhere by SilverCrusader. Obviously, just switch the 1 with 10 for the kills and 5 for the minerals.
/read (http://www.warboards.org/showpost.php?p=547661&postcount=12)
BardoK
11-17-2007, 1:35 AM
The issue with that kill counter is if you kill 2 or 3 units at one time it doesn't register that for the minerals...
Sorry that i'm doing this but i'll put what I exactly need here...
I need to know how to code a trigger like this
Show the scoreboard like this
Player 1 Kills:
Player 2
Player 3
Player 4
Player 5
Player 6
(Player 7/8 Not included some how)
During the count when it hits 10 kills, 20 kills, 30 kills, 40 kills, you get 1 mineral for upgrading... even if you killed multiple units at one time... so for instance if you are at 8 points and you kill 3 units (completely skipping 10) you STILL get the 1 mineral for being over 10 but the minerals don't keep spawning... it must be stable... like the ones in the individual random beacon/defense
And also
How do you make the hive/science facility/ all the needed upgrade buildings... in 1 spot... so that the hive doesn't have any hatchery area on it... and they are all in space.... but still allow you to upgrade up to 255
SuiCidAl-KiSmEt
11-17-2007, 12:53 PM
If you still haven't figured it out, the triggers to remove computer player from the computer board (which is players 7 & 8 right?) is this trigger;
C:
•Leader Board Computer Players
Disable use of computer players in leaderboard calculations.
To show a leaderboard, is should be this trigger;
C:
•Leader Board Kills
Leaderboard kills for most kills of 'unit'.
Display label 'kills'.
For the time problems, that's something I really can't help. The game doesn't execute triggers fast enough. It's not really good for quick amounts of killings.
For the one spot thing, you need SCMDraf II (http://www.stormcoast-fortress.net/downloads/scmdraft2ZIP/?PHPSESSID=43d672a546105094ee0b6763e3cbb81d). It allows you to overlap or stack buildings and units on top of eachother.
BardoK
11-17-2007, 1:13 PM
I can stack them just fine... it's just when i put the hive down... the hatchery area comes with it... i'm trying to do my triggers like ind random beacon/random bunker... where they have the upgrade stuff without any other messy area add ons... and his score board works just fine which is what i'm trying to do
SuiCidAl-KiSmEt
11-17-2007, 1:27 PM
The 'creep' that comes out of the hatchery... to get rid of that, you just put unbuildable terrain under it. E.g. make a large enough terrain of rocky ground (Badlands & Jungle), Ruins, water, Magma, Shell, Broken Rock (Ashworld) or etc... under it.
BardoK
11-18-2007, 4:27 PM
Ok after I set up the timer function to give the civilians you said to do them SEPERATE instead of ALL PLAYERS... I did... but for some reason... ONLY player 1 is actually working... and all the scripts are the same except they are Player 1, Player 2, Player 3 etc etc.... just how I typed it earlier... and it's not working for anybody but player 1 :|
The triggers look like this
Player 1
C: Switch 1 is SET
C: Game time is at most 0 seconds
A: Give Player 1 3 civs at Location
A: Add 30 seconds to counter
Player 2
C: Switch 1 is SET
C: Game time is at most 0 seconds
A: Give player 2 3 civs at location 2
A: Add 30 seconds to counter
so on and so fourth with every player....
ALL PLAYERS
C: Game time is at most 1 second
A: Set Switch 1
PLAYER 1 GETS CIVILIANS SPAWNED EVERY 30 SECONDS AFTER.... but PLAYER 2,3,4,5,6 DON'T even get the trigger??? It doesn't work for them yet it's coded right???
firedraco
11-18-2007, 9:57 PM
Well, that would be because when you are playing through the game, the timer gets to zero, and then it runs Player 1 like normal, and then adds 30 at the end. It then goes to P2 etc, and it DOESN'T meet the conditions.
Make it like this:
All Players:
C: Switch 1 is SET
C: Countdown timer is at most 0 seconds
A: Create 3 civilians for Current Player at location 2
A: Modify Countdown timer add 30 seconds
I believe that should work.
BardoK
11-19-2007, 8:27 AM
the problem with that is... I need the civilians... in different locations... how would I go about doing that?...
A: Create 3 civs for Player 1 at location 1
A: Create 3 civs for Player 2 at location 2
so on and so fourth... but... when you do that... it spawns civilians there EVEN when there isn't a player 2 or player 3 playing...
Basan
11-19-2007, 10:06 AM
Well, that would be because when you are playing through the game, the timer gets to zero, and then it runs Player 1 like normal, and then adds 30 at the end. It then goes to P2 etc, and it DOESN'T meet the conditions.
Make it like this:
All Players:
C: Switch 1 is SET
C: Countdown timer is at most 0 seconds
A: Create 3 civilians for Current Player at location 2
A: Modify Countdown timer add 30 seconds
I believe that should work.
the problem with that is... I need the civilians... in different locations... how would I go about doing that?...
A: Create 3 civs for Player 1 at location 1
A: Create 3 civs for Player 2 at location 2
so on and so fourth... but... when you do that... it spawns civilians there EVEN when there isn't a player 2 or player 3 playing...
The problem is that the trigger is set to all players and therefore it'll activate for all the players in it. It'd be the same as actually having a trigger for each one of the players in which they're the owners of the trigger, but activated by any player that meets the conditions. ;) Just edit the trigger to one of players you want to be able to activate it and then copy and edit it just to change it's owner (and respective spawning locations). Even though I haven't read the whole thread, this most likely will solve your latest presented hassle, Bardok.
And btw, welcome on board. :)
BardoK
11-19-2007, 11:50 AM
I have tried that... and it still didn't work... all i'm wanting is... a timer... at the beginning of the game it gives every ACTIVE player 3 cvilians in different locations... and then begin's a 30 second count down timer for EVERY active player to see... and when it gets to 0 it gives them 3 civs.... can someone please code it?
SuiCidAl-KiSmEt
11-19-2007, 1:26 PM
K. I tested this and I got it to work. I'll post this quickly and with great rush... the triggers are... the following... with no hesitation... is... stated below:
...
...
:P
Player 1
Conditions:
- Countdown timer is set at most 0 game seconds.
- Switch 1 is set.
Actions:
- Create 1 Terran Civilian at 'P1-Civs' for 'Player 1'.
- Preserve Trigger
[Note: still set under Player 1]:
Conditions:
- Countdown timer is set at most 0 game seconds.
- Switch 1 is set.
Actions:
- Create 1 Terran Civilian at 'P2-Civs' for 'Player 2'.
- Preserve Trigger
ETC...
For the last trigger under for Player 1.
Conditions:
- Countdown timer is set at most 0 game seconds.
- Switch 1 is set.
Actions:
- Preserve Trigger
- Modify Countdown Timer: Add 10 seconds.
All Players
Conditions:
- Elapsed scenario time is at least 5 game seconds.
Actions:
- Set switch 1
- Modify Countdown Timer: Set 10 seconds.
P.S. Single Player mode and Multiplayer mode has their own ways to run triggers in maps. E.g., in Multiplayer mode, such as in Battle.net or UDP, maps will execute triggers faster, differently and more efficiently compared in playing in Single player mode. I don't know why, but they just do. So when you test maps in Single Player mode and Multiplayer mode, they sometimes get different results. - Just to let you aware of that. The most noticeable is when your testing countdown timers and wait commands.
Remember to change the seconds to 60 instead of 10. And feel free to change the conditions appropriately. And yeah, gl.
BardoK
11-19-2007, 2:48 PM
This script works just fine... the only issue is... I don't want it to create civilians for players who aren't active.... this is an multiplayer map... and if player 3 isn't there... i don't want civilians in player 3's area :|... thats what i've been trying to figure out all along... please someone figure it out =|
SuiCidAl-KiSmEt
11-19-2007, 3:45 PM
Then just add another condition. Use something that would make it obvious for the game to tell if a player is there or not. What you already said in your map is that people have buildings to upgrade right? So, in this trigger:
Conditions:
- Countdown timer is set at most 0 game seconds.
- Switch 1 is set.
Actions:
- Create 1 Terran Civilian at 'P2-Civs' for 'Player 2'.
- Preserve Trigger
Turn it into this:
Conditions:
- Countdown timer is set at most 0 game seconds.
- Switch 1 is set.
- Player 2 commands at least 1 buildings.
Actions:
- Create 1 Terran Civilian at 'P2-Civs' for 'Player 2'.
- Preserve Trigger
If a player isn't there, there would be no buildings under his control, thus, there you go. No player = No buildings = No civilians.
Valcien
11-22-2007, 1:57 AM
Did it work? Im curious.
Also, if you wanted to have everybodies' units appear at their own location, I have made a similar trigger.
Create everybodies' units at the same location, then teleport each players' civ to that players' own location;
Cond: Player 1 commands at least 1 Terran Civilian
Action: Move all Terran Civilian for Player 1 at "Common Location" to "Player 1 Civilian"
Then since every player is getting the same unit at the same moment it could be under all players, and you could use "Current Player" instead of Player 1 PLayer 2 etc.
Cond: Switch 1 is SET
Game timer is at most 0 seconds
Current Player commands at least 1 Buildings
Action: Create 1 Terran Civilian at "Common Location" for Current Player
Modify Countdown timer: Add 30 Seconds
vBulletin® v3.7.2, Copyright ©2000-2008, Jelsoft Enterprises Ltd.