• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Detecting traps

Status
Not open for further replies.
Level 21
Joined
Aug 21, 2005
Messages
3,699
I don't know if it has been done in another map yet, but I want a detecting system in my map...

Since I'm so stupid, I don't see another way to do this than in the following way: (please tell me if you have a better idea, or see some bugs in it)

Trigger 1
Events: Unit - A unit Learns a skill
Conditions: And - All (Conditions) are true
Conditions
(Unit-type of (Triggering unit)) Equal to Assassin
(Learned Hero Skill) Equal to Orc Blademaster - Wind Walk (
"Detect Traps" spell is a custom spell --> windwalk with no stats, no duration)
Actions: Set Variable: Set DetectTraps = (Learned skill level) (integer variable)

Trigger 2
Events: Unit - A unit Begins casting an ability
Conditions: (Ability being cast) Equal to Detect Traps
Actions:
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
DetectDeadlylightningtraps Equal to True
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Random integer number between 1 and 25) Less than or equal to DetectTraps
Then - Actions
Special Effect - Create a special effect at (Position of Traps 0146 <gen>) using Abilities\Spells\Items\TomeOfRetraining\TomeOfRetrainingCaster.mdl
Wait 5.00 seconds
Special Effect - Destroy (Last created special effect)
Else - Actions
Do nothing
Else - Actions
Do nothing

Detectdeadlylightningtraps is a boolean that becomes true when a unit enters a certain region near the actual deadly lightning trap. It will become false when you leave that region.

Now my questions:
1) Is this detect traps system acceptable or is it really like "cursing against God" for you guys :)
2) Since I'm planning to make alot of traps in my map (well alot = more than 30...), this enter & leave region to be able to detect the trap is quite annoying...
I was thinking of making a neutral invissible unit at the place of the trap, so when you come within 400 of that unit, the variable will become true too.
2 problems: 1: It will still be annoying like the regions, since I'll have to do this for every specific trap. I'm going to make deadly lightning traps, but also normal lightning traps, freezing ice traps, etc. If I'd make a new unit for every TYPE of trap, and if I could say that when a unit comes within 400 of that unit TYPE, It would be ALOT easier... But I don't know how to do that event...
Problem 2: I don't know how I can make the variable (deadlylightningtraps) go false again, since there is no such event like "a unit leaves the trapunit within range of 400, if you understand what I'm trying to say...
Maybe saying "A unit comes within -400 of unit" would help this, but I don't know if warcraft III will understand that "-400" means that he does not come withing 400 of that unit...

please help me? Thank you
 
Level 9
Joined
Jul 7, 2005
Messages
529
I read it but it makes no sense usually triggers make sense...

Ok now i get it (after doing the triggers), okay her is what i have done:

Code:
Detect Set Ability
    Events
        Unit - A unit Learns a skill
    Conditions
        (Unit-type of (Triggering unit)) Equal to Assassin
        (Learned Hero Skill) Equal to Detect Traps 
    Actions
        Set DetectTraps = (DetectTraps + 1)
Code:
Detect No1 Trap No1
    Events
        Unit - A unit enters Trap 100 <gen>
    Conditions
    Actions
        Set DetectDeadlyLighteningTraps = True

Code:
Detect No2 Trap No1
    Events
        Unit - A unit Begins casting an ability
    Conditions
        (Ability being cast) Equal to Detect Traps 
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                DetectDeadlyLighteningTraps Equal to True
            Then - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        DetectTraps Less than or equal to 3
                    Then - Actions
                        Special Effect - Create a special effect at (Center of Trap 100 <gen>) using Abilities\Spells\Items\TomeOfRetraining\TomeOfRetrainingCaster.mdl
                        Wait 60.00 seconds
                        Special Effect - Destroy (Last created special effect)
                    Else - Actions
                        Do nothing
            Else - Actions
                Do nothing

Code:
Detect No3 Trap No1
    Events
        Unit - A unit leaves Trap 100 <gen>
    Conditions
    Actions
        Set DetectDeadlyLighteningTraps = False

You can change the "Unit - A unit enters Trap 100 <gen>" to "Unit - A unit comes within -200.00 of Unit <gen>" that should work ( ill test and get back to you) just make sure you tick the box in the Preferences

Edit: Bugger the -200 doesnt seem to work for me :(
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
your first trigger is indeed better than mine.

About the real detecting trigger: I probably forgot to say why I would prefer to do it my way: The detecting traps spell will have 10 levels, so the better you get in detecting traps, the easier you'll detect a trap. E.g. A deadly trap is much harder to detect than an oridinairy trap that hardly does damage, but it's still detectable at level 1!
Another thing: maybe my 5 seconds duration of the special effect is a little bit low, but 1 minute is a long time... is there a specific reason why you took 60 seconds?

anyway: the real thing why I posted this tread is about the 'a unit comes within 400 of ...'... But I guess I'll have to make 2 triggers per trap... *sniff*
 
Status
Not open for further replies.
Top