I'm working on an update for Dreg Sector that addresses some of the community's complaints, but I need some help.
I want to make a spell that disables random encounters for certain number of steps. I've found the "suspend random enemies" command, but I'm not quite sure how to create a loop that counts a certain number of steps before activating "resume random enemies".
spell that reduces encounter rate
Moderators: Bob the Hamster, marionline, SDHawk
- Willy Elektrix
- Liquid Metal Slime
- Posts: 910
- Joined: Sun Aug 15, 2010 11:30 pm
- Willy Elektrix
- Liquid Metal Slime
- Posts: 910
- Joined: Sun Aug 15, 2010 11:30 pm
I've come into another problem. How do I make a spell that can only be triggered outside of combat? Is this even possible?
Likewise, I don't think I can make a spell that triggers a script. I would prefer to have this effect be a spell rather than an item if at all possible.
Likewise, I don't think I can make a spell that triggers a script. I would prefer to have this effect be a spell rather than an item if at all possible.
Last edited by Willy Elektrix on Tue Mar 19, 2013 1:11 am, edited 1 time in total.
Spells can't directly trigger scripts, and you can't set a spell to only be usable out of batle.
But I can think of really convoluted ways to achieve both: for the first, set aside one of the stats and have the spell increase that stat (this means the hero target picker comes up though). Have a script run after using the spells menu and check that stat. For the other, have the spell cost an item and use an instead of battle script to remove that item for the duration of each battle.
I'm not expecting you to follow this crazy plan. A much much better idea is to implement this in the engine. (I am not promising anything)
But I can think of really convoluted ways to achieve both: for the first, set aside one of the stats and have the spell increase that stat (this means the hero target picker comes up though). Have a script run after using the spells menu and check that stat. For the other, have the spell cost an item and use an instead of battle script to remove that item for the duration of each battle.
I'm not expecting you to follow this crazy plan. A much much better idea is to implement this in the engine. (I am not promising anything)
- Willy Elektrix
- Liquid Metal Slime
- Posts: 910
- Joined: Sun Aug 15, 2010 11:30 pm
I guess I'm doing this as an item rather than a spell. Here is the script I came up with.
The script "step" is run each time the hero moves. The script "radar" is done when the hero activates the item. Unfortunately, the script "radar" freezes when it runs, because it's stuck inside of its do loop infinitely. When I wrote the script, I assumed the hero could still be moved while the loop operated. How do I make this work?
plotscript, radar, begin
suspend random enemies
stepcount := 0
while (stepcount <= 29) do (
)
show text box (382)
wait for text box
resume random enemies
end
plotscript, step, begin
increment (stepcount,1)
end
The script "step" is run each time the hero moves. The script "radar" is done when the hero activates the item. Unfortunately, the script "radar" freezes when it runs, because it's stuck inside of its do loop infinitely. When I wrote the script, I assumed the hero could still be moved while the loop operated. How do I make this work?
plotscript, radar, begin
suspend random enemies
stepcount := 0
while (stepcount <= 29) do (
)
show text box (382)
wait for text box
resume random enemies
end
plotscript, step, begin
increment (stepcount,1)
end
I'd decrement instead, and put the work in the stepping script. Here's quick pseudo code before bed:
[pseudocode]
UNTESTED! WRITTEN IN <10min!! But this general approach should work out, I'm pretty certain.
[pseudocode]
Code: Select all
plotscript,radar,begin
suspendrandomenemies
stepcount:=29
end
plotscript,step,begin
if(stepcount==0),then
(exitscript) #don't risk interfering with other scripts that might suspend enemies
if(stepcount==1),then
begin
text
resumerandomenemies
end
decrement(stepcount)
endI am Srime
- Willy Elektrix
- Liquid Metal Slime
- Posts: 910
- Joined: Sun Aug 15, 2010 11:30 pm