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

Sanity System & Screen Flashing

Status
Not open for further replies.
Level 5
Joined
Dec 13, 2008
Messages
141
I'm creating a "Sanity" effect, where to feel safe a hero/unit must be near another hero/unit to regain mentality. They lose that safe feeling when they leave the presence of another hero/unit (I put the range as 7.5).
Basically, units with safe behavior have slowly increasing sanity, while with Cautious they lose sanity and descend into madness.

Heres how I did it:
  • Unit - Any Unit Enters a distance of 7.5 from (Unit 1 from (Units in (Entire map) having alliance Ally Exclude Self with player Any Player matching Required: Heroic; Excluded: Missile, Dead, Hidden, with at most Any Amount))
  • Local Variables
  • Conditions
  • Actions
    • Unit - Add 1 Safe to (Triggering unit) from player (Owner of (Triggering unit))
    • Unit - Remove 1 Cautious from (Triggering unit) from player (Owner of (Triggering unit))
    • Player Group - Remove player (Owner of (Triggering unit)) from Cautious People
    • Camera - Stop shaking the camera for player (Owner of (Triggering unit))
  • Unit - Any Unit Leaves a distance of 7.5 from (Unit 1 from (Units in (Entire map) having alliance Ally Exclude Self with player Any Player matching Required: Heroic; Excluded: Missile, Dead, Hidden, with at most Any Amount))
  • Local Variables
  • Conditions
  • Actions
    • Unit - Add 1 Cautious to (Triggering unit) from player (Owner of (Triggering unit))
    • Unit - Remove 1 Safe from (Triggering unit) from player (Owner of (Triggering unit))
    • Player Group - Add player (Owner of (Triggering unit)) to Cautious People
    • Camera - Shake the camera for player (Owner of (Triggering unit)) for 0.0 seconds, with strength 2.0, frequency 2.0 Hz, and 100.0% randomness (Position: Target, Direction: XYZ)
But when I quick tested, there was no behavior added and the Sanity meter constantly rises up.

This is the increase/decrease for sanity:

  • Timer - Every 30.0 seconds of Game Time
  • Local Variables
  • Conditions
  • Actions
    • Player Group - Pick each player in Cautious People and do (Actions)
      • Actions
        • Unit Group - Pick each unit in (Any units in (Entire map) owned by player (Picked player) matching Required: Heroic; Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
          • Actions
            • Unit - Set (Picked unit) Life to (((Picked unit) Life (Current)) - 1.0)
            • Unit - Set (Picked unit) Energy to (((Picked unit) Energy (Current)) - 1.0)
    • Unit Group - Pick each unit in (Any units in (Entire map) owned by player Any Player matching Required: Heroic; Excluded: Missile, Dead, Hidden, with at most (Convert Boolean To Integer(((Triggering unit) has Safe)))) and do (Actions)
      • Actions
        • Variable - Set Sanity Count[(Owner of (Picked unit))] = (Sanity Count[(Owner of (Picked unit))] + 1)
        • Text Tag - Set text of Sanity Tag[(Owner of (Picked unit))] to ("Sanity " + (Text(Sanity Count[(Owner of (Picked unit))])))
    • Unit Group - Pick each unit in (Any units in (Entire map) owned by player Any Player matching Required: Heroic; Excluded: Missile, Dead, Hidden, with at most (Convert Boolean To Integer(((Triggering unit) has Cautious)))) and do (Actions)
      • Actions
        • Variable - Set Sanity Count[(Owner of (Picked unit))] = (Sanity Count[(Owner of (Picked unit))] - ((Stack count of Mentality on (Picked unit)) / 5))
        • Text Tag - Set text of Sanity Tag[(Owner of (Picked unit))] to ("Sanity " + (Text(Sanity Count[(Owner of (Picked unit))])))

A quick screen flash for an individual player
I wanted to do a screen flash for individual players or player groups, but I don't think I see any in triggers that would let me do that. Is there a way? Also, when I tried using Cinematic - Fade In( and Fade Out), the screen is stuck in that supposed flash.
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
Im not familliar with the function Unit 1 of (Group). Can you say what this is supposed to do? If it was basically FirstOfGroup(), than you might be getting the wrong unit.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,201
You sure Triggering Unit refers to the unit who's range was entered and not the unit who entered the range? What is with choosing a single unit from the entire map for the enter event?

I do not think the triggers will work very well if more than 1 unit approaches the unit and then one leaves.

Add the units to a group and iterate through that group rather than filtering every unit on the map every 30 seconds.

Every unit in the system will need an enters range event. You will need to use stack charges of the behaviour to keep track of how many units are in range so that more than 1 unit can enter with the system not bugging.

You might also be able to do this with the data editor alone. Consider using the power field behaviour as a "company giver" and then having a "needs company" buff that depends on the presence of this power field. It will not stack (no real way to make more company give a bigger bonus) but it will not bug and is probably far more efficient than using trigger script.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,201
For localized screen flash you will need to either use an actor (not sure how) or create a dialog that is white and only visible to the player.

The actor approach might be to create a flood light type actor that over exposes the entire scene (remember to test on ultra settings to avoid artefacts). The Dialog approach is to give a full screen dialog a white colour and to show and hide it. The problem with the dialog approach is poor fade in and out.

For flashes like lightning they should be done globally (as lightning is visible to everyone at the same time) so you can use script to change the lighting model to one which over exposes the entire environment.
 
Level 5
Joined
Dec 13, 2008
Messages
141
In the data editor, can I do it using Validators(Location Range, Detect Range, or Enumerable Area)?

Also, for the power field behavior, how am I going to do power source? If I put it on all the heroes, then they won't feel the safe/caution effects.
 
Level 5
Joined
Dec 13, 2008
Messages
141
Scratch that, after a week of slacking off and school, I figured what I would do with the power behavior.

Safe range in power level is 2-5. Caution is 0-1. :]

EDIT: Getting errors for reducing sanity.

EDIT 2: Oops, nevermind, forgot to give them the power sources.
 
Last edited:
Status
Not open for further replies.
Top