Script related questions

Help regarding development/scripting, troubleshooting or just general gameplay -- anything that hasn't already been answered in the Wiki or pinned FAQs.

Moderator: Developers

User avatar
penguinflyer5234
Sheep (Developer)
Sheep (Developer)
Posts: 3025
Joined: Wed Jul 23, 2008 1:39 am
Location: Best Southwest

Post by penguinflyer5234 »

She is making a fountain...
So I think she means that there are lots of particles at the same time, but the die as well.
...
User avatar
penguinflyer2222
Queen Penguin (Senior Member)
Queen Penguin (Senior Member)
Posts: 6614
Joined: Wed Jul 23, 2008 1:51 am

Post by penguinflyer2222 »

Ok, I think it's like that already, but I didn't know it would keep going.
Thanks for your help.
......
User avatar
PurpleSquerkle
Massive Gelfeet (Developer)
Massive Gelfeet (Developer)
Posts: 3176
Joined: Wed Jul 23, 2008 4:54 am
Location: Oakland, CA
Contact:

Post by PurpleSquerkle »

Can someone help me with this script (it's for the Templar Hero Class)?

Code: Select all

IfSpawned
  tmpargument = 0
  SetState

IfUsed
  tmpargument = 0
  IfStateIs
    tmpargument = 0
    SpawnParticle
    tmpargument = 1
    SetState
  Else
    tmpargument = 1
    IfStateIs
      tmpargument = 4
      SpawnParticle
      tmpargument = 2
      SetState
    Else
      tmpargument = 4
      SpawnParticle
      tmpargument = 0
      SetState
It's supposed to spawn particle 0 the first time it's used, and then spawn particle 4 the next two times it's used, then go back to 0, etc.

But the way it is now, after it cycles through once, it spawns particle 0 EVERY time, as well as either particle 4 or ANOTHER particle 0.

Help?
bgbirdsey
{]-[0{0|307 (Developer)
{]-[0{0|307 (Developer)
Posts: 1864
Joined: Wed Jul 23, 2008 4:22 am
Location: Minnesota, USA

Post by bgbirdsey »

You can use the Set_XY and Get_XY functions to store variables in the script's memory.

[edit]I forgot to add some guard code to make sure that the spawning only happens once per use. Just changing the state could cause more than one of the particle to spawn. Since you only have 2 states, I just changed it to an Else.[/edit]

Code: Select all

IfUsed
  IfStateIs0
    tmpargument = 0
    SpawnParticle
    tmpargument = 1
    SetState

    tmpargument = 0         // reset the loop
    tmpx = 0                     //   initial counter
    tmpy = 2                     //  number of loops
    SetXY

  Else
    tmpargument = 4
    SpawnParticle

    tmpargument = 0
    GetXY
    IfXIsLessThanY
      tmpargument = 0         // increment the counter
      tmpx = 1
      tmpy = 0
      AddXY
    Else
      tmpargument = 0
      SetState

      tmpargument = 0         // reset the loop
      tmpx = 0                     //   initial counter
      tmpy = 0                     //  number of loops
      SetXY
you could use this format to program a large number of states and loops. Also, IfStateIsXX is defined for XX up to 15.

Code: Select all

IfSpawned
  tmpargument = 0         // set the initial IfUsed loop
  tmpx = 0                     //   initial counter
  tmpy = 1                     //  number of loops
  SetXY

  tmpargument = 0
  SetState

IfUsed

  tmpargument = 1         // set the "first time through" flag in slot 1
  tmpx = 1
  SetXY  

  IfStateIs0

    // guard code
    tmpargument = 1         // set the "first time through" flag in slot 1
    GetXY     
    tmpy = 0
    IfXIsEqualToY
      DoNothing
    Else
      tmpargument = 1         // clear the "first time through" flag in slot 1
      tmpx = 0
      SetXY      
    
      // do blah for state 0

      // loop control
      tmpargument = 0
      GetXY
      IfXIsLessThanY
        tmpargument = 0         // increment the counter
        tmpx = 1
        tmpy = 0
        AddXY
      Else
        tmpargument = 1
        SetState

        tmpargument = 0         // do the state 1 loop 5 times
        tmpx = 0
        tmpy = 5
        SetXY

  IfStateIs1

    // guard code
    tmpargument = 1         // set the "first time through" flag in slot 1
    GetXY     
    tmpy = 0
    IfXIsEqualToY
      DoNothing
    Else
      tmpargument = 1         // clear the "first time through" flag in slot 1
      tmpx = 0
      SetXY      
    
      // do blah for state 1

      // loop control
      tmpargument = 0
      GetXY
      IfXIsLessThanY
        tmpargument = 0         // increment the counter
        tmpx = 1
        tmpy = 0
        AddXY
      Else
        tmpargument = 2
        SetState

        tmpargument = 0         // do the state 2 loop 999 times
        tmpx = 0
        tmpy = 999
        SetXY

....

  tmpargument = "N"
  IfStateIs

    // guard code
    tmpargument = 1         // set the "first time through" flag in slot 1
    GetXY     
    tmpy = 0
    IfXIsEqualToY
      DoNothing
    Else
      tmpargument = 1         // clear the "first time through" flag in slot 1
      tmpx = 0
      SetXY      
    
      // do blah for state "N"

      // loop control
      tmpargument = 0
      GetXY
      IfXIsLessThanY
        tmpargument = 0         // increment the counter
        tmpx = 1
        tmpy = 0
        AddXY
      Else
        tmpargument = 0
        SetState

        tmpargument = 0         // do the state 0 loop 2 times
        tmpx = 0
        tmpy = 2
        SetXY

User avatar
PurpleSquerkle
Massive Gelfeet (Developer)
Massive Gelfeet (Developer)
Posts: 3176
Joined: Wed Jul 23, 2008 4:54 am
Location: Oakland, CA
Contact:

Post by PurpleSquerkle »

That's still not working. :?
It always spawns particle 0, even when it should just spawn particle 4.
:?

Also, another question:
How would I go about giving him bonus damage when using polearms?

The Archaeologist was supposed to have this with whips, but it was apparently never implemented.
bgbirdsey
{]-[0{0|307 (Developer)
{]-[0{0|307 (Developer)
Posts: 1864
Joined: Wed Jul 23, 2008 4:22 am
Location: Minnesota, USA

Post by bgbirdsey »

Does your script use SetXY for anything else?

That is a little funny. If it ever spawns particle 0, then it must set the state to state 1.
Cimeries
Lumberjack (Developer)
Lumberjack (Developer)
Posts: 7720
Joined: Wed Jul 23, 2008 6:56 am

Post by Cimeries »

PurpleSquerkle wrote: Also, another question:
How would I go about giving him bonus damage when using polearms?
I need this too for my Archer class. :?

The way I see it, there are two ways:
1. Either add a new function that checks if the holder scored a hit (which also adjusts to the hand that scored, for checking purposes).
or
2. Edit the script of every weapon he has a bonus with to include that extra damage.
:wink:
User avatar
PurpleSquerkle
Massive Gelfeet (Developer)
Massive Gelfeet (Developer)
Posts: 3176
Joined: Wed Jul 23, 2008 4:54 am
Location: Oakland, CA
Contact:

Post by PurpleSquerkle »

No, it doesn't ever use SetXY for anything else....
Does it have something to do with all the times it's setting the argument to zero for other purposes...?

If I can't get this to work, I had two other ideas:

1. It could spawn both particles every time, and just take more mana to use.
2. If you hold down the key and charge it up, it does effect 0, otherwise it does effect 4.

Option 2 is more appealing to me... how would I go about doing that?
Chainsaw wrote:...add a new function that checks if the holder scored a hit (which also adjusts to the hand that scored, for checking purposes).
Zefz already added this; it's even in the stable version.
But wouldn't that still require editing the scripts of all the individual weapons, as it checks if the holder scored a hit?
Cimeries
Lumberjack (Developer)
Lumberjack (Developer)
Posts: 7720
Joined: Wed Jul 23, 2008 6:56 am

Post by Cimeries »

Sorry, I meant 'if the weapon held scored a hit'. :P
:wink:
User avatar
Zefz
Squirrel Knight (Administrator)
Squirrel Knight (Administrator)
Posts: 3820
Joined: Wed Jul 23, 2008 1:27 am
Location: Norway
Contact:

Post by Zefz »

I've added the archaeologist damage bonus a while ago for using whips (not released yet though).

Code: Select all

//Archaeologist whip bonus damage
IfHeld
  tmpargument = [ARCH]
  IfTargetHasID
    IfHolderScoredAHit
      tmpargument = 512
      tmpdistance = DAMAGESLASH
      DamageTarget
Particle code something like this?:

Code: Select all

IfUsed
  tmpx = selfstate              //Use counter
  tmpy = 0
  IfXIsMoreThanY
    tmpargument = 4
    tmpy = 2                     //Used twice now
    IfXIsMoreThanY
      tmpargument = 0
      SetState                   //Reset!

  IfStateIs0                  //It has been reset
    tmpargument = 0

  SpawnParticle
  
  //Increase use count
  tmpargument = selfstate+1
  SetState
    
Cimeries
Lumberjack (Developer)
Lumberjack (Developer)
Posts: 7720
Joined: Wed Jul 23, 2008 6:56 am

Post by Cimeries »

Zefz wrote:

Code: Select all

//Archaeologist whip bonus damage
IfHeld
  tmpargument = [ARCH]
  IfTargetHasID
    IfHolderScoredAHit
      tmpargument = 512
      tmpdistance = DAMAGESLASH
      DamageTarget
That's very similar to what I had, but like in my script, there's this flaw:
Won't that give out bonus damage to any attack as long as a whip is held?
So one could hold a whip and use the other hand to attack, and he will still get the bonus damage for that other hand.

Also, will you consider changing the Archaeologist tags back to [ARCE] or whatever it was? Because [ARCH] was supposed to be the Archer's tag...
:wink:
User avatar
Zefz
Squirrel Knight (Administrator)
Squirrel Knight (Administrator)
Posts: 3820
Joined: Wed Jul 23, 2008 1:27 am
Location: Norway
Contact:

Post by Zefz »

No, not with the IfHolderScoredAHit as opposed to IfScoredAHit. I think I coded it that way at least.

IfHolderScoredAHit checks if the attack was made by Self. It also sets the target to the one last one who was hit by said attack.

We should test this by debugging, but I think soulcarver worked as it should while holding another melee weapon.
Cimeries
Lumberjack (Developer)
Lumberjack (Developer)
Posts: 7720
Joined: Wed Jul 23, 2008 6:56 am

Post by Cimeries »

So I had it figured out all that time... :bang:
:wink:
User avatar
HyugaNeji
Chest Mimic (Community member)
Chest Mimic (Community member)
Posts: 185
Joined: Thu Jul 24, 2008 4:07 pm
Location: Buenos Aires,Argentina

Post by HyugaNeji »

Hey guys, long time no see, please, help me with this:

Starting Egoboo 2.6.5b...
INFO: Initializing high-performance counter...
INFO: Frequency is 3579545 hz
INFO: Initializing clock services...
INFO: Initializing filesystem services...
INFO: Game directories are:
Game: D:\Seba\Egoboo
Temp: C:\DOCUME~1\ADMINI~1\CONFIG~1\Temp\
Save: D:\Mis documentos\egoboo\
Import: C:\DOCUME~1\ADMINI~1\CONFIG~1\Temp\import\
INFO: net_initialize: Networking not enabled.
WARN: Object is missing an skin (modules/zippy.mod/objects/light.obj/)!
NOTE: I am missing a AI script (modules/heist.mod/objects/tree.obj/script.txt)
Using the default AI script instead (basicdat/script.txt)
NOTE: I am missing a AI script (modules/heist.mod/objects/tree.obj/script.txt)
Using the default AI script instead (basicdat/script.txt)
NOTE: I am missing a AI script (modules/heist.mod/objects/tree.obj/script.txt)
Using the default AI script instead (basicdat/script.txt)
NOTE: I am missing a AI script (modules/bishopiacity.mod/objects/haypile.obj/script.txt)
Using the default AI script instead (basicdat/script.txt)
NOTE: I am missing a AI script (modules/bishopiacity.mod/objects/stool.obj/script.txt)
Using the default AI script instead (basicdat/script.txt)
NOTE: I am missing a AI script (modules/bishopiacity.mod/objects/table2.obj/script.txt)
Using the default AI script instead (basicdat/script.txt)
NOTE: I am missing a AI script (modules/bishopiacity.mod/objects/tree.obj/script.txt)
Using the default AI script instead (basicdat/script.txt)
SCRIPT ERROR: modules/palash.mod/objects/whip.obj/script.txt - DAMAGeSLASH undefined
INFO: Exiting Egoboo 2.6.5b the good way...
INFO: net_shutDown: Turning off networking.
bgbirdsey
{]-[0{0|307 (Developer)
{]-[0{0|307 (Developer)
Posts: 1864
Joined: Wed Jul 23, 2008 4:22 am
Location: Minnesota, USA

Post by bgbirdsey »

Change DAMAGeSLASH to DAMAGESLASH.

2.6.5c, anyone?
Post Reply