Hi!
I have a couple of problems...
For the first... This actor won't float in water. I throw him off into water and he falls... How do I make him float? I believe you've seen my "Thrustables". No?
Anyway... These things float, but the ball doesn't! Why do I make the ball an actor? Well, I tried to make it a thrustable, but things didn't work out well... I think it was the health.
Now, I throw this ball with the help of a COG...
Yes... Edited Thermals...
Now then... Ball falls off the edge, falls, hits floor and gets damaged. Damage>10, ball dies... Problem: removed doesn't catch the message and crashes the game. I set health to a billion and only go with the damaged message. Nothing. Ball seems imortal.
Problem: As you see, when I crouch and fire, I push the ball up & forwards. Like a jump. But now, when I rapidly click, I fly... How do I do so that I only 'jump' when I'm touching the ground.
/Edward
I have a couple of problems...
Code:
+ball1 none orient=(0/0/0) type=actor model3d=ball1.3DO size=0.025 movesize=0.025 soundclass=ball1.snd height=0.025 health=10 maxhealth=10 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
For the first... This actor won't float in water. I throw him off into water and he falls... How do I make him float? I believe you've seen my "Thrustables". No?
Code:
_thrustable none orient=(0.000000/0.000000/0.000000) type=debris collide=1 move=physics movesize=0.010000 surfdrag=1.000000 airdrag=0.000000 mass=25.000000 height=0.011000 physflags=0x105623 buoyancy=1.000000
Anyway... These things float, but the ball doesn't! Why do I make the ball an actor? Well, I tried to make it a thrustable, but things didn't work out well... I think it was the health.
Now, I throw this ball with the help of a COG...
Code:
# Jedi Knight Cog Script # # WEAP_THERMDET.COG # # WEAPON 4 Script - Thermal Detonator # # Fun to use and handy for clearing some elbow room. Not recommending # for those with noodle arms. The longer you hold down the fire key # (CTRL/Z) the farther you throw the detonator. # # The primary fire throws the detonator with the 3 second delay, the # secondary makes it explode on impact. # # - Not affected by MagSealed sectors/surfaces. # # [YB & CYW] # # (C) 1997 LucasArts Entertainment Co. All Rights Reserved # ======================================================================================== symbols model povModel=ball1.3do local model weaponMesh=ball1.3do local keyframe mountAnim=detvmnt.key local keyframe dismountAnim=detvdis.key local keyframe povFireAnim=detvpst1.key local keyframe prePOVThrowAnim=detvpre1.key local #keyframe preThrowAnim=kyrthro0.key local keyframe holsterAnim=kyhlstr.key local template projectile=+ball1 local template projectile2=+grenade2 local template beem=+line4 local template boom=+ball_exp_shatter local template damboom=+ball_exp local template indicator=+lightninghit local template layone=+seqchrg2 local sound throwSound=ThermalThrow01.wav local sound clickSound=ThermClick01.wav local sound clickSound2=ThermClick02.wav local sound loopSound=ThermLoop01.wav local sound shoot=LASER5.WAV local sound bounce=BOUNCE.wav local flex delayTime=1.0 local flex throwWait=0.8 local flex mountWait local flex autoAimFOV=10 local flex autoAimMaxDist=5 local flex holsterWait local thing player local int preThrowTrack local int selectTrack local int prePOVThrowTrack local int mode local int cocked=0 local int holsterTrack local int selectMode=1 local int out=0 local int i local thing marble=-1 local thing xx local vector lv local vector lvr local message startup message activated message deactivated message selected message deselected message autoselect message timer message newplayer message splash message pulse message removed message damaged message touched end # ======================================================================================== code startup: // Setup delays and variables. mountWait = GetKeyLen(mountAnim); preThrowTrack=-1; selectTrack=-1; prePOVThrowTrack=-1; Return; # ........................................................................................ 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); } } } else { If(out==0) { lv=VectorSub(GetThingPos(player),GetSectorCenter(GetThingSector(player))); lvr=VectorSet(-VectorX(lv),-VectorY(lv),-VectorZ(lv)); CreateThingAtPos(indicator,GetThingSector(player),GetSectorCenter(GetThingSector(player)),lvr); for(i=0; i<=GetNumSectorVertices(GetThingSector(player)); i=i+1) { lv=VectorSub(GetSectorVertexPos(GetThingSector(player), i),GetSectorCenter(GetThingSector(player))); lvr=VectorSet(-VectorX(lv),-VectorY(lv),-VectorZ(lv)); if(isthingcrouching(player)) { xx=CreateThingAtPos(layone,GetThingSector(player),GetSectorVertexPos(GetThingSector(player), i),lvr); } else { xx=CreateThingAtPos(projectile2,GetThingSector(player),GetSectorVertexPos(GetThingSector(player), i),lvr); } SetThingVel(xx,lvr); } } else { if(IsThingCrouching(player)) { FireProjectile(marble,layone,shoot,-1,'0 0 0','0 0 0',0,0x60,360,360); } else { CreateThing(boom,marble); out=0; SetCameraFocus(0,player); SetCameraFocus(1,player); DestroyThing(marble); } } } Return; # ........................................................................................ deactivated: player = GetSourceRef(); mode = GetSenderRef(); if(mode==0) { if(out==0) { delayTime = DeactivateWeapon(player, mode); // allow activated messages again. // Make sure both keys are up before continuing. if (GetCurWeaponMode() != -1) Return; // Set maximum scale factor (2 second hold.) if(delayTime > 2) delayTime = 2; // Set minimum scale factor if(mode == 0) { if(delayTime < 0.1) delayTime = 0.1; } if(preThrowTrack != -1 && prePOVThrowTrack != -1) { jkStopPOVKey(player, prePOVThrowTrack, 0); StopKey(player, preThrowTrack, 0); preThrowTrack = -1; prePOVThrowTrack = -1; } // Throw the appropriate detonator. SetPOVShake('0.0 -.003 0.0', '0.5 0.0 0.0', .05, 40.0); jkPlayPOVKey(player, povfireAnim, 1, 0x38); PlaySoundThing(throwSound, player, 1.0, 0.5, 2.5, 0x80); marble=FireProjectile(player, projectile, -1, 15, '0 0 0', '0 0 0', delayTime, 0x1, 0.0, 0.0); if(marble==-1) return; out=1; ChangeInv(player, 4, -1.0); SetMountWait(player, throwWait); // If out of ammo try to autoswitch to another weapon // if autoswitch is enabled else just switch to fists. if(GetInv(player, 4) < 1 && out==0) { if(GetAutoSwitch() & 1) { SelectWeapon(player, AutoSelectWeapon(player, 1)); } else { SelectWeapon(player, 1); } } jkSetWaggle(player, '0.0 0.0 0.0', 0); SetTimerEx(throwWait, 0, 0, 0); } } Return; # ........................................................................................ timer: if (GetSenderId() == 0) { // Start waggling after the throw. jkSetWaggle(player, '10.0 7.0 0.0', 350); } else if (GetSenderId() == 2) { StopKey(player, holsterTrack, 0.0); } Return; # ........................................................................................ selected: player = GetSourceRef(); SetPulse(0.01); jkSetWaggle(player, '10.0 7.0 0.0', 350); out=0; for(i=0; i<=GetThingCount(); i=i+1) { If(GetThingModel(i)==weaponMesh) DestroyThing(i); } // Play external mounting animation PlayMode(player, 40); // Setup the meshes and models. jkSetPOVModel(player, povModel); SetArmedMode(player, 0); jkSetWeaponMesh(player, weaponMesh); // Play the animation (NOLOOP + UNIQUE + ENDPAUSE). // The animation is held at the last frame after it is played. selectTrack = jkPlayPOVKey(player, mountAnim, 0, 0x14); SetMountWait(player, GetKeyLen(mountAnim)); // Clear Lightsaber flag, and enable activation messages. jkClearFlags(player, 0x5); SetCurWeapon(player, 4); SetMountWait(player, GetKeyLen(mountAnim)); Return; # ........................................................................................ deselected: player = GetSourceRef(); if(out==1) return; jkPlayPOVKey(player, dismountAnim, 0, 18); SetPulse(0.0); holsterWait = GetKeyLen(holsterAnim); SetMountWait(player, holsterWait); holsterTrack = PlayKey(player, holsterAnim, 1, 0x4); SetTimerEx(holsterWait, 2, 0.0, 0.0); if(selectTrack != -1) { jkStopPOVKey(player, selectTrack, 0); selectTrack = -1; } jkSetWaggle(player, '0.0 0.0 0.0', 0); KillTimerEx(0); if(preThrowTrack != -1 && prePOVThrowTrack != -1) { jkStopPOVKey(player, prePOVThrowTrack, 0); StopKey(player, preThrowTrack, 0); preThrowTrack = -1; prePOVThrowTrack = -1; } Return; # ........................................................................................ autoselect: selectMode = GetSenderRef(); player = GetSourceRef(); // If the player has ammo if(GetInv(player, 4) != 0) { // query for ammo if(selectMode == -1) { ReturnEx(400.0); Return; } if((selectMode == 0) && !(GetAutoPickup() & 2)) { ReturnEx(400.0); Return; } if((selectMode == 1) && !(GetAutoSwitch() & 2)) { ReturnEx(400.0); Return; } if((selectMode == 2) && !(GetAutoPickup() & 2)) { ReturnEx(400.0); Return; } ReturnEx(-2.0); Return; } else { ReturnEx(-1.0); } Return; # ........................................................................................ newplayer: if(preThrowTrack != -1 && prePOVThrowTrack != -1) { jkStopPOVKey(player, prePOVThrowTrack, 0); StopKey(player, preThrowTrack, 0); preThrowTrack = -1; prePOVThrowTrack = -1; } out=0; SetCameraFocus(0,player); SetCameraFocus(1,player); Return; # ........................................................................................ pulse: if(out==1) { SetCameraFocus(0,marble); SetCameraFocus(1,marble); SetThingLook(marble,GetThingLVec(player)); SetActorFlags(player,0x40000); if(IsInvActivated(player, 42)) { ThingLight(marble,1,0.1); } else { ThingLight(marble,0,0.1); } } else { SetCameraFocus(0,player); SetCameraFocus(1,player); ClearActorFlags(player,0x40000); } return; removed: If(GetSenderRef()==marble) { out=0; SetCameraFocus(0,player); SetCameraFocus(1,player); } return; damaged: If(GetSenderRef()==marble) { SetCameraFocus(0,player); SetCameraFocus(1,player); out=0; CreateThing(damboom,marble); destroyThing(marble); } return; touched: If(GetSourceRef()!=marble) return; If(GetSenderRef()!=player) return; DamageThing(GetSenderRef(),10,0x1,GetSourceRef()); return; end
Yes... Edited Thermals...
Now then... Ball falls off the edge, falls, hits floor and gets damaged. Damage>10, ball dies... Problem: removed doesn't catch the message and crashes the game. I set health to a billion and only go with the damaged message. Nothing. Ball seems imortal.
Problem: As you see, when I crouch and fire, I push the ball up & forwards. Like a jump. But now, when I rapidly click, I fly... How do I do so that I only 'jump' when I'm touching the ground.
/Edward