Trigger Help Plz

Sajin

User title under construction.
Reaction score
56
People of Thehelper I have a problem with a skill for my soon coming map. The skill is:
The soilder shoots a bullet and once the bullet comes in contact with the spefic enemy that it was shot it, that unit gets sent backwards.

Specifications: The bullet travels through a slide trigger (the bullet is a dummy unit)
The Skill is done in GUI and i would like to keep it that way
And i know the skills leaks and for me its fine atm but for whoever corrects me wants to throw the custom script in im fine with it =)

Problems: Currently the dummy unit isan't appearing when the skill is cast
and the Knockback is fairly jumpy, and finnaly the enemy unit becomes stunned for a long period of time when i dont want it too. Currently here are my triggers

Code:
Variables

KnockbackTable = Hashtable
PeneCaster = Unit Array
PeneTarget = Unit Array
peneCastLoc = Point Array
Bullet = Unit Array
KnockbackAngle = Real
KnockbackDistance = Real
RemainingTime = Real
BulletLoc = Point Array
KnockbackUnits = Unit Group
TempPoint = Point Array

Code:
HashTables
    Events
        Map initialization
    Conditions
    Actions
        Hashtable - Create a hashtable
        Set knockbackTable = (Last created hashtable)


Code:
KnockbackTarget
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Penetrating Shot 
    Actions
        Set PeneCaster[(Player number of (Owner of (Casting unit)))] = (Casting unit)
        Set PeneTarget[(Player number of (Owner of (Target unit of ability being cast)))] = (Target unit of ability being cast)
        Set peneCastLoc[(Player number of (Owner of (Casting unit)))] = (Position of (Casting unit))
        Unit - Create 1 Bullet for (Owner of (Casting unit)) at peneCastLoc[(Player number of (Owner of (Casting unit)))] facing (Position of (Target unit of ability being cast))
        Set Bullet[(Player number of (Owner of (Casting unit)))] = (Last created unit)
        Unit - Add a 4.00 second Generic expiration timer to Bullet[(Player number of (Owner of (Casting unit)))]
        Unit Group - Add Bullet[(Player number of (Owner of (Casting unit)))] to PeneBullets
        Set KnockbackAngle = (Angle from (Position of Bullet[(Player number of (Owner of (Casting unit)))]) to (Position of (Target unit of ability being cast)))
        Set KnockbackDistance = (300.00 x 0.04)
        Set RemainingTime = 0.40
        Hashtable - Save KnockbackDistance as (Key distance) of (Key (Target unit of ability being cast)) in knockbackTable
        Hashtable - Save KnockbackAngle as (Key angle) of (Key (Target unit of ability being cast)) in knockbackTable
        Hashtable - Save RemainingTime as (Key time) of (Key (Target unit of ability being cast)) in knockbackTable


Code:
Knockback Bullet Move
    Events
        Time - Every 0.04 seconds of game time
    Conditions
    Actions
        Unit Group - Pick every unit in PeneBullets and do (Actions)
            Loop - Actions
                Set BulletLoc[(Player number of (Owner of (Picked unit)))] = (Position of (Picked unit))
                Unit - Move (Picked unit) instantly to ((Position of PeneTarget[(Player number of Player 12 (Brown))]) offset by 11.00 towards (Facing of (Picked unit)) degrees)
                Unit Group - Pick every unit in (Units within 100.00 of BulletLoc[(Player number of (Owner of (Picked unit)))]) and do (Actions)
                    Loop - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (Picked unit) Equal to PeneTarget[(Player number of (Owner of (Picked unit)))]
                            Then - Actions
                                Unit Group - Add (Picked unit) to KnockbackUnits
                                Unit - Pause (Picked unit)
                            Else - Actions
                                Do nothing
Code:
KnockbackUnits
    Events
        Time - Every 0.04 seconds of game time
    Conditions
    Actions
        Unit Group - Pick every unit in KnockbackUnits and do (Actions)
            Loop - Actions
                Set KnockbackDistance = (Load (Key distance) of (Key (Picked unit)) from knockbackTable)
                Set KnockbackAngle = (Load (Key angle) of (Key (Picked unit)) from knockbackTable)
                Set RemainingTime = (Load (Key time) of (Key (Picked unit)) from knockbackTable)
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        RemainingTime Greater than 0.00
                    Then - Actions
                        Unit - Remove Bullet[(Player number of (Owner of (Triggering unit)))] from the game
                        Set TempPoint[(Player number of (Owner of (Picked unit)))] = ((Position of (Picked unit)) offset by KnockbackDistance towards KnockbackAngle degrees)
                        Unit - Move (Picked unit) instantly to TempPoint[(Player number of (Owner of (Picked unit)))]
                        Hashtable - Save (RemainingTime - 0.04) as (Key time) of (Key (Picked unit)) in knockbackTable
                    Else - Actions
                        Hashtable - Clear all child hashtables of child (Key (Picked unit)) in knockbackTable
                        Unit - Unpause (Picked unit)
                        Unit Group - Remove (Picked unit) from KnockbackUnits

Can anyone please help me
 

Nighthawk

New Member
Reaction score
9
Allo Mate

From what I understand:

1. The bullet isn't appearing b/c the Bullet Move trigger simply moves it 11 yards away from the target each time. What you want to do is to set a base speed for the bullet, and then move the picked unit to the position of the picked unit offset by X (speed) towards angle from picked unit to target. You want it to be from the angle of the bullet to the target and not from the caster to the target so it will have a sort of "follow" effect incase the target moves.

Every .04 seconds of game time, so 25 times a second. I don't know what the range of this is, but I would say make it go like 800 yards a second. 800 /25 = 32. So move it 32 yards each time.

For example:
Trigger:
  • Unit - Move (Picked unit) instantly to ((Position of (Picked unit)) offset by 32.00 towards (Angle from (Position of (Picked unit)) to (Position of Deathgrip_Target)) degrees), facing (Angle from (Position of (Picked unit)) to (Position of Deathgrip_Target)) degrees



I'll keep looking through the rest, fun question :cool:


I don't see any problems in the triggers with you pausing/unpausing the unit, so the stun might be a problem with the spell your basing it off of. If the base spell is a stun spell and you set the duration to 0 then it will last indefinitely.


The knockback is a little screwy. I use alot of knockback/grab spells in my map, I can throw together a sample trigger for you to use in place of your KnockbackUnits trigger later on tonight if no ones helped you yet.
 

Sajin

User title under construction.
Reaction score
56
I figured out the stun problem and it actually was the pausing / unpausing. sometime the pausing sometimes screws up when you use "Picked Unit" but thank you for the first solution il test it out now =)
 

kingkwong92

Well-Known Member
Reaction score
25
From what I have read, you have the knock backed unit moving 300 in 1 second. I think that if you don't decrease the 0.04 seconds, it will look jumpy.
No offence or anything but your code is really hard to read.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top