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 → While waiting for help on the flex%? problem
While waiting for help on the flex%? problem
2005-01-14, 8:59 AM #1
Hi!
Why, in this COG, does the touched message, sort of react, but won't continue?
Code:
# Flipper
#
# By Edward
symbols

message		touched
message		entered
message		timer

surface		flip0	linkid=1,mask=-1
surface		flip1	linkid=1,mask=-1
surface		flip2	linkid=1,mask=-1
surface		flip3	linkid=1,mask=-1
surface		flip4	linkid=1,mask=-1
surface		flip5	linkid=1,mask=-1

sound		flips

flex		strength

vector		vec	local
int		i	local

end
#
code
entered:
touched:
	if(GetSenderID()!=1) return;
	KillTimerEx(4);
	for(i=0; i<6; i=i+1)
	{
		StopSurfaceAnim(flip0);
		SurfaceAnim(flip0, 16, 1);
	}
	PlaySoundThing(flips,GetSourceRef(),1,-1,-1,0);
	vec=GetThingVel(GetSourceRef());
	ApplyForce(GetSourceRef(),VectorScale(vec,strength));
	SetTimerEx(1,4,0,0);
return;
timer:
	if(GetSenderID()!=4) return;
	for(i=0; i<6; i=i+1)
	{
		StopSurfaceAnim(flip0);
		SetWallCel(flip0,0);
	}
return;
end

I send off a series of grenades, all moving at a 10th of their speed, created 0.01 seconds between, and only every 10-100 gets bounced off. Why is that?

/Edward
Edward's Cognative Hazards
2005-01-14, 10:30 AM #2
Is your Strength variable negative? If not, you're just telling it to go in the same direction but at Strength speed.
-Hell Raiser
2005-01-14, 11:36 AM #3
Exactly what I want. The problem is that it doesn't take all that touches within half a second. I set strength to 2, so there should be a noticable difference, but why only on some of them?
Edward's Cognative Hazards
2005-01-16, 12:14 PM #4
Can anyone help? Or is JK not as fast as I thought it was?
Edward's Cognative Hazards
2005-01-16, 12:34 PM #5
ApplyForce does not use JKUs. You must use something like at least 40 for strength to see anything noticeable.

You could instead try replacing ApplyForce with SetThingVel.

:)
2005-01-16, 1:26 PM #6
Doesn't ApplyForce take the target's mass into account? I thought the same force on different masses resulted in different end velocities, but I'm no longer sure of anything...
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2005-01-16, 2:19 PM #7
I do see a noticable difference with the grenades. Make a small levels, cleave a 0.1 x 0.1 x 0.1 box from the floor, give an animated mat to all, set the flips to the available surfaces on this little cube, then take weap_bryar.cog, change projectile to +grenade2 (remove timer and surf/airdrag) and set firewait to 0.01, run level, look at box, and fire a nice long line of grenades. You'll see that only 50 or so procent get the applied force. Now, change firewait to 0.25 and you'll see that all get the applied force. Please do, analyse, and help!

/Edward
Edward's Cognative Hazards
2005-01-16, 2:43 PM #8
The problem might be caused by the 'thread' limit of 5. Thus, sometimes, there are already 5 instances of the cog running when a grenade hits, so either the first instance of the cog is discarded, or the one that was instantiated with the new grenade is discarded (I don't know which).

:)

↑ Up to the top!