Playstationaryeffect

Get Help on scripting in POL with configurations, config setups, script trouble shooting, etc.

Moderator: POL Developer

Post Reply
Poi
Grandmaster Poster
Posts: 298
Joined: Fri Apr 14, 2006 9:36 am

Playstationaryeffect

Post by Poi »

Ok this code works.. just now how i want it to.. well right now it makes a line of fs's Sort of like this: \ I want it to look like an X and have a delay between each of them(So its sort of like a wave)
Ok its an + now, good enough. Now i just need delays and for it only to go once..

And i only want them to display once, they go like 9 times or so

Code: Select all

use uo;
include "include/client";
program textcmd_e1( who )
	PlayStationaryEffect( who.x+5, who.y-5, who.z, 0x3709, 0, loop := 0, explode := 0 );
	PlayStationaryEffect( who.x-5, who.y+5, who.z, 0x3709, 0, loop := 0, explode := 0 );
	PlayStationaryEffect( who.x-5, who.y-5, who.z, 0x3709, 0, loop := 0, explode := 0 );
	PlayStationaryEffect( who.x+5, who.y+5, who.z, 0x3709, 0, loop := 0, explode := 0 );

	PlayStationaryEffect( who.x+4, who.y-4, who.z, 0x3709, 0, loop := 0, explode := 0 );
	PlayStationaryEffect( who.x-4, who.y+4, who.z, 0x3709, 0, loop := 0, explode := 0 );
	PlayStationaryEffect( who.x-4, who.y-4, who.z, 0x3709, 0, loop := 0, explode := 0 );
	PlayStationaryEffect( who.x+4, who.y+4, who.z, 0x3709, 0, loop := 0, explode := 0 );

	PlayStationaryEffect( who.x+3, who.y-3, who.z, 0x3709, 0, loop := 0, explode := 0 );
	PlayStationaryEffect( who.x-3, who.y+3, who.z, 0x3709, 0, loop := 0, explode := 0 );
	PlayStationaryEffect( who.x-3, who.y-3, who.z, 0x3709, 0, loop := 0, explode := 0 );
	PlayStationaryEffect( who.x+3, who.y+3, who.z, 0x3709, 0, loop := 0, explode := 0 );

	PlayStationaryEffect( who.x+2, who.y-2, who.z, 0x3709, 0, loop := 0, explode := 0 );
	PlayStationaryEffect( who.x-2, who.y+2, who.z, 0x3709, 0, loop := 0, explode := 0 );
	PlayStationaryEffect( who.x-2, who.y-2, who.z, 0x3709, 0, loop := 0, explode := 0 );
	PlayStationaryEffect( who.x+2, who.y+2, who.z, 0x3709, 0, loop := 0, explode := 0 );

	PlayStationaryEffect( who.x+1, who.y-1, who.z, 0x3709, 0, loop := 0, explode := 0 );
	PlayStationaryEffect( who.x-1, who.y+1, who.z, 0x3709, 0, loop := 0, explode := 0 );
	PlayStationaryEffect( who.x-1, who.y-1, who.z, 0x3709, 0, loop := 0, explode := 0 );
	PlayStationaryEffect( who.x+1, who.y+1, who.z, 0x3709, 0, loop := 0, explode := 0 );

	PlayStationaryEffect( who.x, who.y, who.z, 0x3709, 0, loop := 0, explode := 0 );
	PlaySoundEffect(who,0xf8);
endprogram
User avatar
CWO
POL Expert
Posts: 1159
Joined: Sat Feb 04, 2006 5:49 pm
Location: Chicago, IL USA

Post by CWO »

PlayStationaryEffect( x, y1, z, 0x3709, 0x0a, 0x1e, 0);

thats the way mine looks like. It might work the way you want it. I have the same thing but CWO spelled out in flames. As for delays between them, just use Sleep(seconds); or Sleepms(milliseconds); ... Make sure to put USE OS; in your script too for the sleeps.
User avatar
tekproxy
Forum Regular
Posts: 352
Joined: Thu Apr 06, 2006 5:11 pm
Location: Nederland, Texas

Post by tekproxy »

Look up for loops... A good rule for programming is that you should never have to write the same code twice.

Try this:

Code: Select all

use uo; 

include "include/client"; 

program textcmd_e1( who ) 
  var i;
  
  for ( i := 5; i >= 1; i := i - 1 )
    PlayStationaryEffect( who.x + i, who.y + i, who.z, 0x3709, 0 ); 
    PlayStationaryEffect( who.x + i, who.y - i, who.z, 0x3709, 0 ); 
    PlayStationaryEffect( who.x - i, who.y + i, who.z, 0x3709, 0 ); 
    PlayStationaryEffect( who.x - i, who.y - i, who.z, 0x3709, 0 ); 
  endfor
   
  PlaySoundEffect( who, 0xf8 ); 
endprogram
The reason my code is spaced this way is because there used to be a post on the forums describing the standard way to space code, and that was how. If someone still has that post somewhere, I might on my old computer, they should post it. This function will only draw a big X made of fire around the player, which I don't think is what you wanted.


If you want to draw "waves" around them, try using the explosion FX and another for loop, like this:

Code: Select all

use uo; 
use os; // this is for sleep()

include "include/client"; 

program textcmd_e1( who ) 
  var i, n;
  
  for ( i := 5; i >= 1; i := i - 1 )
    // The second loop "draws" the explosions, one at a time
    for ( n := i; n >= -i; n := n - 1 )
      PlayStationaryEffect( who.x + n, who.y + i, who.z, FX_EXPLODE_3, 7, 0x10 ); // South west
      PlayStationaryEffect( who.x + n, who.y - i, who.z, FX_EXPLODE_3, 7, 0x10 ); // North east
      PlayStationaryEffect( who.x - i, who.y + n, who.z, FX_EXPLODE_3, 7, 0x10 ); // West
      PlayStationaryEffect( who.x + i, who.y - n, who.z, FX_EXPLODE_3, 7, 0x10 ); // East
    endfor

    // Play the sound effect and wait 5 seconds (if less, the SFX will not always play (perhaps only on my client))
    PlaySoundEffect( who, SFX_SPELL_EXPLOSION );
    sleep( 5 );
  endfor
   
  PlayStationaryEffect( who.x, who.y, who.z, FX_EXPLODE_3, 7, 0x10 ); // Ouch
  PlaySoundEffect( who, 0xf8 ); 
endprogram
I also threw in some code to play the sound effect. It waits 5 seconds in between each loop. This code will draw a box of FX_EXPLOSIONs around the player, 1 square closer every 5 seconds and then it will play an explosion on them.

You could put all of that code into a function that has some paramaters. The interval between waves, the distance the starting wave is from the player, the amount it gets closer every wave, the wave sound effect and graphic and the final sound effect and graphic. This way, you can put the code in an include somewhere and reuse it later.

Whenever you see this:

Code: Select all

function( variable := <default_value> )
For example, the definition of PlayStationaryEffect is this:

Code: Select all

PlayStationaryEffect( x, y, z, effect, speed, loop := 0, explode := 0 )
It means you do not have to pass a variable there, because it already has a default value assigned. In this case, they're both 0. Having your function have default values for paramaters is useful because it saves you from typing extra stuff since most of the time you'll never pass the loop or explode paramaters.
Poi
Grandmaster Poster
Posts: 298
Joined: Fri Apr 14, 2006 9:36 am

Post by Poi »

Thanks tek, but i got ir working, all i need to know is how do you make the character say something(I dont want this to be set in like their own macros.)(Thier refering to staff) al by waves i ment like:
one fs 5 tiles away, when its half way up, one 4 tiles away, when thats half way up the 5th one will be done and the 3rd one will start, ect, i got it working good enough for now though
User avatar
CWO
POL Expert
Posts: 1159
Joined: Sat Feb 04, 2006 5:49 pm
Location: Chicago, IL USA

Post by CWO »

If you want to have the script make the character say something then use

PrintTextAbove(who, "Put the text you want them to say here.");
Poi
Grandmaster Poster
Posts: 298
Joined: Fri Apr 14, 2006 9:36 am

Post by Poi »

Its a text command.(.concealme)
DevGIB
Grandmaster Poster
Posts: 248
Joined: Mon Feb 06, 2006 6:12 am

Post by DevGIB »

where you have the line

Code: Select all

program textcmd_e1( who ) 
change it to have the word text following who
e.g.

Code: Select all

program textcmd_e1( who, text ) 
then when you want to have them say what ever it is they say you put

Code: Select all

Printtextabove(who, text);
and the way they do it is to type

.concealme WOW LOOK AT ME GO

and what it will do is when it goes to print the text above them it will say

WOW LOOK AT ME GO
Post Reply