Script related questions
Moderator: Developers
- penguinflyer5234
- Sheep (Developer)
- Posts: 3025
- Joined: Wed Jul 23, 2008 1:39 am
- Location: Best Southwest
- penguinflyer2222
- Queen Penguin (Senior Member)
- Posts: 6614
- Joined: Wed Jul 23, 2008 1:51 am
- PurpleSquerkle
- Massive Gelfeet (Developer)
- Posts: 3176
- Joined: Wed Jul 23, 2008 4:54 am
- Location: Oakland, CA
- Contact:
Can someone help me with this script (it's for the Templar Hero Class)?
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?
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
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?
-
- {]-[0{0|307 (Developer)
- Posts: 1864
- Joined: Wed Jul 23, 2008 4:22 am
- Location: Minnesota, USA
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]
you could use this format to program a large number of states and loops. Also, IfStateIsXX is defined for XX up to 15.
[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
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
- PurpleSquerkle
- Massive Gelfeet (Developer)
- Posts: 3176
- Joined: Wed Jul 23, 2008 4:54 am
- Location: Oakland, CA
- Contact:
I need this too for my Archer class.PurpleSquerkle wrote: Also, another question:
How would I go about giving him bonus damage when using polearms?
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.
- PurpleSquerkle
- Massive Gelfeet (Developer)
- Posts: 3176
- Joined: Wed Jul 23, 2008 4:54 am
- Location: Oakland, CA
- Contact:
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?
But wouldn't that still require editing the scripts of all the individual weapons, as it checks if the holder scored a hit?
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?
Zefz already added this; it's even in the stable version.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).
But wouldn't that still require editing the scripts of all the individual weapons, as it checks if the holder scored a hit?
- Zefz
- Squirrel Knight (Administrator)
- Posts: 3820
- Joined: Wed Jul 23, 2008 1:27 am
- Location: Norway
- Contact:
I've added the archaeologist damage bonus a while ago for using whips (not released yet though).
Particle code something like this?:
Code: Select all
//Archaeologist whip bonus damage
IfHeld
tmpargument = [ARCH]
IfTargetHasID
IfHolderScoredAHit
tmpargument = 512
tmpdistance = DAMAGESLASH
DamageTarget
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
That's very similar to what I had, but like in my script, there's this flaw:Zefz wrote:Code: Select all
//Archaeologist whip bonus damage IfHeld tmpargument = [ARCH] IfTargetHasID IfHolderScoredAHit tmpargument = 512 tmpdistance = DAMAGESLASH DamageTarget
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...
- Zefz
- Squirrel Knight (Administrator)
- Posts: 3820
- Joined: Wed Jul 23, 2008 1:27 am
- Location: Norway
- Contact:
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.
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.
- HyugaNeji
- Chest Mimic (Community member)
- Posts: 185
- Joined: Thu Jul 24, 2008 4:07 pm
- Location: Buenos Aires,Argentina
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.
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.