- Site Map >
- Modding and Creation >
- Sims 3 Creation >
- Modding Discussion >
- How to add interaction on created GameObject?
- Site Map >
- Modding and Creation >
- Sims 3 Creation >
- Modding Discussion >
- How to add interaction on created GameObject?
Replies: 0 (Who?), Viewed: 627 times.
#1
10th Oct 2014 at 9:31 PM
Posts: 133
Thanks: 1494 in 13 Posts
How to add interaction on created GameObject?
Hi.I want to create GameObject
Code:
ResourceKey rk = new ResourceKey(); rk = ResourceKey.Parse("0x319E4F1D-0x58000000-0x000000000098D11C"); Vector3 v3 = this.Actor.Position; v3.y = v3.y + 1f; Vector3 v3_1 = this.Actor.Position; v3_1.x = v3_1.x + 1f; GameObject gmStatic = GlobalFunctions.CreateObject(rk, v3, 0, v3_1) as GameObject; gmStatic.SetPosition(this.Actor.Position);
and add interaction for him
Code:
gmStatic.AddInteraction(AnimateBit.Singleton); foreach (GameObject gm in Sims3.Gameplay.Queries.GetObjects<GameObject>()) { if (gm != null) { gm.AddInteraction(AnimateBit.Singleton); } }
Code:
using Sims3.Gameplay; using Sims3.Gameplay.Abstracts; using Sims3.Gameplay.Actors; using Sims3.Gameplay.ActorSystems; using Sims3.Gameplay.Autonomy; using Sims3.Gameplay.Core; using Sims3.Gameplay.Interactions; using Sims3.Gameplay.Interfaces; using Sims3.Gameplay.ObjectComponents; using Sims3.Gameplay.Objects.Decorations; using Sims3.Gameplay.Routing; using Sims3.SimIFace; using Sims3.UI; using System; using System.Collections.Generic; using System.Text; namespace YourNameSpaceHere { internal sealed class AnimateBit : Interaction<Sim, GameObject> { public static readonly InteractionDefinition Singleton = new Definition(); protected override bool Run() { base.Actor.ShowTNSIfSelectable(" Animate!!!", StyledNotification.NotificationStyle.kSimTalking); StateMachineClient stateMachineClient = StateMachineClient.Acquire(this.Target, "single_animation"); stateMachineClient.SetActor("x", this.Target); stateMachineClient.EnterState("x", "Enter"); stateMachineClient.SetParameter("AnimationClip", "a_han_2"); stateMachineClient.RequestState("x", "Animate"); return true; } [DoesntRequireTuning] private sealed class Definition : InteractionDefinition<Sim, GameObject, YourNameSpaceHere.AnimateBit> { protected override string GetInteractionName(Sim a, GameObject target, InteractionObjectPair interaction) { return "AnimateBit_!"; } protected override bool Test(Sim a, GameObject target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { // if (a == target) return false; return true; } } } }
In this case golfclub (bit) created, but there are no interaction added for him - no reaction on mouse over.
Where is mistake?
Attached files:
a_waving6.zip (9.6 KB, 3 downloads) - View custom content | ||||||||||
12029 10-11-2014 00:20 a_waving6.package --------- ------- 12029 1 file |
Who Posted
|