Well, im not saying youre wrong, sry if i offended you.
I've tried it now but since i use an Entity (wich is a sphere) it doesent seem to work. Heres my code:
The one to create the Grenade:
And the one that updates the nades movement:
i not sure if the ThisNade\ThrowPower# that messes things up. Its when you release the 'g' key that the Greande is throwed, and depending how long the 'g'-key had been hold down the nade has different high speed.
The max is 100.0 though.
PLease help me i think im pretty close to solving it now. =)
Thanks
I've tried it now but since i use an Entity (wich is a sphere) it doesent seem to work. Heres my code:
The one to create the Grenade:
Function ThrowGrenade(GrenadeType,ThrowPower#) ThisNade.NadeType = New NadeType ThisNade\Ent = CreateSphere():EntityType ThisNade\Ent,COL_GRENADE ThisNade\DamagePower = 45.0 ThisNade\ThrowPower# = ThrowPower# ThisNade\State = 1 ThisNade\DetonateTimer# = 0.0 ThisNade\X# = EntityX(Weapon(CurrentWeapon)) ThisNade\Y# = EntityY(Weapon(CurrentWeapon)) ThisNade\Z# = EntityZ(Weapon(CurrentWeapon)) ThisNade\Yaw# = EntityYaw(Weapon(CurrentWeapon)) ThisNade\Pitch# = EntityPitch(Weapon(CurrentWeapon)) RotateEntity ThisNade\Ent,ThisNade\Pitch#,ThisNade\Yaw#,0 TFormVector 0,0,ThisNade\ThrowPower#,ThisNade\Ent,0 ThisNade\Vx# = TFormedX() ThisNade\Vy# = TFormedY() ThisNade\Vz# = TFormedZ() Select GrenadeType Case "Frag" EntityColor ThisNade\Ent,0,255,58 Case "Fire" EntityColor ThisNade\Ent,255,5,0 Case "Poison" EntityColor ThisNade\Ent,5,240,5 End Select ThisNade\ImpactDegree# = -EntityYaw(Player) ThisNade\MovingTimer# = MilliSecs() End Function
And the one that updates the nades movement:
Function Update_Grenade() For ThisNade.NadeType = Each NadeType If ThisNade\State = 1 Then If (MilliSecs() + 350.0 > ThisNade\MovingTimer#) Then ThisNade\X# = Float(ThisNade\X# + ThisNade\Vx# * ThisNade\MovingTimer#) ThisNade\Y# = Float(ThisNade\Y# + ThisNade\Vy# * ThisNade\MovingTimer#) ThisNade\Z# = Float((ThisNade\Z# + ThisNade\Vz# * ThisNade\MovingTimer#)); + ThisNade\ThrowPower#) PositionEntity ThisNade\Ent,ThisNade\X#,ThisNade\Y#,ThisNade\Z# If PositionY < 0.0 Then Vx = Vx * .9 Vy = - .75 * Vy Vz = Vz * .9 EndIf ThisNade\ThrowPower# = (ThisNade\ThrowPower# - 4.02) Else ThisNade\MovingTimer# = MilliSecs() EndIf If Abs(EntityX(ThisNade\Ent,1)) > 10000 FreeEntity ThisNade\Ent Delete ThisNade ElseIf Abs(EntityY(ThisNade\Ent,1)) > 10000 FreeEntity ThisNade\Ent Delete ThisNade ;delete the nade ElseIf Abs(EntityZ(ThisNade\Ent,1)) > 10000 FreeEntity ThisNade\Ent Delete ThisNade ElseIf ThisNade\ThrowPower# <= 0.0 Then ThisNade\ThrowPower# = 0.0 ThisNade\DetonateTimer# = MilliSecs() ThisNade\State = 2 EndIf ElseIf ThisNade\State = 2 Then TranslateEntity ThisNade\Ent,0,Gravity#,0 If MilliSecs() > (ThisNade\DetonateTimer# + 3000.0) Then DetonateNade(ThisNade\Ent) EndIf EndIf Next End Function
i not sure if the ThisNade\ThrowPower# that messes things up. Its when you release the 'g' key that the Greande is throwed, and depending how long the 'g'-key had been hold down the nade has different high speed.
The max is 100.0 though.
PLease help me i think im pretty close to solving it now. =)
Thanks