How to control creating objects.
How to Making a Quest System.
This was made with the ThePixie's Zombie Apocalypse! https://github.com/ThePix/quest/wiki/The-Zombie-Apocalypse-(on-the-web-version)
Put this in the game -> Scripts -> Start Script:
game.spawn = false
game.count2 = 0
roomspawns
Put this in a room's On Enter script:
roll = GetRandomInt(1,100)
firsttime {
Route 24.circuitfirst = false
}
Route 24.countscript => {
if (game.count2 > 0) {
if (Route 24.circuitfirst = false) {
if (game.spawn = false) {
SpawnSentret (Route 24)
}
Route 24.count = Route 24.count + 1
Route 24.circuitfirst = true
}
}
}
if (Route 24.count > 5) {
Route 24.count = 0
}
if (Route 24.count = 0) {
Route 24.circuitfirst = false
}
game.count2 = game.count2 + 1
Make a new function called roomspawns.
Put any room where Monsters spawn here.
Route 24.count = 0
Route 25.count = 0
This gives you a working spawn code!
And here's the mini quest system I mentioned!
Put this in your game- scripts- start script:
game.Quest1 = 4
game.Quest2 = 4
game.Quest3 = 4
Put these anywhere you need to check the quests:
if (game.Quest1 = 4) {
msg ("Uncompleted")
}
if (game.Quest1 = 3) {
msg ("In progress")
}
if (game.Quest1 = 2) {
msg ("Completed")
}
if (game.Quest1 = 1) {
msg ("Turned in")
}
Need to change the status of the quests? Just subtract 1.
game.Quest1 = game.Quest1 - 1
That ought to give you a working spawn code!
It doesn't look like it would do anything to me.
You've got a bunch of attributes count
, count2
, circuitfirst
, and spawn
… but it's not obvious what any of them actually represent. As it stands, I'm pretty sure this code will do nothing, but the unintuitive names of the variables make it hard to work out what it's supposed to do.
My first guess would be spawning a zombie the first time you enter a new room, and then another one if you've gone more than 5 rooms without encountering a zombie. But I guess you're intending something more complex, because you could do that with a single room enter script:
if (GetBoolean (this, "visited") and GetInt (game, "rooms_since_last_zombie") < 5) {
game.rooms_since_last_zombie = game.rooms_since_last_zombie + 1
}
else {
game.rooms_since_last_zombie = 0
SpawnZombie (this)
}
Oh.
Yes. That is what I'm doing.
Thanks mrangel.
Also, I fixed the code up above. It should work fine now.
Going through that room enter script…
circuitfirst
to falsecountscript
, which is never runcircuitfirst
to false againIf you want it to ever spawn a zombie, you'll need to increase game.count2
above zero, and run the countscript
script attribute. Your code doesn't do either of these things. After it's done that once, it would return to doing nothing unless some other piece of code sets circuitfirst
back to false before running countscript
.
Okay. I don't know how to run a script attribute.
Okay, this is the code I am using for my Pokemon game.
if (GetBoolean (this, "visited") and GetInt (game, "rooms_since_last_zombie") < 5) {
game.rooms_since_last_zombie = game.rooms_since_last_zombie + 1
}
else {
game.rooms_since_last_zombie = 0
roll = GetRandomInt(1,100)
if (game.spawn = false) {
if (roll > 24 and roll < 37) {
SpawnSentret (this)
}
else if (roll > 12 and roll < 25) {
SpawnHoothoot (this)
}
else if (roll > 0 and roll < 11) {
SpawnSpinarak (this)
}
}
}