Page 1 of 2

setweapon cmd

Posted: Tue Jul 03, 2007 2:53 am
by darksmaster923
hey all, ive tried using the command SetWeapon in my bots, but it never ever works.
Bot Script

Code: Select all

{
	// Allied Bot Script Version 2 
	
	// VARIABLES

	SCALE			[1.4]		// Set the scale of the actor
	FOV			[150]		// Field of View aka FOV
	RUNSPEED		[300]		// How fast the bot runs
	WALKSPEED		[200]
	FIRSTPOINT		[NULL]
	SPAWNPOINT		[spawn_good]
	SPAWNPOINT2		[spawn_good2]
	GROUP			[Ally]

	// Death
	DIEHOLD			[4]
	
	// Health
	HEALTH			[100]
	HEALTHATTRIBUTE		[playerhealth]
	DAMAGEATTRIBUTE		[enemy_health]

	// Lost
	LOSTTIME		[10]
	SEARCHTIME		[5]

	// Animations
	Idle			[idle]
	Reload			[reload]
	Walk			[walk]
	Run			[run]
	Pain			[pain]
	Shoot			[shoot]
	Shootup			[shoot1]
	Shootdown		[shoot2]
	ShootStrafeRight	[ShootstrafeR]
	ShootStrafeLeft		[ShootstrafeL]
	DIE			[die]
	DIE2			[die2]

	// Weapons
	WEAPON1			[M16_bot]
	WEAP1MAG		[30]
	WEAPON2			[FAMAS_bot]
	WEAP2MAG		[25]
	WEAPON3			[AWP_BOT]	// Sniper Weapon
	WEAP3MAG		[10]
	WEAPON4			[MP7_BOT]
	WEAP4MAG		[30]
	WEAPON5			[ump_bot]
	WEAP5MAG		[25]
	CURRENTWEAPAMMO		[0]
	CURRENTWEAP		[NULL]
	ATTACKRANGE		[3000]
	SIGHTRANGE		[3400]
	RELOADTIME		[2]
	BULLET			[bad_shell]
	FIREBONE		[BIP01]
	WEAPON			[0]

	// Sounds
	Runsound		[breath.wav]
	Shootsound		[good.wav]
	Diesound		[speak/imdieing.wav]
	Diesound2		[death1.wav]
	Reloadsound		[weapon/rifle_reload.wav]
	RUNSOUNDDELAY		[0]

	// Target
	TargetX			[0]
	TargetY			[0]
	TargetZ			[0]
	

	// Functions
	DEATHORDER		[Death]
	PAINORDER		[hurted]
	ALERTORDER		[Alert]
	AVOIDORDER		[Avoid]
	FOUNDORDER		[FoundTarget]
	RUNORDER		[FollowTarget]
	LOSTORDER		[SearchTarget]
	lost_time		[0]
	exist			[0]
	run_sound_time		[0]
	nearestwall		[10000]
	nearestwalldir		[0]
	furthestwall		[0]
	furthestwalldir		[0]
	tmp			[0]

	Spawn[ ()
	{
		Console(true);
		AttributeOrder(HEALTHATTRIBUTE, HEALTH, DEATHORDER);
		Scale(SCALE);			
		SetFOV(FOV);			// Sets FOV
		AvoidOrder(AVOIDORDER);		// Avoid obsticles
		AddPainOrder(PAINORDER, 75 );	
		FIRSTPOINT = self.point_name;
		PlayAnimation(Idle, false, "");
		switch(random(1,5))		// lets bot choose between 5 weapons
		{
			case 1
			{
				SetWeapon("M16_bot");
				WEAPON = 1;			// Weapon Number. Used in Attack cmds.
				CURRENTWEAPAMMO = WEAP1MAG;
			}
			case 2
			{
				SetWeapon("FAMAS_bot");
				WEAPON = 2;			// Weapon Number. Used in Attack cmds.
				CURRENTWEAPAMMO = WEAP2MAG;
			}
			case 3
			{
				SetWeapon("AWP_BOT");		// Sets Sniping Weapon
				WEAPON = 3;			// Weapon Number. Used in Attack cmds.
				CURRENTWEAPAMMO = WEAP3MAG;
			}
			case 4
			{
				SetWeapon("MP7_BOT");
				WEAPON = 4;			// Weapon Number. Used in Attack cmds.
				CURRENTWEAPAMMO = WEAP4MAG;
			}
			case 5
			{
				SetWeapon("ump_bot");
				WEAPON = 5;			// Weapon Number. Used in Attack cmds.
				CURRENTWEAPAMMO = WEAP5MAG;
			}
		}
		if(random(1,10) < 5)
		{
			NewOrder("Patrol");
		}
		else
		{
			FindPointOrder("Patrol");
		}
	} ]

	Avoid[ ()
	{
		if(random(1,10) < 5)
		{
			MoveForward(Run, RUNSPEED, 100, Runsound);		// Runs forward
			MoveRight(Run, RUNSPEED, 100, Runsound );
			if(random(1,10) < 5)
			{
				SetFOV(360);
				FindPointOrder("Patrol");
			}
		}
		else
		{
			MoveForward(Run, RUNSPEED, 100, Runsound);		// Run forward
			MoveLeft(Run, RUNSPEED, 100, Runsound );
			if(random(1,10) < 5)
			{
				SetFOV(360);
				FindPointOrder("Patrol");
			}
		}
		Return();
	} ]	

	Patrol[ ()
	{
		SetFOV(FOV);
		AvoidOrder(AVOIDORDER);
		AddPainOrder(PAINORDER,100 );
		FindTargetOrder(SIGHTRANGE, FOUNDORDER, DAMAGEATTRIBUTE );
		RotateMoveToPoint(Run, RUNSPEED, RUNSPEED ,false, Runsound );	// Rotates to script point
		MoveToPoint(Run, RUNSPEED, Runsound );				// moves to script point
		NextPoint();
		RestartOrder();
	} ]
}
the Pawn.ini entries
;

Code: Select all

===
; pawn weapons
;===

[M16_bot]
actorname = m16_bot.act
actorrotation = 0 180 0
actorscale = 1
fillcolor = 255 255 255
ambientcolor = 255 255 255
type = weapon
environmentmapping = false
allmaterial = false 
percentmapping = 75
percentmaterial = 75

[FAMAS_bot]
actorname = famas_bot.act
actorrotation = 0 0 0
actorscale = 1
fillcolor =0 0 0
ambientcolor = 0 0 0
type = weapon

[AWP_BOT]
actorname = awp_bot.act
actorrotation = 0 0 0
actorscale = 1
fillcolor =0 0 0
ambientcolor = 0 0 0
type = weapon

[MP7_BOT]
actorname = mp7_bot.act
actorrotation = 0 0 0
actorscale = 1
fillcolor =0 0 0
ambientcolor = 0 0 0
type = weapon

[ump_bot]
actorname = ump_bot.act
actorrotation = 0 0 0
actorscale = 1
fillcolor =0 0 0
ambientcolor = 0 0 0
type = weapon

Posted: Tue Jul 03, 2007 6:08 pm
by Jay
Are you using the community release or the official release?

The community release has an additional parameter in the SetWeapon(...) command that is used for the 'slot' (ranges from 0-15) of the weapon.

Also, are the skeletons of the pawn and the weapon the same?

Posted: Tue Jul 03, 2007 6:38 pm
by darksmaster923
official

the skeletons are the same

edit//
okay i saw the weapons they were extremely small. I increased the scale but the gun was a few feet in front of the pawn

RAAAAAAAAA!!!!!!!!!!

Posted: Thu Jul 05, 2007 3:28 am
by darksmaster923
OMG! I have worked for hours, but the weapon will not align properly with the actor!
If i add a weapon to my pawn, the weapon is about 1 foot above where i put it. OMG! and moving the weapon model around doesn help. its like it doesnt want to connect properly. ARGHH!!!!!!!!!

Posted: Thu Jul 05, 2007 11:30 am
by bernie
This is only a wild guess, but where is the bone in the weapon? Could it be in the wrong place perhaps?

Posted: Thu Jul 05, 2007 6:47 pm
by darksmaster923
no its in the right place

Posted: Thu Jul 05, 2007 7:40 pm
by paradoxnj
Do you have a screenshot of the problem?

Posted: Thu Jul 05, 2007 7:59 pm
by darksmaster923
Image
as you can see, the gun is floating above the intended point

Posted: Thu Jul 05, 2007 9:44 pm
by LtForce
That would be most original game I've ever seen. You should leave it that way :D

Posted: Thu Jul 05, 2007 10:47 pm
by Spyrewolf
one thing that springs to mind is how high up in the 3d modeller is the gun situated, is it attached to the hand in the 3d modeller, it may be you need to re-export it? i'm not sure i've never seen this problem before?

Posted: Thu Jul 05, 2007 11:11 pm
by paradoxnj
It looks more like the bone that you attached to is in his head. What are the names of the actor's bones?

Posted: Fri Jul 06, 2007 3:13 am
by darksmaster923
im using the virgil skeleton
i attached the gun to BIP01 R HAND

Posted: Fri Jul 06, 2007 7:38 am
by Juutis
Are the skeletons for both the pawn and the weapon exactly the same? I had a similar problem because I had accidentally moved a bone in my model's leg a little.

Nice looking models, btw. :wink:

Posted: Fri Jul 06, 2007 7:02 pm
by darksmaster923
yea its the same... i even tried remaking it from scratch but no banana

Posted: Fri Jul 06, 2007 7:58 pm
by paradoxnj
Do you have a screenshot of your bone placements in your modelling application?