Page 1 of 2

Friendly help..

Posted: Thu May 12, 2005 11:07 am
by Mj
Ok, I have some friends (lol) who like to scrash my game :(

Here is the problematic part - (the entire script is about 950 lines long now)

They keep crashing! And if i set the barneynames when I spawn them, they do not respond to commands :? Even changing them to level.friendly1 + 2 didnt help :(

Help!

Code: Select all

allieddude:

iprintlnbold "Gogo alliedguy1"

thread Halftracksetup

	local.speaker = spawn human/1st-ranger_lieutenant.tik
	local.speaker hide
	local.speaker say dfr_M3L3_352c
	local.speaker waittill saydone
	local.speaker remove

wait .1

	level.lt = spawn human/1st-ranger_lieutenant.tik
	level.lt.origin = $alliedwallscale1
//	level.lt.angles = $alliedwallscale1
		
	level.lt noticescale 100
	level.lt mindist 0
	level.lt maxdist 1000
	level.lt leash 10000
//	level.lt gun "MP40"
	level.lt.accuracy= 30
	level.lt.health = 300

	level.lt exec global/disable_ai.scr
	level.lt notsolid
//	level.lt say dfr_M3L3_352c
//	level.lt waittill saydone
		
	level.lt anim_noclip wallscale
	level.lt waittill animdone
		
	level.lt solid
	level.lt exec global/enable_ai.scr

	level.lt runto alliedguynode2
//	level.lt = level.friendly2

wait .1

thread allieddude2

end


Halftracksetup:

	$halftrack_gunner show
	$halftrack show
	$halftrack solid

$doorwalls notsolid
$dooropenl notsolid
$dooropenl show

$dooropenr notsolid
$dooropenr show

$doorclosedl notsolid
$doorclosedl hide

$doorclosedr notsolid
$doorclosedr hide

thread halftrack_ambush

iprintlnbold "HalftrackGoGo!"

end


allieddude2:

iprintlnbold "Gogo alliedguy2"

wait 1

	level.sgt = spawn human/1st-ranger_sergeant.tik
	level.sgt.origin = $alliedwallscale2
//	level.sgt.angles = $alliedwallscale2
		
	level.sgt noticescale 100
	level.sgt mindist 0
	level.sgt maxdist 1000
	level.sgt leash 10000
	level.sgt gun "thompson"
	level.sgt.accuracy= 20
	level.sgt.health = 300
//	level.sgt targetname $sgt

	level.sgt exec global/disable_ai.scr
	level.sgt notsolid
		
	level.sgt anim_noclip wallscale
	level.sgt waittill animdone
		
	level.sgt solid
	level.sgt exec global/enable_ai.scr

	level.sgt runto alliedguynode
	level.sgt lookAt $player

//	level.sgt = level.friendly1

wait .1

thread alliestalk

end

alliestalk:

iprintlnbold "speaking..."

	level.sgt lookat $player
	level.lt lookat $player

	level.sgt say dfr_M3L3_356c	//"Sergeant Harrison, Pathfinders, 101st."
	level.sgt waittill saydone
	level.sgt say dfr_m3l3_idle
wait .1

thread followtheleader

end

followtheleader:

//set barneynames and such

	level.sgt.friendtype = 1
	level.sgt thread global/friendly.scr::friendlythink
	level.sgt.destination = $player
	level.sgt.distance = 150


	level.lt.friendtype = 1
	level.lt thread global/friendly.scr::friendlythink
	level.lt.destination = $player
	level.lt.distance = 100


	level.sgt = level.friendly1
	level.lt = level.friendly2

end
Thanks,

Mj

Re: Friendly help..

Posted: Thu May 12, 2005 11:53 am
by Rookie One.pl
Mj wrote: level.lt.origin = $alliedwallscale1
// level.lt.angles = $alliedwallscale1
Cannot cast entity to type vector.
Mj wrote: level.lt runto alliedguynode2
// level.lt = level.friendly2
Run to what?
Mj wrote: level.sgt.origin = $alliedwallscale2
// level.sgt.angles = $alliedwallscale2
Again, cannot cast entity to type vector.
Mj wrote: level.sgt runto alliedguynode
Again... Run to what?

Posted: Thu May 12, 2005 12:22 pm
by Mj
The spawning and the runto's all work perfectly... :?

They do follow me - until they see an enemy, they they crash as the friendly.scr casts them as null... or something incomprehensible like that!

Posted: Thu May 12, 2005 6:09 pm
by lizardkid
holy shit... this is why i hate that sort of spawning, spawning two htings takes 900000 lines...

half that stuff is uneeded, already defaul set. accuracy, noticescale etc.

as to the real problem, name them $friendly1 and $friendly2 etc. i believe friendly.scr requires that...

Posted: Thu May 12, 2005 6:24 pm
by Mj
I tried that to no avail :(

I think I'll just make them run out infront of the halftrack and die :twisted:

<--- n00b scripter :oops:

Almost finished, final script = about 1300 lines :?

Its my crappy spawning technique :P

Posted: Thu May 12, 2005 9:42 pm
by bdbodger
If you are useing the global/friendly.scr then you need to name them all $friendly and give them a key:fnum value:1 to the number of friendlies you have . ie the first one is fnum 1 the second friendly is fnum 2 etc then exec the global/friendly.scr it will make the guy who is fnum 1 level.friendly1 etc etc

Posted: Thu May 12, 2005 9:44 pm
by Mj
level.friendly = spawn human/1st-ranger_lieutenant.tik
level.friendly.origin = $alliedwallscale1

level.friendly.accuracy= 30
level.friendly.health = 300
level.friendly fnum 1

level.friendly exec global/disable_ai.scr
level.friendly notsolid

level.friendly anim_noclip wallscale
level.friendly waittill animdone

level.friendly solid
level.friendly exec global/enable_ai.scr

level.friendly runto alliedguynode2

Ye think that would work?

Posted: Thu May 12, 2005 9:50 pm
by bdbodger
you posted while I was editing my post read my post again

Posted: Fri May 13, 2005 10:01 am
by bdbodger
One other thing why are you spawning them is this single player or multi ?
For the global/friendly.scr to work right you need a map with pathnodes and some of them need to have the targetname friendlynode or something like that spaced through out the map every so often , ones at the beginning of the map with a low set number and ones at the end of the map with a higher set number . There is lots of info written at the top of the global/friendly.scr . Also the friendly.scr uses commands to follow the player but they won't work very well in multi .

Posted: Fri May 13, 2005 11:32 am
by Mj
Its single player, and I am making them jump over some sandbags using the wallscale thing... I've fixed the problem by making them run out infront of the halftrack :twisted:

Thanks for your help anyway :)

Posted: Fri May 13, 2005 9:10 pm
by bdbodger
Ok I see well then you aren't useing the global/friendly.scr the level.friendly part made me think you where .

Posted: Fri May 13, 2005 9:42 pm
by Mj
I was trying... but whatever i did to try and make them follow me made them crash :(

Posted: Sat May 14, 2005 10:10 am
by bdbodger
I see well it is not that hard really all you need to do is make the friendly nodes not spaced too close together and lots of regular nodes . make sure that you give the friendlynodes set numbers starting at 10 and then going up by 10 . Make your ai all with the targetname friendly and the key fnum 1 for the first ai then 2 for the second ai etc etc then

Before level waittill spawn "exec global/friendly.scr".

when you are ready for them to follow you you do like it says in the friendly.scr
// When you want to turn on the friendly AI, do "level.friendly# thread global/friendly.scr::friendlythink".
// Afterwards you can set his friendtype like this: level.friendly#.friendtype = 1.

basically that is it they should work but if you are trying to spawn them then they have to be in the map before you exec the friendly.scr . They should follow you without you haveing to do any more scripting . You might want to set thier min,max,distance and waittime (they determine how close he has to get to nodes before he goes for his next node and how long he waits at each node before following the player).

Posted: Sat May 14, 2005 10:50 am
by Mj
Wow, thats really helpful of you!

Thanks alot! :D

I'll see what I can do with my new knowledge :wink:

Posted: Sat May 14, 2005 7:01 pm
by Mj
Thanks alot, it worked a treat :D

(it was putting .waittime that fixed it)