Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsCog Forum → Object Freeze
Object Freeze
2005-09-03, 2:22 PM #1
Is there a cog that makes an object (thing) freeze until a specified object (template) has been killed/destroyed.
Thanks!
2005-09-03, 2:33 PM #2
Writing one is pretty straightfoward. I don't remember cog well enough to write it for you on the spot but I'm sure someone will volunteer.
Dreams of a dreamer from afar to a fardreamer.
2005-09-04, 8:59 AM #3
The following should do decently. If I knew more about the thing you're trying to freeze, I could do it better.

Code:
symbols
thing killThing
thing freezeThing

message startup
message pulse
end
code
startup:
SetPulse(.001);
return;

pulse:
while(GetThingHealth(killThing)){
   StopThing(freezeThing);
}
return;
end
_ _ _____________ _ _
Wolf Moon
Cast Your Spell On Me
Beware
The Woods At Night
The Wolf Has Come
2005-09-05, 7:42 AM #4
thanks
2005-09-05, 5:10 PM #5
Actually I think that won't work, calling StopThing() once would just stop it till you move it again (I think). It would probably be smarter to use the killed message for the target object in order to take advantage of JK's event model. It's been a while since I've written anything but I think this should work

Code:
symbols

message startup
message killed
thing freezeThing
thing killThing

end

#------

code

stratup:
// freeze code (only necessary if the thing normally moves)
StopThing(freezThing);
return;

killed:
if (GetSender() == killThing)
{
// move code goes here, can't remember any useful functions
}

return;
end
[Code tags, please]
Dreams of a dreamer from afar to a fardreamer.
2005-09-05, 6:46 PM #6
No, StopThing(thing) has the equivalent effect of SetThingVel(thing, '0 0 0');
Gravity will still cause an acceleration, other things can still move (push) it, explosions too, etc.

Sniperwolf's code will (assumingly) cause no motion to occur in the thing that is frozen until the health of the other thing is 0, because it is continuously zeroing the velocity -- as a result, pushes, explosions, etc will not move it (far?)
May the mass times acceleration be with you.
2005-09-06, 1:12 PM #7
Using StopThing() in a pulse like that isn't the 'optimal' solution, since there's a small chance of it moving in between a pulse. The optimal solution is to use a ParseArg(freezeThing, "move=none"), while pulsing a StopThing. When whatever thing dies, ParseArg(freezeThing, "move=") where it would be move=physics or move=path.

(in experimentation, thrusts seem to still be applied to thing, with no visible effect, until the move is changed to a normal move again, at which point, it acts as one cumulative effect... Stop thing should clear that out...)
_ _ _____________ _ _
Wolf Moon
Cast Your Spell On Me
Beware
The Woods At Night
The Wolf Has Come
2005-09-06, 1:14 PM #8
I suggest thing flag 0x80000 ;)
2005-09-06, 2:06 PM #9
Originally posted by Fardreamer:
Actually I think that won't work, calling StopThing() once would just stop it till you move it again (I think). It would probably be smarter to use the killed message for the target object in order to take advantage of JK's event model. It's been a while since I've written anything but I think this should work]


It did nothing i just killed a stormtrooper and the object didn't freeze...
thanks again
2005-09-06, 2:23 PM #10
Of course it would help if you were a little more specific about the type of thing you want to affect. An actor? a static object moving on frames? a phsyics object?

About the 'cog' I posted, I didn't expect it to work (especially since you were suppoed to insert code where I placed a comment), I just wanted to illustrate the idea of using messages instead of pulses.
Dreams of a dreamer from afar to a fardreamer.
2005-09-06, 3:09 PM #11
If you're dealing with a physics object, you could set it's mass to some obscene value such as 9999999999999 and turn off it's gravity phys flag and flag it as "thing can fly". I think you need both for zero G to work properly on some things, but I don't remember. Actually I think all you need is the flight flag, the gravity flag doesn't seem to do much if I remember correctly.
Bassoon, n. A brazen instrument into which a fool blows out his brains.
2005-09-06, 6:13 PM #12
Originally posted by Emon:
If you're dealing with a physics object, you could set it's mass to some obscene value such as 9999999999999 and turn off it's gravity phys flag and flag it as "thing can fly". I think you need both for zero G to work properly on some things, but I don't remember. Actually I think all you need is the flight flag, the gravity flag doesn't seem to do much if I remember correctly.

Wait why would you want it to fly? And (I may be wrong) but in my tests(on an actor, not a thing), player mass only seems to make it hard to fall off ledges, and prevents ApplyForce from affecting the actor(No weapon recoil).
2005-09-06, 9:40 PM #13
Well, if it's ever off the ground, you want it flying so it can be frozen in place. The mass value of 999999 or such prevents forces from being at all significant.
Bassoon, n. A brazen instrument into which a fool blows out his brains.

↑ Up to the top!