Staredit Network > Forums > SC2 Assistance > Topic: [SOLVED] Model attachment
[SOLVED] Model attachment
This topic is locked. You can no longer write replies here.
Dec 28 2010, 9:40 pm
By: payne  

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

:payne:

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.

Post has been edited 1 time(s), last time on Jan 3 2011, 8:58 am by payne.



None.

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



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).



None.

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

:payne:

I can only create a unit, not a model itself. And a variable cannot store a model.
This doesn't work. :(



None.

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

:payne:

I still need help over this, btw. :/



None.

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

An artist's depiction of an Extended Unit Death

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?




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

:payne:

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?



None.

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

An artist's depiction of an Extended Unit Death

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.




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

:payne:

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

Post has been edited 1 time(s), last time on Jan 2 2011, 9:12 pm by payne.



None.

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

:payne:

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



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[07:46 am]
RIVE -- :wob:
[2024-4-22. : 6:48 pm]
Ultraviolet -- :wob:
[2024-4-21. : 1:32 pm]
Oh_Man -- I will
[2024-4-20. : 11:29 pm]
Zoan -- Oh_Man
Oh_Man shouted: yeah i'm tryin to go through all the greatest hits and get the runs up on youtube so my senile ass can appreciate them more readily
You should do my Delirus map too; it's a little cocky to say but I still think it's actually just a good game lol
[2024-4-20. : 8:20 pm]
Ultraviolet -- Goons were functioning like stalkers, I think a valk was made into a banshee, all sorts of cool shit
[2024-4-20. : 8:20 pm]
Ultraviolet -- Oh wait, no I saw something else. It was more melee style, and guys were doing warpgate shit and morphing lings into banelings (Infested terran graphics)
[2024-4-20. : 8:18 pm]
Ultraviolet -- Oh_Man
Oh_Man shouted: lol SC2 in SC1: https://youtu.be/pChWu_eRQZI
oh ya I saw that when Armo posted it on Discord, pretty crazy
[2024-4-20. : 8:09 pm]
Vrael -- thats less than half of what I thought I'd need, better figure out how to open SCMDraft on windows 11
[2024-4-20. : 8:09 pm]
Vrael -- woo baby talk about a time crunch
[2024-4-20. : 8:08 pm]
Vrael -- Oh_Man
Oh_Man shouted: yeah i'm tryin to go through all the greatest hits and get the runs up on youtube so my senile ass can appreciate them more readily
so that gives me approximately 27 more years to finish tenebrous before you get to it?
Please log in to shout.


Members Online: lil-Inferno, C(a)HeK, Dem0n, No-Name-Needed-II