Pawn scripts

Topics regarding Scripting with Reality Factory
Allanon
Posts: 493
Joined: Mon Aug 29, 2005 8:23 am

Re: Pawn scripts

Post by Allanon » Fri Sep 09, 2016 5:58 pm

The colors variable definition at the top of the script is the colors the eyes will change to. You can add more to make the pattern you like. Maybe something like this:

Code: Select all

colors {[0][32][64][96][128][160][192][224][255][224][192][160][128][96][64][32]}
Also, self.ThinkTime is the time in seconds that the eyes will change.

Try this:

Code: Select all

{ 
   colors {[0][32][64][96][128][160][192][224][255][224][192][160][128][96][64][32]}
   index [0]

   Start[ () 
   {     
         Console(true);   
         Gravity(true);
         BoxWidth(22);
         BoxHeight(28);
         SetEventState("Skeleton_Generator_1_1_On", true);
         AttributeOrder("enemy_health", 10, "Destroyed");
         LowLevel("Glow");
   } ] 
      
   Glow[ ()    
   {   
         self.ThinkTime = 1.0;
         c = colors[index];
         SetEntityLighting("Skeleton_Generator_1_Eyes", 0, 0, 0, c, c, c, false);   
         index = index + 1;
         if (index = colors.numChildren)
         {
             index = 0;
         }
          
   } ] 
 
   Destroyed[ () 
   {    
       SetEventState("Skeleton_Generator_1_1_On", false);
       SetNoCollision();
       FadeOut(0.01,0);
       AddExplosion("SkeletonGeneratorExplosion", "BONE02", 0, 0, 0);
       LoopAnimation("Idle", 1.0, "");
       Remove(true);
   } ] 
}


Veleran
Posts: 891
Joined: Mon Aug 22, 2005 10:22 am
Location: Greece

Re: Pawn scripts

Post by Veleran » Sun Sep 11, 2016 12:29 pm

I set the glow speed to a faster rate self.ThinkTime = 0.1; and it animated smooth.
However,the pawn has now become indestructible.I hit it again and again and nothing happens to it.

Is the line

Code: Select all

 AttributeOrder("enemy_health", 10, "Destroyed");
in the start order ignored because it was in high level and now we are in low level or something else?

I know the ordering of the lines plays a role if you want all of them to be executed.
I do not know enough on the subject to decide what is with it.

Allanon
Posts: 493
Joined: Mon Aug 29, 2005 8:23 am

Re: Pawn scripts

Post by Allanon » Mon Sep 12, 2016 12:41 am

Try removing LowLevel("Glow"); then try causing damage to the actor. If you can then the order doesn't work when going to low level.

Veleran
Posts: 891
Joined: Mon Aug 22, 2005 10:22 am
Location: Greece

Re: Pawn scripts

Post by Veleran » Mon Sep 12, 2016 8:27 pm

That made it destroyable but the eyes never glowed again.

Allanon
Posts: 493
Joined: Mon Aug 29, 2005 8:23 am

Re: Pawn scripts

Post by Allanon » Mon Sep 12, 2016 9:29 pm

Try this:

Code: Select all

{ 
   colors {[0][32][64][96][128][160][192][224][255][224][192][160][128][96][64][32]}
   index [0]

   Start[ () 
   {     
         Console(true);   
         Gravity(true);
         BoxWidth(22);
         BoxHeight(28);
         SetEventState("Skeleton_Generator_1_1_On", true);
         AttributeOrder("enemy_health", 10, "Destroyed");
         LowLevel("Glow");
   } ] 

   Glow[ ()    
   {   
         if (self.health == 0)
         {
             HighLevel("Destroyed");
         }

         self.ThinkTime = 1.0;
         c = colors[index];
         SetEntityLighting("Skeleton_Generator_1_Eyes", 0, 0, 0, c, c, c, false);   
         index = index + 1;
         if (index = colors.numChildren)
         {
             index = 0;
         }
          
   } ] 
 
   Destroyed[ () 
   {    
       SetEventState("Skeleton_Generator_1_1_On", false);
       SetNoCollision();
       FadeOut(0.01,0);
       AddExplosion("SkeletonGeneratorExplosion", "BONE02", 0, 0, 0);
       LoopAnimation("Idle", 1.0, "");
       Remove(true);
   } ] 
}

Veleran
Posts: 891
Joined: Mon Aug 22, 2005 10:22 am
Location: Greece

Re: Pawn scripts

Post by Veleran » Tue Sep 13, 2016 2:21 pm

Glow Order - 0 Parse error near "".
No glowing,and it can not get destroyed.

Allanon
Posts: 493
Joined: Mon Aug 29, 2005 8:23 am

Re: Pawn scripts

Post by Allanon » Tue Sep 13, 2016 6:52 pm

Veleran wrote:Glow Order - 0 Parse error near "".
No glowing,and it can not get destroyed.
Sorry, remove the extra equal sign.

Change:

Code: Select all

         if (self.health == 0)
         {
             HighLevel("Destroyed");
         }
To:

Code: Select all

         if (self.health = 0)
         {
             HighLevel("Destroyed");
         }

Veleran
Posts: 891
Joined: Mon Aug 22, 2005 10:22 am
Location: Greece

Re: Pawn scripts

Post by Veleran » Wed Sep 14, 2016 12:34 pm

Now it can be destroyed but does not glow at all.
http://www.megafileupload.com/ojoN/Skel ... erator.act

Code: Select all

[Skeleton_Generator]
actorname = Dark Crypt\Environment\Monster Generators\Skeleton_Generator.act
actorrotation = -90 180 0
actorscale = 1.25
fillcolor =  0 0 0
ambientcolor =  0 0 0
subjecttogravity = false
stencilshadows = true

Allanon
Posts: 493
Joined: Mon Aug 29, 2005 8:23 am

Re: Pawn scripts

Post by Allanon » Wed Sep 14, 2016 7:18 pm

I tested this with your level and it seems to work. The problem was it was trying to execute the low level commands after I called the HighLevel command, exiting the order after calling HighLevel fixed the problem. I also changed "Skeleton_Generator_1_Eyes" to self.EntityName allowing this script to be used with any pawn.

Code: Select all


{ 
   colors {[0][32][64][96][128][160][192][224][255][224][192][160][128][96][64][32]}
   index [0]

   Start[() 
   {     
         Console(true);
         Gravity(true);
         BoxWidth(22);
         BoxHeight(28);
         SetEventState("Skeleton_Generator_1_1_On", true);
         AttributeOrder("enemy_health", 10, "Destroyed");
         LowLevel("Glow");

   }] 

   Glow[()    
   {   
         if (self.health = 0)
         {
             HighLevel("Destroyed");
             return;
         }
         self.ThinkTime = 0.1;
         c = colors[index];
         SetEntityLighting(self.EntityName, 0, 0, 0, c, c, c, false);     
         index = index + 1;
         if (index = colors.numChildren)
         {
             index = 0;
         }
   }] 
 
   Destroyed[() 
   {    
       SetEventState("Skeleton_Generator_1_1_On", false);
       SetNoCollision();
       FadeOut(0.01,0);
       AddExplosion("SkeletonGeneratorExplosion", "BONE02", 0, 0, 0);
       LoopAnimation("Idle", 1.0, "");
       Remove(true);
   }] 
}

Veleran
Posts: 891
Joined: Mon Aug 22, 2005 10:22 am
Location: Greece

Re: Pawn scripts

Post by Veleran » Thu Sep 15, 2016 12:40 pm

Whenever you can test the level because the eyes do not glow.
http://www.megafileupload.com/7xfl/Real ... _Crypt.rar
The file was originally 400mb and it compressed to less than half and i do not know why is that comparing to the previous upload which was smaller.
1-Sword , 2-Throwing dagger, 3-Throwing hammer.
The dungeon is slightly better,more debugged moving platforms going up and down can easily halt their movement when they collide a pawn like skeletons and that is why i removed a cage i had there.

I will try design the platform movement in another way,possibly horizontal animations and try moving platform pawn to make sure it will continue its movement after a pawn has gone out of the way.
The main reason i made the corridors so narrow was to keep the rooms close as possible,which each having different colors,influenced by the HeroQuest board design.

However i did not have the colorful floor textures and i put mostly corridors so far.

I did not have the time to make the hammer and throwing dagger visible at the hand so you know what you are using,neither i made the 1st person hand with the weapon because it would require weapon positioning which would take much time.
The level is designed for iso view because i thought there is not enough detail for close views.
I did not have any feedback on this yet,but i know the 3rd person is easy to control navigation but difficult to aim as it is settup now.
The 1st person possibly is the easiest to control but i am not sure yet if others will mind about the old graphics.

Tell me if there are any spots you get stuck too easily,and other big bugs like if the skeletons walk upon each other like a pyramid.
I could reduce their stepheight to 16.

The fireball explosion to the northern passage insists on shutting down the world.

Allanon
Posts: 493
Joined: Mon Aug 29, 2005 8:23 am

Re: Pawn scripts

Post by Allanon » Thu Sep 15, 2016 7:05 pm

Veleran wrote:Whenever you can test the level because the eyes do not glow.
You didn't add the last changes I made to the script. Also, are the eyes added to the level? In my last script I assumed that the lighting for the pawn was changing so I added self.EntityName in the SetEntityLighting() command. You can change it to "Skeleton_Generator_1_Eyes" when you add the eyes to the level.
The file was originally 400mb and it compressed to less than half and i do not know why is that comparing to the previous upload which was smaller.
You have a media.rar file added which has all the media assets.

I will look in to the other issues that you mentioned.

Veleran
Posts: 891
Joined: Mon Aug 22, 2005 10:22 am
Location: Greece

Re: Pawn scripts

Post by Veleran » Thu Sep 15, 2016 8:46 pm

If i understood well,there is not a second eyes pawn anymore.It would not spawn anyway because it was exactly at the same place with the other if i guess right.
The generator was exported along the eyes using a standard material for them,while the rest actor has normal map shading which prevents it from changing ambient and glow.
I would use entity names like Skeleton_Generator_1 ,2 and so on without an eyes prefix anymore.

I thought i pasted the script changes but it looks i did not.

I forgot about the media rar which was a test to see how big these folders were.

Allanon
Posts: 493
Joined: Mon Aug 29, 2005 8:23 am

Re: Pawn scripts

Post by Allanon » Thu Sep 15, 2016 9:21 pm

Veleran wrote:I would use entity names like Skeleton_Generator_1 ,2 and so on without an eyes prefix anymore.
If you use self.EntityName in the script then you can use any pawn name you like.

Veleran
Posts: 891
Joined: Mon Aug 22, 2005 10:22 am
Location: Greece

Re: Pawn scripts

Post by Veleran » Mon Sep 26, 2016 11:31 am

I d not know why but the skeleton generator explosion most of the time shows only the dust effect and does the sound without the bone scattering actor spray.
Could it be the total lifetime of it or another setting of the actor spray?I wonder.
Any suggestions welcome because i liked the effect of the flying bones.

Post Reply