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 → SetThingVel(When On Ground)
SetThingVel(When On Ground)
2004-03-09, 3:20 AM #1
Hi!
Code:
activated:
   player = GetSourceRef();
   mode = GetSenderRef();
   if (mode > 1)
      Return;

   PlaySoundThing(clickSound[mode], player, 1.0, -1.0, -1.0, 0x80);
if(mode==0)
{
	if(out==0)
	{
   if(GetInv(player, 4) < 1 && out==0)
   {
      if(GetAutoSwitch() & 1)
      {
         SelectWeapon(player, AutoSelectWeapon(player, 1));
      }
      else
      {
         SelectWeapon(player, 1);
      }
	return;
   }
   // Cock arm back for throw.
   if(preThrowTrack == -1 && prePOVThrowTrack == -1)
   {
      prePOVThrowTrack = jkPlayPOVKey(player, prePOVThrowAnim, 1, 0x14);
      preThrowTrack = PlayMode( player, 38 );
      ActivateWeapon(player, 0, mode);
   }
	}
	else
	{
		if(IsCrouching(player))
		{
			SetThingVel(marble,VectorAdd(GetThingLVec(marble),'0 0 1'));
			PlaySoundThing(bounce,marble,1,-1,10,0x80);
			PlaySoundLocal(bounce,1,0,0x0);
		}
		else
		{
			PlaySoundLocal(shoot,1,0,0x0);
			FireProjectile(marble,beem,shoot,-1,'0 0 0','0 0 0',0,0x60,360,360);
		}
	}
}

Help, how do I make the Italic code work, when marble is touching a surface. Marble looks like this:
Quote:
<font face="Verdana, Arial" size="2">
+ball1 none orient=(0/0/0) type=actor model3d=ball1.3DO size=0.025 movesize=0.025 soundclass=ball1.snd height=0.025 damageclass=0x1 damage=100 move=physics collide=1 vel=(0.000000/2.000000/1.500000) physflags=0x227 mass=2 airdrag=0 surfdrag=10 buoyancy=1 typeflags=0x100161 explode=+ball_exp cog=ball.cog
</font>

As it is now, the marble flies if I click fast enough. Please help!

/Edward

Oh, and also. How do I check to see if marble has collided with something. And specify if it is a thing or a surface...

[This message has been edited by Edward (edited March 09, 2004).]
[Fixed the horizontal scroll..]

[This message has been edited by GBK (edited March 11, 2004).]
Edward's Cognative Hazards
2004-03-09, 6:01 AM #2
Hmmm, no idea concerning your first problem. The second problem may be solved this way:
Code:
touched:
 toucher = GetSourceRef();
 type = GetThingType(toucher);
 return;

Not sure if it will work though, as the information in the datamaster is a bit confusing:
"The touched message is sent by an object when a thing touches it. It is not sent by the toucher, but by the object that was touched."

------------------
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2004-03-09, 7:14 AM #3
Try using "applyforce" instead of set thing velocity. It will look more realistic, if you're trying to do what I think.

First, though, you might also try reducing your surfacedrag in the template. It seems a bit high for such a small object, and affects an object touching a surface.

------------------
"Iron sharpeneth iron; so a man sharpeneth the countenance of his friend." - Proverbs 27:17

Catalog of Electronic Components - Complete IC data sheets
National Electrical Code (NEC) Online - Don't do wiring without consulting it. OR ELSE!
Catloaf, meet mouseloaf.
My music
2004-03-09, 8:42 AM #4
Nah, applyforce is not all that greate. I still jump in mid air, and if I click enough times, I speed up and fly. How do I do so that the marble only jumps when it is on the ground. Or touching a surface/thing.

And I added something in the touched message of the class COG:
Code:
# Ball Class
#
# By Edward
symbols

message		created
message		touched

thing		marble		local
thing		player		local

sound		pling=wlkrsht2.wav	local

end
#
code
created:
	player=GetSourceRef();
	marble=GetSenderRef();
return;
touched:
	If(GetSourceRef()!=marble) return;
	PlaySoundThing(pling,GetSenderRef(),1,-1,10,0x0);
	If(GetSenderRef()==player) return;
	DamageThing(GetSenderRef(),GetThingVel(GetSourceRef()),0x1,GetSourceRef());
return;
end

To test if it was working. Didn't hear a thing.

/Edward
Edward's Cognative Hazards
2004-03-09, 11:04 AM #5
Hmm, you could check it's attach flags. If the 0x1 flag isn't set, it's in the air, right?

------------------
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2004-03-09, 11:30 AM #6
Quote:
<font face="Verdana, Arial" size="2">Originally posted by zagibu:
Hmm, you could check it's attach flags. If the 0x1 flag isn't set, it's in the air, right?

</font>


Well, you see... The marble doesn't attach itself to any surfaces. It simply rolls over them. Like a grenade, only more slippery...

/Edward
Edward's Cognative Hazards
2004-03-09, 11:07 PM #7
Yeah, a real problem...

------------------
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2004-03-10, 10:04 AM #8
why not just create a new child template called +surfhit or something. Just copy/edit a template from one of the laser weapons, then remove everything BUT the sound. That way each time it hits something, bingo, a sound.

------------------
-There are easier things in life than finding a good woman, like nailing Jello to a tree, for instance

-Tazz
-There are easier things in life than finding a good woman, like nailing Jello to a tree, for instance

Tazz
2004-03-10, 10:27 AM #9
Put a "Print("blahbah");" command in the "touched" message to see if it's called. It shouldn't be be displayed, and thus, your code isn't executed, since "Touched" isn't called if the surface/thing that was touched has the floor flag set. Try "Entered" perhaps?

------------------
I am Darth Slaw.
The Dark Lord of the Sith,
And part of the Nightfire mod team

[This message has been edited by Darth Slaw (edited March 10, 2004).]
May the mass times acceleration be with you.
2004-03-10, 11:18 AM #10
Printing something in the touched message didn't work. Touched is not getting the message.
But the firing projectile thingy gave me a little idea on how to make the marble jump when on ground. Hm... Maybe, a +punch replica, only explosion is bigger, doesn't give damage, but gives a little force. Hm... I'll have to think about that one. Right now, bed time...
Edward's Cognative Hazards

↑ Up to the top!