Staredit Network > Forums > SC1 UMS Mapmaking Assistance > Topic: How to detect when a player is attacking?
How to detect when a player is attacking?
May 1 2010, 8:06 pm
By: Jesusfreak  

May 1 2010, 8:06 pm Jesusfreak Post #1



I need a way to detect when a player is betraying a comp ally so that the comp can respond. However, I would prefer that the attack be detected BEFORE the unit the player is attacking dies, so that nothing vital dies without the comp trying to retaliate. I would also like it to be so that the comp would only unally the player if it had certain units within vision range of the player, but this isn't entirely necessary.

The buildings in question have to be vulnerable, so that enemy players can destroy them.

Any ideas?



None.

May 1 2010, 8:24 pm Aristocrat Post #2



Quote from Jesusfreak
I need a way to detect when a player is betraying a comp ally so that the comp can respond. However, I would prefer that the attack be detected BEFORE the unit the player is attacking dies, so that nothing vital dies without the comp trying to retaliate. I would also like it to be so that the comp would only unally the player if it had certain units within vision range of the player, but this isn't entirely necessary.

The buildings in question have to be vulnerable, so that enemy players can destroy them.

Any ideas?

If it was a player, you can use "Command" and set to "Non Allied Victory Players" and give each player a unique unit. However, since diplomacy does not actually touch computer players, this is nearly impossible to do.



None.

May 1 2010, 8:51 pm Apos Post #3

I order you to forgive yourself!

If all you want to do is make the computer attack back when an allied human player is attacking him, you can just make a trigger that will force the computer to ally back each X seconds.

When a computer is attacked by a human player, he will attack back on it's own (Without any trigger). If you set the ally each 2 - 3 sec, the computer will stop attacking but will restart if the player is still attacking him.




May 1 2010, 9:12 pm Jesusfreak Post #4



AH! So THAT's why the comp player wouldn't unally... I had set the ally command without a wait trigger... Thank you apos, that is exactly what I wanted.

However, I'm a bit worried about wait blocks. I'm not very experienced with triggers. If I just set the trigger as...

Quote
(Check boxes for Players 1 and 7)

Player 1 suffers at least 21 deaths of "Holiness" (my sort of "reputation" counter; 21 is the amount players alligned to "Good" get at the start)

Set ally status for Player 1 to Ally.
Set ally status for Player 7 to Ally.
Wait 5000 seconds
Preserve Trigger

... would that be ok?



None.

May 2 2010, 12:29 am TiKels Post #5



Why use waits? Just use deathcounts.
Edit: was gonna edit in a link to the wiki but I seem to be unable to find the deathcount wiki... gimme a minute.



"If a topic that clearly interest noone needs to be closed to underline the "we don't want this here" message, is up to debate."

-NudeRaider

May 2 2010, 12:54 am NudeRaider Post #6

We can't explain the universe, just describe it; and we don't know whether our theories are true, we just know they're not wrong. >Harald Lesch

http://www.staredit.net/wiki.php?article=death_counters

The links have been changed to the new wiki, but the old pages still exist.




May 2 2010, 2:18 am Jesusfreak Post #7



I know how to use deathcounts, but what I wanted to know was, is there a point to using them over waits? I'm afraid that having a death timer constantly running would cause lag... do I have to worry about this?



None.

May 2 2010, 2:51 am DavidJCobb Post #8



Death counters are lagless and not prone to wait blocks.



None.

May 2 2010, 4:42 am Jesusfreak Post #9



Ok then, I'll try using death counters and see how it goes.

I take it that when I want to have a wait, I just have something to turn on the death counter, and make it stop when it's gone long enough? Like, for my introduction, I would do this (with actual dialogue in place of "blah blah blah"):

Quote
Elapsed time is at least 1 second.

Display Text "Blah blah blah"
Set deaths of whatever for current player to 1
Quote
Current player suffers at least 1 deaths of whatever.

Add 1 deaths of whatever for current player
Preserve trigger
Quote
Current player suffers at least 60 deaths of whatever

Display text "blah blah blah"
Set deaths of whatever to 0 for current player


Would that be how I do it?

I also kind of like physical timers (burning buildings and such). They're hard to mess up. Would you recommend using those a lot?



None.

May 2 2010, 12:05 pm NudeRaider Post #10

We can't explain the universe, just describe it; and we don't know whether our theories are true, we just know they're not wrong. >Harald Lesch

Physical timers are inferior to death counters unless you want the player to be able to see it. Death counters can't mess up either.




May 2 2010, 6:14 pm Jesusfreak Post #11



Ok. But did I get the death counter trigger idea right? I'm not very experienced with using deaths in place of waits.

Why are physical timers inferior, anyway, other than the players being able to see them?



None.

May 2 2010, 6:27 pm Apos Post #12

I order you to forgive yourself!

When you use death counters, you can detect any amount you want, when using the HP of a unit, you can't. Also, with death counter, you can decided how fast it goes down (Or up), using HP (For burning in your example), you can't. If HP would be as precise as death count, we wouldn't need any vHP. I guess someone else can go more in detail.




May 2 2010, 6:51 pm Jesusfreak Post #13



Ah, I get it. I actually had a plan to speed up the physical timers when I needed (spawning units to attack them XD), but the death counter thing does sound easier to control.



None.

May 3 2010, 7:10 am NudeRaider Post #14

We can't explain the universe, just describe it; and we don't know whether our theories are true, we just know they're not wrong. >Harald Lesch

Quote from Jesusfreak
but the death counter thing does sound easier to control.
That's the main point: They are easier to control.
You can check their value,
they are more precise/have more values
and most importantly you can add/subtract from them.
The list goes on.




May 5 2010, 1:04 pm Norm Post #15



Wait timers can interfere with eachother if not used carefully. Also, it's impossible to use more than one at a time for any given player.

Post has been edited 1 time(s), last time on May 5 2010, 1:27 pm by NudeRaider. Reason: waits are non-physical



None.

May 5 2010, 2:05 pm Jesusfreak Post #16



Oh, ok, I get it.

Dang, why'd Blizzard design the actual wait function to be so inefficient? It seems like there isn't any instance where a wait would be more efficient than a death timer XD.



None.

May 5 2010, 8:11 pm ImagoDeo Post #17



Quote from Jesusfreak
Oh, ok, I get it.

Dang, why'd Blizzard design the actual wait function to be so inefficient? It seems like there isn't any instance where a wait would be more efficient than a death timer XD.

The only thing that waits are useful for imo is for hypers. The trouble is that in some cases, using DCs can get rather complicated. =/



None.

May 6 2010, 12:16 am Lanthanide Post #18



Waits can be useful to cut down on the number of triggers you need. You can do some actions, wait, and more actions in a single trigger. Doing the same with DCs takes at least 3 triggers: 1 to deduct the DC, 1 to perform the first set of actions, 1 to perform the 2nd set of actions and reset the DC. This is particularly useful if it is something that happens rarely/in a controlled manner that you are sure won't wait block, and you are trying to conserve available non-playable units for other uses where DCs are required to avoid wait blocks.



None.

May 6 2010, 1:42 am NudeRaider Post #19

We can't explain the universe, just describe it; and we don't know whether our theories are true, we just know they're not wrong. >Harald Lesch

Quote from Jesusfreak
Dang, why'd Blizzard design the actual wait function to be so inefficient?
Why did you learn to crawl first as a baby? Why didn't you start with walking?

Quote from Jesusfreak
It seems like there isn't any instance where a wait would be more efficient than a death timer XD.
Waits are useful in single player maps where the player might not use fastest game speed.
Unlike death counters which are tied to game time (useful to time cutscenes) waits are measured in real-time, so you can time text messages and music independent from game speed.




May 6 2010, 4:14 am rockz Post #20

ᴄʜᴇᴇsᴇ ɪᴛ!

Blizzard didn't know Tuxedo Templar was going to make RUSH.

Waits are useful in hyper triggers and in simple triggers. When displaying a series of texts, it's nice to just use a wait and save a few triggers. I believe waits work on a frame by frame basis as well. They're certainly not useless, but it's much better to think of the game in terms of frame by frame rather than per second, due to game speeds.



"Parliamentary inquiry, Mr. Chairman - do we have to call the Gentleman a gentleman if he's not one?"

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[06:48 pm]
Ultraviolet -- :wob:
[2024-4-21. : 1:32 pm]
Oh_Man -- I will
[2024-4-20. : 11:29 pm]
Zoan -- Oh_Man
Oh_Man shouted: yeah i'm tryin to go through all the greatest hits and get the runs up on youtube so my senile ass can appreciate them more readily
You should do my Delirus map too; it's a little cocky to say but I still think it's actually just a good game lol
[2024-4-20. : 8:20 pm]
Ultraviolet -- Goons were functioning like stalkers, I think a valk was made into a banshee, all sorts of cool shit
[2024-4-20. : 8:20 pm]
Ultraviolet -- Oh wait, no I saw something else. It was more melee style, and guys were doing warpgate shit and morphing lings into banelings (Infested terran graphics)
[2024-4-20. : 8:18 pm]
Ultraviolet -- Oh_Man
Oh_Man shouted: lol SC2 in SC1: https://youtu.be/pChWu_eRQZI
oh ya I saw that when Armo posted it on Discord, pretty crazy
[2024-4-20. : 8:09 pm]
Vrael -- thats less than half of what I thought I'd need, better figure out how to open SCMDraft on windows 11
[2024-4-20. : 8:09 pm]
Vrael -- woo baby talk about a time crunch
[2024-4-20. : 8:08 pm]
Vrael -- Oh_Man
Oh_Man shouted: yeah i'm tryin to go through all the greatest hits and get the runs up on youtube so my senile ass can appreciate them more readily
so that gives me approximately 27 more years to finish tenebrous before you get to it?
[2024-4-20. : 7:56 pm]
Oh_Man -- lol SC2 in SC1: https://youtu.be/pChWu_eRQZI
Please log in to shout.


Members Online: Roy, Moose, Ghoster, Oh_Man