HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Variety of Apllication Issues/Misunderstandings

10-05-2007, 12:34 AM#1
Blacktastic
First off I would like to say hello everyone XD. I am somewhat new to JASS. I know the basics and some advanced concepts and I can pick up on something relativly quickly, so hopefully when this gets explained to me I can comprehend it rather well.

My current project is one I have high hopes for IF I can get it to work correctly. Anyway, I should give you an idea first of what is being dealt with. I am creating a map where the only way to attack is to use Collision Missles (It is based on a game currently owned by mythic, Magestorm). Mana and Energy (Gold) dictates how often you can cast, as the spells themselves have 0 cooldowns. You can have 3 spells armed at any given time.

Ok, now that the ideas are layed out, I have several issues, all of which deal with Structs and Collision Missles. I am aware that my triggering is a hybrid of JASS and GUI. As I said, I am still somewhat new to Jass, so I am slowly but surely converting myself over, so please bear with me on this : ).

Ok, so I will ask one question at a time then. First off, and most importantly, is the application of Collision Missles. Since I use this function so often in my map, I made a simple JASS trigger so it wouldn't get repetitive. It goes as such

Collapse JASS:
struct projectileType
  integer id
  real angle
  real second
  real third
  real damage
  real aoe
  unit caster
  boolean crit
endstruct  
  
function projectile_hit takes nothing returns nothing
  local unit proj = GetTriggerCollisionMissile()
  local projectileType ptype = CollisionMissile_GetTag(proj)
  set udg_CollisionId = ptype.id
  set udg_CollisionAngle = ptype.angle
  set udg_CollisionDamage = ptype.damage
  set udg_CollisionSecondEffect = ptype.second
  set udg_CollisionThirdEffect = ptype.third
  set udg_CollisionAOE = ptype.aoe
  set udg_CollisionCaster = ptype.caster
  set udg_CritIdentify = ptype.crit
  set udg_CollisionMissile = proj
  set proj = null
  call TriggerExecute(gg_trg_Projectile_Collision)
  call ptype.destroy()
endfunction 
  
function create_projectile takes nothing returns nothing
  local unit proj = CollisionMissile_Create(udg_CollisionPath, GetUnitX(udg_CollisionCaster), GetUnitY(udg_CollisionCaster), GetUnitFacing(udg_CollisionCaster), udg_CollisionSpeed, 0, 1000000000, udg_CollisionHitbox, true, 100, function projectile_hit)
  local projectileType ptype = projectileType.create()
  set ptype.id = udg_CollisionId
  set ptype.angle = GetUnitFacing(udg_CollisionCaster)
  set ptype.damage = udg_CollisionDamage
  set ptype.second = udg_CollisionSecondEffect
  set ptype.third = udg_CollisionThirdEffect
  set ptype.aoe = udg_CollisionAOE
  set ptype.caster = udg_CollisionCaster
  set ptype.crit = udg_CritIdentify
  call CollisionMissile_SetTag(proj, ptype)
  set proj = null
endfunction

Simply put, I just attach any possible data for each missle upon the missles creation. Big deal. Here is the actual collision part. (I know this is BY FAR not making use of the system correctly, which is why I am here.)

Trigger:
Projectile Collision
Events
Conditions
Collapse Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Collapse And - All (Conditions) are true
Collapse Conditions
((Triggering unit) belongs to an enemy of (Owner of CollisionCaster)) Equal to True
((Triggering unit) is A Hero) Equal to True
Collapse Then - Actions
Game - Display to (All players) the text: Case 1
Set TempPoint = (Position of (Triggering unit))
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
CollisionId Equal to 1
Collapse Then - Actions
Set CollisionDamage = (CollisionDamage x ResistFire[(Player number of (Owner of (Triggering unit)))])
Unit - Cause CollisionMissile to damage (Triggering unit), dealing CollisionDamage damage of attack type Spells and damage type Normal
Custom script: call CollisionMissile_Destroy (udg_CollisionMissile)
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
CritIdentify Equal to True
Collapse Then - Actions
Floating Text - Create floating text that reads (Critical! + ( ( + ((String((Integer(CollisionDamage)))) + )))) at TempPoint with Z offset 25.00, using font size 8.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
Floating Text - Set the velocity of (Last created floating text) to 20.00 towards 90.00 degrees
Floating Text - Change (Last created floating text): Disable permanence
Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
Else - Actions
Collapse Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
CollisionId Equal to 2
Collapse Then - Actions
Set CollisionDamage = (CollisionDamage x ResistIce[(Player number of (Owner of (Triggering unit)))])
Unit - Cause CollisionMissile to damage (Triggering unit), dealing CollisionDamage damage of attack type Spells and damage type Normal
Set SpellTimeCaster = (Triggering unit)
Set SpellTimeLength = 2.00
Set SpellTimeSpeed = CollisionSecondEffect
Set SpellTimeTrigger = MovementSpeedRevert <gen>
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Current movement speed of (Triggering unit)) Less than or equal to SpellTimeSpeed
Collapse Then - Actions
Set SpellTimeSpeed = (Current movement speed of (Triggering unit))
Else - Actions
Unit - Set SpellTimeCaster movement speed to ((Current movement speed of (Triggering unit)) - SpellTimeSpeed)
Trigger - Run StartSpell <gen> (ignoring conditions)
Custom script: call CollisionMissile_Destroy (udg_CollisionMissile)
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
CritIdentify Equal to True
Collapse Then - Actions
Floating Text - Create floating text that reads (Critical! + ( ( + ((String((Integer(CollisionDamage)))) + )))) at TempPoint with Z offset 25.00, using font size 8.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
Floating Text - Set the velocity of (Last created floating text) to 20.00 towards 90.00 degrees
Floating Text - Change (Last created floating text): Disable permanence
Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
Else - Actions
Collapse Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
CollisionId Equal to 3
Collapse Then - Actions
Set CollisionDamage = (CollisionDamage x ResistEarth[(Player number of (Owner of (Triggering unit)))])
Unit - Cause CollisionMissile to damage (Triggering unit), dealing CollisionDamage damage of attack type Spells and damage type Normal
If ((Random integer number between 1 and 100) Less than (Integer(CollisionSecondEffect))) then do (Unit - Order (Triggering unit) to Stop) else do (Do nothing)
Custom script: call CollisionMissile_Destroy (udg_CollisionMissile)
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
CritIdentify Equal to True
Collapse Then - Actions
Floating Text - Create floating text that reads (Critical! + ( ( + ((String((Integer(CollisionDamage)))) + )))) at TempPoint with Z offset 25.00, using font size 8.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
Floating Text - Set the velocity of (Last created floating text) to 20.00 towards 90.00 degrees
Floating Text - Change (Last created floating text): Disable permanence
Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
Else - Actions
Collapse Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
CollisionId Equal to 4
Collapse Then - Actions
Set CollisionDamage = (CollisionDamage x ResistArcane[(Player number of (Owner of (Triggering unit)))])
Unit - Cause CollisionMissile to damage (Triggering unit), dealing CollisionDamage damage of attack type Spells and damage type Normal
Custom script: call CollisionMissile_Destroy (udg_CollisionMissile)
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Mana of (Triggering unit)) Less than CollisionSecondEffect
Collapse Then - Actions
Unit - Set mana of CollisionCaster to ((Mana of CollisionCaster) + (Mana of (Triggering unit)))
Unit - Set mana of (Triggering unit) to 0.00
Collapse Else - Actions
Unit - Set mana of (Triggering unit) to ((Mana of (Triggering unit)) - CollisionSecondEffect)
Unit - Set mana of CollisionCaster to ((Mana of CollisionCaster) + CollisionSecondEffect)
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
CritIdentify Equal to True
Collapse Then - Actions
Floating Text - Create floating text that reads (Critical! + ( ( + ((String((Integer(CollisionDamage)))) + )))) at TempPoint with Z offset 25.00, using font size 8.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
Floating Text - Set the velocity of (Last created floating text) to 20.00 towards 90.00 degrees
Floating Text - Change (Last created floating text): Disable permanence
Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
Else - Actions
Collapse Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
CollisionId Equal to 5
Collapse Then - Actions
Set CollisionDamage = (CollisionDamage x ResistMind[(Player number of (Owner of (Triggering unit)))])
Unit - Cause CollisionMissile to damage (Triggering unit), dealing CollisionDamage damage of attack type Spells and damage type Normal
Special Effect - Create a special effect attached to the head of (Triggering unit) using Abilities\Weapons\Bolt\BoltImpact.mdl
Custom script: call CollisionMissile_Destroy (udg_CollisionMissile)
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
CritIdentify Equal to True
Collapse Then - Actions
Floating Text - Create floating text that reads (Critical! + ( ( + ((String((Integer(CollisionDamage)))) + )))) at TempPoint with Z offset 25.00, using font size 8.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
Floating Text - Set the velocity of (Last created floating text) to 20.00 towards 90.00 degrees
Floating Text - Change (Last created floating text): Disable permanence
Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
Else - Actions
Collapse Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
CollisionId Equal to 8
Collapse Then - Actions
Set CollisionDamage = (CollisionDamage x ResistDark[(Player number of (Owner of (Triggering unit)))])
Unit - Cause CollisionMissile to damage (Triggering unit), dealing CollisionDamage damage of attack type Spells and damage type Normal
Special Effect - Create a special effect attached to the origin of (Triggering unit) using Abilities\Spells\Human\Feedback\ArcaneTowerAttack.mdl
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Mana of (Triggering unit)) Less than CollisionSecondEffect
Collapse Then - Actions
Set CollisionSecondEffect = (Mana of (Triggering unit))
Unit - Cause CollisionMissile to damage (Triggering unit), dealing CollisionSecondEffect damage of attack type Spells and damage type Normal
Unit - Set mana of (Triggering unit) to 0.00
Custom script: call CollisionMissile_Destroy (udg_CollisionMissile)
Collapse Else - Actions
Unit - Cause CollisionMissile to damage (Triggering unit), dealing CollisionSecondEffect damage of attack type Spells and damage type Normal
Unit - Set mana of (Triggering unit) to ((Mana of (Triggering unit)) - CollisionSecondEffect)
Custom script: call CollisionMissile_Destroy (udg_CollisionMissile)
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
CritIdentify Equal to True
Collapse Then - Actions
Floating Text - Create floating text that reads (Critical! + ( ( + ((String((Integer((CollisionDamage + CollisionSecondEffect))))) + )))) at TempPoint with Z offset 25.00, using font size 8.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
Floating Text - Set the velocity of (Last created floating text) to 20.00 towards 90.00 degrees
Floating Text - Change (Last created floating text): Disable permanence
Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
Else - Actions
Else - Actions
Collapse Else - Actions
Game - Display to (All players) the text: Case 2
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
CollisionId Equal to 6
(Unit-type of (Triggering unit)) Equal to Ghost
((Triggering unit) belongs to an ally of (Owner of CollisionCaster)) Equal to True
Collapse Then - Actions
Player - Enable Accept Ressurection for (Owner of (Triggering unit))
Set DeathGhost = (Triggering unit)
Set DeathAction = Remove Ressurection <gen>
Set DeathLength = 5.00
Custom script: call RezStart()
Special Effect - Create a special effect attached to the origin of (Triggering unit) using Abilities\Spells\Human\Resurrect\ResurrectTarget.mdl
Collapse Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
CollisionId Equal to 7
(Triggering unit) Equal to CollisionCaster
Collapse Then - Actions
Set CollisionDamage = (CollisionDamage x ResistHoly[(Player number of (Owner of (Triggering unit)))])
Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + CollisionDamage)
Special Effect - Create a special effect attached to the head of (Triggering unit) using Abilities\Spells\Human\HolyBolt\HolyBoltSpecialArt.mdl
Custom script: call CollisionMissile_Destroy (udg_CollisionMissile)
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
CritIdentify Equal to True
Collapse Then - Actions
Floating Text - Create floating text that reads (Critical! + ( ( + ((String((Integer(CollisionDamage)))) + )))) at TempPoint with Z offset 25.00, using font size 8.00, color (0.00%, 100.00%, 0.00%), and 0.00% transparency
Floating Text - Set the velocity of (Last created floating text) to 20.00 towards 90.00 degrees
Floating Text - Change (Last created floating text): Disable permanence
Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
Else - Actions
Else - Actions
Game - Display to (All players) the text: Case 3

ID identifies spell attributes. 1 is direct damage, 2 has snaring effects, etc.

Anyway, time for the issue. This spell should only have three cases.
1) Hits an Enemy and Fires
2) Hits an Ally and Fires
3) Hits self (Self only spell)

However, if a collision missle of the type that strikes opponents comes near an opponent in mid cast of their own collision missle, this trigger DOES NOT FIRE. I have added Debug messaes at each possible outcome, and none fire when this specific event occurs, and I cannot figure out why.

So I ask either A) Where did I goof

or B) How can I better use this system to fufill my needs?

Shortened the GUI trigger so its easier to read.

[edit] Holy snap thats freakin handy O.O. I concur with your refusal to read Vex lol. Sorry about that.
10-05-2007, 01:45 AM#2
Vexorian
Please use trigger and jass tags, I refuse to read this thread before they are used (I know you were already told about this some time ago...)
10-05-2007, 02:01 AM#3
Blacktastic
Actually I have not. On most forums I use the [code] ones.

*Looks around*

Aha! Found em. Fixin.
10-05-2007, 02:36 AM#4
Vexorian
aw sorry, your nick is just similar to someone else's I didn't notice you were a new user.

Gonna take a look to this tomorrow, it is getting late today...
10-05-2007, 03:08 AM#5
Blacktastic
No harm done : ). But yea, it is a bit late. I have a few other issues but for now I won't post em. Wanna focus on gettin this fixed first.
10-08-2007, 08:07 PM#6
Blacktastic
Any word on if this is an issue of mine? I've spent that past 6 days trying to figure this out to no avail XD.
10-08-2007, 11:39 PM#7
Vexorian
Yes, sorry, it's been a busy couple of days. Please wait.
10-09-2007, 12:30 AM#8
Blacktastic
Don't want to rush you :p. I just feel like taking a zomgwtfkamahamahaBOOM Sword to this bug right now XD. I'm going to take a break and do some Calc 2.
10-09-2007, 04:46 AM#9
Vexorian
You should only call call ptype.destroy() after CollisionMissile_Destroy, right now you are causing conflicts and most likely all missile instances end up using other instance's ptype structure simultaneously.