[skip all navigation]

[SOLVED] Model attachment

Creator: payne
Time: Dec 28 2010, 9:40 pm
Topic Locked
Topic Locked
This topic has been locked!
Reason: solveed
Closed by: Ahli

Post #1     payne Dec 28 2010, 9:40 pm

[Avatar]
Addicted to SEN Games -Add more!-
offlinecontact
Rank: Veteran
At start, the crown (thin torus shape) lies on the ground, and the first player to take it has the Thin Torus Shape model attached to his "Overhead". Since I must create a new model, I delete the old shape that was lying on the ground. So far, everything works fine.
Then, I'd like that whenever a Changeling enters the region "Crown", which is supposed to be centered on the Crown-holder, the Crown model is passed the Changeling that entered the Crown region. Somehow, I can't get to remove the model attachment from the overhead of the initial holder, and I can't attach the model to the new holder either.

Here's the trigger:

Code

Near
   Events
       Unit - Any Unit Enters Crown
   Local Variables
   Conditions
       (Unit type of (Triggering unit)) == Changeling (Zergling)
   Actions
       Unit - Remove Thin Torus [49.00, 45.50] from the game
       Actor - Kill actor model (Last created actor)
       Region - Attach Crown to (Triggering unit) with offset (Point(0.0, 0.0))
       Actor - Attach ShapeThinTorus (Unnamed) to Overhead on (Triggering unit)
       General - Pick each integer from 1 to 8, and do (Actions)
           Actions
               Variable - Set HasCrown?[(Picked integer)] = false
       Variable - Set HasCrown?[(Triggering player)] = true


The variable "HasCrown?" is used in another trigger to update the score, which is based on the time players hold the crown.
This post was edited 1 time, last edit by payne: Jan 3 2011, 8:58 am.

Top

Post #2     NicholasBeige Dec 28 2010, 11:01 pm

[Avatar]
offlinecontact
Rank: Regular
Show us more of your triggers please... :P you could be going wrong in so many places its unthinkable.

Create Model
Set Variable1 (crown)= Last Created Model
Attach Model to Unit
Set Variable2 (unit) = Unit who now has Crown attached
Attach Region (crown) to Variable2 (unit)

Unit Enters Region
Unit Entering is not equal to Variable2 (Unit)

Remove Variable1 (crown)
Create Model
Attach Model to new unit
Set Variable1 = last created model
Set Variable2 = new unit (crown holder)

Should work fine? Don't have the trigger editor open (as you can tell).

Gone.
Top

Post #3     payne Dec 30 2010, 6:59 am

[Avatar]
Addicted to SEN Games -Add more!-
offlinecontact
Rank: Veteran
I can only create a unit, not a model itself. And a variable cannot store a model.
This doesn't work. :(

Top

Post #4     payne Dec 31 2010, 11:08 pm

[Avatar]
Addicted to SEN Games -Add more!-
offlinecontact
Rank: Veteran
I still need help over this, btw. :/

Top

Post #5     Roy Jan 1 2011, 4:14 pm

[Avatar]
An artist's depiction of an Extended Unit Death
onlinecontact
Rank: Veteran
Uh... You can't use (Last created actor) if you haven't created an actor. It's treated as a temporary local variable (I believe). Store that actor in a global variable when you create it and maybe that will fix the removal problem.

I suppose you have already confirmed that this trigger executes when it should?

Top

Post #6     payne Jan 2 2011, 8:06 pm

[Avatar]
Addicted to SEN Games -Add more!-
offlinecontact
Rank: Veteran
Quote from Roy
Uh... You can't use (Last created actor) if you haven't created an actor. It's treated as a temporary local variable (I believe). Store that actor in a global variable when you create it and maybe that will fix the removal problem.

I suppose you have already confirmed that this trigger executes when it should?
So it means that the (Last created Actor) isn't the last created actor anymore but is rather empty when the trigger runs once again?

Top

Post #7     Roy Jan 2 2011, 8:33 pm

[Avatar]
An artist's depiction of an Extended Unit Death
onlinecontact
Rank: Veteran
Quote from payne
So it means that the (Last created Actor) isn't the last created actor anymore but is rather empty when the trigger runs once again?
Yeah, that's what I've concluded after playing with it a bit.

Top

Post #8     payne Jan 2 2011, 8:52 pm

[Avatar]
Addicted to SEN Games -Add more!-
offlinecontact
Rank: Veteran
Well somehow, the "Actor" variable type is a bitch and isn't considered as an Actor itself...

EDIT: Just tested the trigger a bit more.
Results:
- The region Crown does center on the new unit.
- This new unit isn't determined as I wanted: if a unit is created in the region, it is runs the event "Unit enters region", but if the unit is already placed on the map, it doesn't. Only exception: Player 1's Changeling. Somehow, a Player 1 Baneling that I hit with the Crown region centered on my Changeling will not even trigger a "failed condition". :/
- Still can't destroy this goddamn actor. >:O
This post was edited 1 time, last edit by payne: Jan 2 2011, 9:12 pm.

Top

Post #9     payne Jan 3 2011, 8:57 am

[Avatar]
Addicted to SEN Games -Add more!-
offlinecontact
Rank: Veteran
Solved: thanks to Soga!

New trigger:

Code

Near
   Events
       Unit - Any Unit Enters Crown
   Local Variables
   Conditions
       (Unit type of (Triggering unit)) == Changeling (Zergling)
   Actions
       Unit - Remove Thin Torus [49.00, 45.50] from the game
       Actor - Send message "Destroy Immediate" to actor Crown
       Variable - Set Crown_Holder = (Triggering unit)
       Region - Attach Crown to Crown_Holder with offset (Point(0.0, 0.0))
       Actor - Attach ShapeThinTorus (Unnamed) to Overhead on Crown_Holder
       Variable - Set Crown = (Actor for Crown_Holder)
       General - Pick each integer from 1 to 8, and do (Actions)
           Actions
               Variable - Set HasCrown?[(Picked integer)] = false
       Variable - Set HasCrown?[(Triggering player)] = true


Keys:
- "Actor - Send message "Destroy Immediate" to actor Crown"
- "Variable - Set Crown = (Actor for Crown_Holder)"
- "Crown" is an "Actor" type variable


ALSO: The Region wasn't big enough to detect if a unit would enter the region, which was kind of another huge bug preventing me from properly testing stuff. XD

Top
Topic Locked
Topic Locked
This topic has been locked!
Reason: solveed
Closed by: Ahli
0 members in this topic (italic members are currently writing a reply): None
+ guest(s)


[02:13 am]
O)FaRTy1billion -- "Zoan -- Oh, wow. How long have you guys known how to decipher that? lol" The very instant the timer appeared.
[01:44 am]
Ahli -- I don't know what Blizzard did with the latency improvement in Heroes of the Storm, but it's looks like magic to me... you don't feel any delay anymore...
[01:24 am]
ShadowFlare -- Looks like 2.02 is still the latest version - just connected to Battle.net to check. It is from around 2001, I think.
[01:18 am]
ShadowFlare -- But if it is a 2.0 disc, you probably will need it.
[01:18 am]
ShadowFlare -- *your
[01:18 am]
ShadowFlare -- If you disc came with 2.02 already, then it should be fine, though.
[01:14 am]
Excalibur -- That much I can probably handle. I can download the patch, bring it in on a usb and update everyone.
Please log in to shout.