a variable for setsize?

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
kkcahdcakcyt
Sergeant
Posts: 71
Joined: Wed Aug 03, 2005 11:16 pm

a variable for setsize?

Post by kkcahdcakcyt »

I've been trying to have the setsize of a trigger change depending on the out come of a switch. I have a thread spawning the trigger and it calls to the thread "get_origin" for a random origin, by the use of the switch. I was hoping to have a different set size for different origins.

I've tried various ways but it hasn't work. I was trying this type of set up where level.size1 and level.size2 are defined differently in the switch.

get_origin:

switch (randomint(5)+1)
{
case 1:
level.origin = ( 200 500 10 )
level.size1 = "1 -1 -1"
level.size2 = "500 300 180"
break
...(same thing repeated for diff cases)
}
end level.origin //sent back to the thread asking for origin

//---------------------------------- skipping to trigger
spawn trigger_mulitple "targetname" "hill"
$hill.origin = thread get_origin
$hill setsize (level.size1) (level.size2)
$hill setthread trigger
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

post

Post by tltrude »

I can't see anything wrong with what you posted, but you might try putting the whole thing in each case.

case 1:
spawn trigger_mulitple targetname "hill"
$hill.origin = ( 200 500 10 )
$hill setsize ( 1 -1 -1 ) ( 500 300 180 )
$hill setthread trigger
break

I do see one flaw, There is a bug in scripting negitive numbers. There has to be a space between them and a bracket "( )".

So, this is wrong:

(1 -1 -1)

And this is right:

(1 -1 -1 )

It does not hert to use a space for positive numbers, so what I do is just put spaces for all bracketed numbers.

$hill setsize ( level.size1 ) ( level.size2 )
Tom Trude,

Image
kkcahdcakcyt
Sergeant
Posts: 71
Joined: Wed Aug 03, 2005 11:16 pm

Post by kkcahdcakcyt »

thanks! I got it working sadly not by using
$hill setsize ( level.size1 ) ( level.size2 )
But by repeating the spawing....looks ugly but it works :D
Post Reply