Re: wepon
Posted: Sat Jun 18, 2011 12:23 am
is there a video tutorial of somthing that teaches me how to script a gun. video tutorial is better than a reading tutorial
how do i disable the 3d person view in the control.ini
That's what is was written for.QuestOfDreams wrote:Read the manual!
No, and I have already told you why:mabey than this script will work.
QuestOfDreams wrote:3rd person weapon actors must have the same skeleton as the 3rd person player actor.
QuestOfDreams wrote:Furthermore that actor has no animation named idle.
These should be enough hints for you to properly define a weapon. I won't write the correct definition here, as you won't learn anything if I'd do and you'll be stuck with the same problem again next time.QuestOfDreams wrote:If you still want to use that actor as 1st person weapon you will have to check which animations it has (use the ActView tool for that) and specify them in the weapon.ini file (where it now says idle).
How to adjust the rotations and offsets of 1st person weapons is described in the manual in detail.
Code: Select all
{
IDLE [gun_idle]
SHOOT [gun_shoot]
OFFSET_Y [75]
FIRERATE [0.5]
PROJECTILE [bullet]
FIREBONE [firebone]
DAMAGEATTRIBUTE [health]
firetimer [0]
Spawn[ ()
{
Gravity(false); // we don't want the gravity to affect this pawn
SetNoCollision(); // Don't collide with anything
LowLevel("setup_lowlevel"); // go to low level
} ]
setup_lowlevel[ ()
{
self.ThinkTime = 0;
self.yaw_speed = 10000; // make sure the pawn rotates fast enough
self.pitch_speed = 10000;
AnimateHold(IDLE); // play the idle animation
self.think = "idle"; // start executing "idle" order
} ]
idle[ ()
{
self.ThinkTime = 0; // execute this order every frame
if(self.animate_at_end) // if animation has finished, play it again
{
AnimateHold(IDLE);
}
PositionToPlayer(0,OFFSET_Y,0,false,false); // move with the player
self.ideal_yaw = self.player_yaw; // get the ideal rotation
self.ideal_pitch = self.camera_pitch;
ChangeYaw(); // rotate to match the rotation defined above
ChangePitch();
if(self.lbutton_pressed and (firetimer < self.time)) // if left mouse button is pressed and enough time has passed since the last shot
{
firetimer = self.time + FIRERATE; // set the delay to next shot
FireProjectileBlind(PROJECTILE,FIREBONE,0,0,0,DAMAGEATTRIBUTE); // shoot the projectile
AnimateHold(SHOOT); // play the shooting animation
}
} ]
}
Remove the definitions for the 3rd person weapon (the ones starting with player). Even better than disabling the 3rd person view via the control.ini file would be to force the viewpoint of this specific weapon to 1st person view by adding the forceviewto option to the weapon definition in the weapon.ini file (i.e. forceviewto = firstperson, see manual for details).since i disabled 3rd person view do i still need the 3rd person script?
You only need a script for a weapon if you want to have a different behaviour than the built in weapons provide. A "scripted weapon" in fact would mean that you will be using a Pawn as weapon.hi I have a script like this for my weapon. do i need it and where do i save it. its supposed to go with my weapon.
Code: Select all
;*********************************************************
; Mp40
;*********************************************************
[Mp40]
type = weapon
slot = 1
firerate = 0.01
catagory = projectile
projectile = pistol_shell
attribute = enemy_health
ammunition = pistol_shell
ammopershot = 1
shotpermagazine = 30
attacksound = Weapon\hmg.wav
reloadsound = Weapon\dryfire_rifle.wav
emptysound = Weapon\rifle_reload.wav
muzzleflash3rd = MuzzleFlash
;
; 1st person
;
viewactor = Weapon\Mp40.act
viewfillcolor = 255 255 255
viewambientcolor = 255 255 255
viewrotation = -52.0 82.0 4.0
viewoffset = 0.7 -38.80 6.0
viewscale = 0.61
viewlaunchoffset = 0 0 25
viewlaunchbone = Bip01 R Hand
viewanimationspeed = 1
viewarmanim = idle
viewidleanim = idle
viewattackanim = idle
viewaltattackanim = idle
viewhitanim = idle
viewalthitanim = idle
viewwalkanim = idle
muzzleflash = MuzzleFlash1
crosshair = crosshair.bmp
crosshairalpha = a_crosshair.bmp
crosshairfixed = false
allowlitcrosshair = true
crosshairlitcolor = 255 0 0
zoomamount = 2
zoomoverlay = zoomlow.bmp
zoomoverlayalpha = a_zoomlow.bmp
allowzoommove = false
recoilamount = 10
recoildecay = 5
bobamount = 10
viewreloadanim = idle
viewkeyreloadanim = idle
viewattackemptyanim = idle
environmentmapping = false
allmaterial = false
percentmapping = 0
percentmaterial = 0
check which animations it has (use the ActView tool for that) and specify them in the weapon.ini file (where it now says idle).
Code: Select all
;*********************************************************
; Mp40
;*********************************************************
[Mp40]
type = weapon
slot = 1
firerate = 0.01
catagory = projectile
projectile = pistol_shell
attribute = enemy_health
ammunition = pistol_shell
ammopershot = 1
shotpermagazine = 30
attacksound = Weapon\hmg.wav
reloadsound = Weapon\dryfire_rifle.wav
emptysound = Weapon\rifle_reload.wav
muzzleflash3rd = MuzzleFlash
;
; 1st person
;
viewactor = Weapon\Mp40.act
viewfillcolor = 255 255 255
viewambientcolor = 255 255 255
viewrotation = -53.8 90.3 3.2
viewoffset = 0.7 -38.80 6.0
viewscale = 0.61
viewlaunchoffset = 0 0 25
viewlaunchbone = Bip01 R Hand
viewanimationspeed = 1
viewarmanim = idle
viewidleanim = idle
viewattackanim = idle
viewaltattackanim = idle
viewhitanim = idle
viewalthitanim = idle
viewwalkanim = idle
muzzleflash = MuzzleFlash1
crosshair = crosshair.bmp
crosshairalpha = a_crosshair.bmp
crosshairfixed = false
allowlitcrosshair = true
crosshairlitcolor = 255 0 0
zoomamount = 2
zoomoverlay = zoomlow.bmp
zoomoverlayalpha = a_zoomlow.bmp
allowzoommove = false
recoilamount = 10
recoildecay = 5
bobamount = 10
viewreloadanim = idle
viewkeyreloadanim = idle
viewattackemptyanim = idle
environmentmapping = false
allmaterial = false
percentmapping = 0
percentmaterial = 0
;
; dropped weapon
;
dropactor = Weapon\Mp40.act
dropfillcolor = 255 255 255
dropambientcolor = 255 255 255
droprotation = 0 -90 0
dropoffset = -40.0 -60.0 35.0
dropscale = 2.0
dropgravity = false
drophidefromradar = true