setweapon cmd

Topics regarding Scripting with Reality Factory
User avatar
darksmaster923
Posts: 1857
Joined: Wed Jan 03, 2007 10:32 pm
Location: Huntington Beach, California, USA

setweapon cmd

Post 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
Herp derp.
Jay
RF Dev Team
Posts: 1232
Joined: Fri Jul 08, 2005 1:56 pm
Location: Germany

Post 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?
Everyone can see the difficult, but only the wise can see the simple.
-----
User avatar
darksmaster923
Posts: 1857
Joined: Wed Jan 03, 2007 10:32 pm
Location: Huntington Beach, California, USA

Post 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
Herp derp.
User avatar
darksmaster923
Posts: 1857
Joined: Wed Jan 03, 2007 10:32 pm
Location: Huntington Beach, California, USA

RAAAAAAAAA!!!!!!!!!!

Post 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!!!!!!!!!
Herp derp.
User avatar
bernie
RF Moderator
Posts: 1249
Joined: Tue Nov 15, 2005 10:07 am
Location: Ireland

Post by bernie »

This is only a wild guess, but where is the bone in the weapon? Could it be in the wrong place perhaps?
User avatar
darksmaster923
Posts: 1857
Joined: Wed Jan 03, 2007 10:32 pm
Location: Huntington Beach, California, USA

Post by darksmaster923 »

no its in the right place
Herp derp.
User avatar
paradoxnj
RF2 Dev Team
Posts: 1328
Joined: Wed Mar 01, 2006 7:37 pm
Location: Brick, NJ
Contact:

Post by paradoxnj »

Do you have a screenshot of the problem?
User avatar
darksmaster923
Posts: 1857
Joined: Wed Jan 03, 2007 10:32 pm
Location: Huntington Beach, California, USA

Post by darksmaster923 »

Image
as you can see, the gun is floating above the intended point
Herp derp.
User avatar
LtForce
Posts: 437
Joined: Wed May 03, 2006 11:15 am
Location: Vilnius, Lithuania

Post by LtForce »

That would be most original game I've ever seen. You should leave it that way :D
Lithuanians for Georgia!
User avatar
Spyrewolf
Posts: 450
Joined: Tue Jul 05, 2005 4:53 am
Location: Wellington::New Zealand

Post 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?
User avatar
paradoxnj
RF2 Dev Team
Posts: 1328
Joined: Wed Mar 01, 2006 7:37 pm
Location: Brick, NJ
Contact:

Post 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?
User avatar
darksmaster923
Posts: 1857
Joined: Wed Jan 03, 2007 10:32 pm
Location: Huntington Beach, California, USA

Post by darksmaster923 »

im using the virgil skeleton
i attached the gun to BIP01 R HAND
Herp derp.
User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Post 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:
Pain is only psychological.
User avatar
darksmaster923
Posts: 1857
Joined: Wed Jan 03, 2007 10:32 pm
Location: Huntington Beach, California, USA

Post by darksmaster923 »

yea its the same... i even tried remaking it from scratch but no banana
Herp derp.
User avatar
paradoxnj
RF2 Dev Team
Posts: 1328
Joined: Wed Mar 01, 2006 7:37 pm
Location: Brick, NJ
Contact:

Post by paradoxnj »

Do you have a screenshot of your bone placements in your modelling application?
Post Reply