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

[Spell] Making a wheel

Status
Not open for further replies.
So I looked around, tried to follow some tutorials even. Still unable to make a wheel...

[trigger=]
wheel
Events
Time - Elapsed game time is 0.00 seconds
Conditions
Actions
Set set_point[1] = (Player 1 (Red) start location)
Set set_point[2] = (Player 1 (Red) start location)
Set set_point[3] = (Player 1 (Red) start location)
Set used_points = 3
Set trigger = wheel Run <gen>
Set timeout = 0.03
[/trigger]

[trigger=]
wheel Run
Events
Conditions
Actions
For each (Integer A) from 1 to 36, do (Actions)
Loop - Actions
Special Effect - Create a special effect at (get_point[1] offset by 400.00 towards ((Real((Integer A))) x (360.00 / 36.00)) degrees) using units\demon\ChaosGrunt\ChaosGrunt.mdl
For each (Integer A) from 1 to 8, do (Actions)
Loop - Actions
Set get_point[2] = (get_point[2] offset by 400.00 towards ((Real((Integer A))) x (360.00 / 20.00)) degrees)
Set get_point[3] = (get_point[2] offset by 400.00 towards ((Real((Integer A))) x (180.00 + (360.00 / 20.00))) degrees)
For each (Integer B) from 1 to 36, do (Actions)
Loop - Actions
Special Effect - Create a special effect at (get_point[2] offset by ((Real((Integer B))) x ((Distance between get_point[2] and get_point[3]) / 36.00)) towards (Angle from get_point[2] to get_point[3]) degrees) using units\demon\ChaosGrunt\ChaosGrunt.mdl
Set automaticClean = True
Set finish = True
[/trigger]
I wanted to apply the above to make a wheel that divides a circular area into eight sections of which can be called on to deal damage in entire sections.
unknown.png


The red cones/triangles are parts of the wheel that gets damage sent to those areas, the wheel is for reading and using this easier since pre-generated would be a massive mess. I am unsure how this'll work and if there are any better methods, wanted to catch each section upon creation so I can just set dummy units at each spot then add them to a unit group which then can be called on to hit an entire section of the wheel.


Edit: Maybe this should be moved to the trigger help section though since its more then just helping with a trigger... Considering I am unsure where to start, figured it would fit in either...?
 

Attachments

  • wheelz.w3x
    25.6 KB · Views: 15
Level 39
Joined
Feb 27, 2007
Messages
5,034
Is the wheel supposed to rotate? Do you just want a wheel made out of SFX and then at any time you can say "damage units in sectors 4 and 7" (the red areas in your image) or whatever and everything in that sector at that time takes damage?

You're not really using the points you set at the beginning and are instead referencing the get points that are never defined.
 
Level 39
Joined
Feb 27, 2007
Messages
5,034
  • Events
    • Time - Elapsed game time is 0.10 seconds
  • Conditions
  • Actions
    • Set W_Radius = 1000.00
    • Set W_Sectors = 8
    • Set W_SFXPerSector = 10
    • Set W_SFXPerSpoke = 10
    • Set W_CenterPoint = Wherever you want
    • Set W_Model = "Some\model.mdx"
    • -------- --------
    • Set W_SectorAng = (360.00 / Real(W_Sectors))
    • Set W_SFXAng = (W_SectorAng / Real(W_SFXPerSector))
    • Set W_SFXDist = (W_Radius / Real(W_SFXPerSpoke + 1)) //The +1 is so the last effect isn't in the outer wheel radius, but slightly before it. Think about it.
    • -------- --------
    • Special Effect - Create an effect at W_CenterPoint using W_Model
    • Set W_Effects[0] = (Last created special effect) //yes you can use the 0th index, GUI generally doesn't though
    • For each (Integer W_Int) from 1 to (W_Sectors x W_SFXPerSector) do (Actions)
      • Loop - Actions
        • Set TempPoint = W_CenterPoint offset by W_Radius towards (W_SFXAng x Real(W_Int - 1)) degrees //the -1 is so it starts at 0 degrees rather than W_SFXAng degrees
        • Special Effect - Create an effect at TempPoint using W_Model
        • Set W_Effects[W_Int] = (Last created special effect)
        • Custom script: call RemoveLocation(udg_TempPoint)
    • For each (Integer W_Int) from 0 to (W_Sectors - 1) do (Actions) //the 0 and -1 are so the used indices of Effects[] are contiguous (no gaps of unused indices)
      • Loop - Actions
        • For each (Integer A) from 1 to W_SFXPerSpoke do (Actions)
          • Loop - Actions
            • Set TempPoint = W_CenterPoint offset by (W_SFXDist x Real(Integer A)) towards (W_SectorAng x Real(W_Int)) degrees
            • Special Effect - Create an effect at W_CenterPoint using W_Model
            • Set W_Effects[(W_Int x W_Sectors) + (Integer A)] = (Last created special effect)
Now if you want to find things in different sectors you would do something like this:

  • Events
    • -------- no events, you run this manually --------
  • Conditions
    • WhichSector less than or equal to W_Sectors
  • Actions
    • Set MaxAng = (SectorAng x WhichSector)
    • Set MinAng = (MinAng - SectorAng)
    • Unit Group - Clear SectorGroup
    • Set TempGroup = Units within W_Radius of W_CenterPoint //could filter for alive, units of specific player, vulnerable, non-magic immune, etc. here or just leave that until later
    • Unit Group - Pick every unit in (SectorGroup) and do (Actions)
      • Loop - Actions
        • Set TempPoint = (Position of (Picked Unit))
        • Set Ang = Angle between W_CenterPoint and TempPoint //order is important here
        • If (All conditions are true) then do (Then actions) else do (Else actions)
          • If - Conditions
            • Ang Less than MaxAng
            • Ang Greater than MinAng
          • Then - Actions
            • Unit Group - Add (Picked Unit) to SectorGroup
          • Else - Actions
    • Custom script: call DestroyGroup(udg_TempGroup)
And you would then use the above trigger by doing something like:

  • Unit Group - Clear DamageGroup //clearing the group instead of destroying it since we want it to 'exist' to add units to
  • Set WhichSector = 4
  • Trigger - Run SectorGetterTrigger <gen> (checking conditions)
  • Unit Group - Add All Units in SectorGroup to DamageGroup
  • Set WhichSector = 7
  • Trigger - Run SectorGetterTrigger <gen> (checking conditions)
  • Unit Group - Add All Units in SectorGroup to DamageGroup
  • Unit Group - Pick every unit in DamageGroup and do (Actions)
    • Loop - Actions
      • -------- damage here --------
  • -------- SectorGroup does not need to be cleaned up --------
 
Is the wheel supposed to rotate? Do you just want a wheel made out of SFX and then at any time you can say "damage units in sectors 4 and 7" (the red areas in your image) or whatever and everything in that sector at that time takes damage?

You're not really using the points you set at the beginning and are instead referencing the get points that are never defined.
How would you make it rotate?
 
Level 39
Joined
Feb 27, 2007
Messages
5,034
Basically just recompute the locations of all the SFX if the wheel was slightly turned and then move them one by one with the new SFX move natives. Say the wheel should be turned by TurnAngle, then you just need to add + TurnAngle to every computation that uses an angle.

This will also need to be propagated through to MinAng and MaxAng in the part that checks for units in specific sectors. I would increment TurnAngle periodically and Modulo it so it never goes above 360. You can look up what the modulo function does if you aren’t familiar, it is the same as in any programming language.
 
Status
Not open for further replies.
Top