[GLOBAL] Looping random animations from array

Tutorials for all THUG+ games goes here.
Forum rules
This forum is only for posting tutorials.
Specify what game it is for, and please take a look at this Template.
Post Reply
Morten1337
Site Admin
Posts: 322
Joined: Mon Mar 01, 2010 2:23 pm
Location: Norway

[GLOBAL] Looping random animations from array

Post by Morten1337 » Tue Nov 16, 2010 3:07 pm

I'm gonna start posting some useful functions that people can use, and learn the basics of qb-scripting.

Code: Select all

:i %GLOBAL%$name$ = $Skater$
:i %GLOBAL%$name$.call $Obj_SpawnScript$ arguments 
		$PedSpawnerState_DoAnimsFromArray$$params$ = :s{$array$ = ($AnimArray_StandIdle$):s}

Code: Select all

:i $AnimArray_StandIdle$ = :a{
	:i $Ped_M_Idle1$
	:i $Ped_M_LookAtWatch$
	:i $Ped_M_Lookright$
	:i $Ped_M_LookLeftRight$
	:i $Ped_M_LookAround$
	:i $Ped_M_LookLeftDown$
	:i $Ped_M_LookAtWatch2$
	:i $Ped_M_Talk_RaiseArn$
:i :a}

Code: Select all

:i function $PedSpawnerState_DoAnimsFromArray$
		:i $GetArraySize$%GLOBAL%$array$
		:i while
			:i call $GetRandomValue$ arguments 
					$name$ = $value$$a$ = %i(0,00000000)$b$ = %GLOBAL%$array_size$$Resolution$ = %GLOBAL%$array_size$$Integer$
			:i %GLOBAL%$anim$ =  (%GLOBAL%$array$:a{%GLOBAL%$value$:a})
		
		:i call $Obj_PlayAnim$ arguments 
				$Anim$ = %GLOBAL%$anim$$BlendPeriod$ = %f(1.000000)
		:i $Obj_WaitAnimFinished$
		:i loop_to
:i endfunction

qwertysind
Posts: 117
Joined: Sun Mar 14, 2010 9:07 am

Re: [Function] "Loop random anims from array"

Post by qwertysind » Wed Nov 17, 2010 6:41 am

How can i make Array in Queen Bee?
I made SectionArray and which type of childs I have to add for Idle anims?

Morten1337
Site Admin
Posts: 322
Joined: Mon Mar 01, 2010 2:23 pm
Location: Norway

Re: [Function] "Loop random anims from array"

Post by Morten1337 » Wed Nov 17, 2010 10:58 am

I'm not sure about queenbee, but try to add QbKey/checksum type or something.

qwertysind
Posts: 117
Joined: Sun Mar 14, 2010 9:07 am

Re: [Function] "Loop random anims from array"

Post by qwertysind » Wed Nov 17, 2010 11:50 am

Ok, thx, i'll try to do it

%.gone.
Global Moderator
Posts: 390
Joined: Sun Mar 07, 2010 5:12 pm

Re: [Function] "Loop random anims from array"

Post by %.gone. » Wed Nov 17, 2010 12:58 pm

Queenbee is bugged and when creating a SectionArray they are only allowed one child.
I don't know why he would limit the functionality of the Array, but this is very much incorrect.
So in queenbee create a SectionArray then add an ArrayQbKey. All QbKeys would go in that one item.

qwertysind
Posts: 117
Joined: Sun Mar 14, 2010 9:07 am

Re: [Function] "Loop random anims from array"

Post by qwertysind » Sun Nov 21, 2010 3:30 am

Thx, I'll try it.
Morten, we are waiting for next tutorial :D

qwertysind
Posts: 117
Joined: Sun Mar 14, 2010 9:07 am

Re: [Function] "Loop random anims from array"

Post by qwertysind » Tue Dec 14, 2010 9:33 am

THAW Can't make this script work)

Post Reply