• Welcome to Battlezone Universe.
 

News:

Welcome to the BZU Archive dated December 24, 2009. Topics and posts are in read-only mode. Those with accounts will be able to login and browse anything the account had access granted to at the time. No changes to permissions will be made to be given access to particular content. If you have any questions, please reach out to squirrelof09/Rapazzini.

Main Menu

The Scriptor, Mission Difficulty, and you...

Started by Avatar, January 21, 2008, 12:56:56 PM

Previous topic - Next topic

bigbadbogie

Others would merely say it was good humour.


My BZ2 mods:

QF2: Essence to a Thief - Development is underway.

Fleshstorm 2: The Harvest - Released on the 6th of November 2009. Got to www.bz2md.com for details.

QF Mod - My first mod, finished over a year ago. It can be found on BZ2MD.com

Sonic

I figured yours also had a linear style, but I simply choose to stay on topic with DLL Scriptor since its the one I've used for 4 mods and several FE missions.
"Linux is user friendly...
...it's just very selective about who its friends are."

OvermindDL1

I am still interested in the scriptor equivalent of what I posted.  I could do the C++ equiv but it would be rather nasty for some of those.

Avatar

#18
I can do some off the top of my head, but I'm at work and can't make sure it's 100% true code:

[text]
spammessage1,"This is sent once every ten minutes."
spammessage2,"This will spam your message box every single tick (ten times a second)"

routine, everyten,1,true
Startover:
   wait,600  //60seconds per minute * 10 minutes
   display,spammessage1
   Jumpto,Startover

routine, everytick,1,true
Startover:
  display,spammessage2
  Jumpto,Startover

routine,killubertank,1,true
checkagain:
  getbylabel,"unnamed_ubertank1",ubertank
  isaround,ubertank
  ifeq,false,checkagain
  getteam,ubertank
  ifNE,1,checkagain
  createp,"ivutankkill",uberkiller,2
  attack,ubertank,uberkiller,5000
  wait,60
  jumpto,checkagain
 
routine,checkplayer,1,true
checkagain:
  getplayer,theplayer
  isaround, theplayer
  ifeq,true,checkagain
  fail,youdied.des,10

routine,checkubertank,1,true
checkagain:
  getbylabel,"unnamed_ubertank1",ubertank
  isaround,ubertank
  ifeq,true,checkagain
  fail,uberdied.des,10

routine,checkenemyrec,1,true
checkagain:
  getbyTS,1,1,enemyrec
  isaround,enemyrec
  ifeq,true,checkagain
  win,"youkilledem.des",10


routine,playertask,1,true
  getbylabel,"unnamed_ubertankfactory1",enemyfactory
  display,"go to the enemy factory",white
  beaconon,enemyfactory
checkagain:
  getplayer,theplayer
  distobject,theplayer,enemyfactory
  ifGT,50,checkagain
  clear
  display,"go to the enemy factory",green
  display,"Slaughter the enemy before they slaughter your Uber-Tank!",white
 

and, I'm not sure what the last few lines of your code do, OM, but it would be easy enough to watch for the ubertankfactory to die...

I can ready youre code easily enough OM, and would gladly use it, but it would take some good documentation before I felt comfortable doing so.  As it is I can fumble my way through Scriptor code, even at work, with minimal errors, even though it's been some months since I last did a lot of code.

***

Where the Scriptor fall short is in comparisons, conditional loops, arrays, and I have trouble assigning proper labels to units that are created ingame.

For instance, it would be great to be able to make an array of all of the enemy Scavs created during the game and loop through them easily to check their distance from your base.  You can do this in the Scriptor but it's not very intuitive, or efficient, and it's hard to shuffle the groups down, and and and...   the code GSH gave me to do it in VC++ for MP is small and elegant, where the Scriptor equivalent fills a page and a half...

Anyway, I'd gladly go with your Scriptor but you're going to have to bite the bullet and make some sort of help file outlining how it all works.   :)

-Av-
 

bigbadbogie

Others would merely say it was good humour.


My BZ2 mods:

QF2: Essence to a Thief - Development is underway.

Fleshstorm 2: The Harvest - Released on the 6th of November 2009. Got to www.bz2md.com for details.

QF Mod - My first mod, finished over a year ago. It can be found on BZ2MD.com

OvermindDL1

On things like "routine, everytick,1,true", shouldn't that 1 actually be equal to the number of commands in the routine to be fully synced, because like that it will only execute one command a tick, instead of the whole loop every tick, thus meaning it will actually only print once every 2 to 3 ticks?  The others have the same issue.

And yea the last few lines:

        # This will create an "UberTank.odf" unit for the human at the location of the
        #  uberTankFactory, then give it a group so the human can control it
        SetBestGroup(BuildObject("UberTank", HumanTeam, uberTankFactory))

        # The above line could be written like this too if you needed to do more with it...
        uberTank = BuildObject("UberTank", HumanTeam, uberTankFactory)
        SetBestGroup(uberTank)

        # This just displays a message in the message box, so probably something
        #  like display,spammessage3 if spammessage3 is set to the message.
        #  Does the scriptor support colorizing the message box text, because that
        #  is what that RGB does, just a lightish red is what I had it do.
        AddToMessagesBox("Computer: GAGH, I WILL KILL YOU FOR THAT!", RGB(255, 64, 64))



To do something like looping over a list of enemy scavs, you could do something like this (with example):
class EnemyScavDistanceWatcher():
    def __init__(self):
        self.__enemyScavs = [] # Two underscores in front of a variable name makes it private, like the private keyword in C++

    @RunWhenIsBuilt(GOClass=("CLASS_SCAVENGER", "CLASS_SCAVENGERH"), NotTeam=HumanTeam)
    def NonHumanScavCreated(self, scav):
        self.__enemyScavs.append(scav)

    @RunWhenIsDestroyed(GOClass=("CLASS_SCAVENGER", "CLASS_SCAVENGERH"), NotTeam=HumanTeam)
    def NonHumanScavDestroyed(self, scav):
        self.__enemyScavs.remove(scav)

    def GetClosestAIScavAndDistance(self, from):
        closest = None
        dist = 2**30
        for scav in self.__enemyScavs:
            d = scav.GetDistance(from)
            if d<dist:
                dist = d
                closest = scav
        return (closest, dist)



# Then from your mission class, just inherit from this as well, you could just
#  put it inside the class directly and save a little bit of code, but this way is
#  reusable across projects and so forth :)
class MyMission(BZ2Mission, EnemyScavDistanceWatcher):
    # etc... and other things...

    # This is just some function that checks to see if the nearest scav is within
    #  a certain distance of the main base, and if so permenently marks it on the
    #  hud for the player to attack
    def WatchForEnemyScavsAndMark(self):
        humanBase = GetHumanMainBuilding()
        while humanBase:
            scav, dist = self.GetClosestAIScavAndDistance(humanBase)
            if dist<200.0:
                scav.SetObjectiveOn()
                Sleep(10*30) # Wait one-half minute before marking again...
            else:
                Sleep(10) # Test once a second


And yea, I know, need to create documentation...

Avatar

I had the scripts done using BSer's Scriptor before OM's came out...  I've got a LOT of time and effort into the missions and starting over with a new utility, no matter how much more powerful, isn't going to happen...

To me the main attraction of OM's version is MP support.  To have something like the Scriptor, that will do MP capable scripts so we can make online co-op missions (like DuneCommand's), would be a dream...

SO...  when BZC is out and the stock missions in the can I might turn to OM's Scriptor to do the Ancients Campaign.  It would be cool if they could all be played out as MPI's, as that means a more realistic level of difficulty.

***

The 'wait,600' will make it wait 600 seconds, and yes maybe there'll be 1/10th of a second between the end of the wait and the printout, but I'd call it close enough.  :)

The other only actually has one command, the print command.  The label doesn't take a tick, the jump might but it doesn't seem that it does, as it just sets the next run point, so you get one line printed each 1/10th of a second.

I've never worried about time and the number of lines run, as "wait,30" seems to wait for 30 seconds to me.  Maybe it's off by a second or two in some scripts but I've never really timed it that closely.  (If the Golem comes and eats me at roughly the time I told it to I'm happy...).

-Av-

Warfreak

I can barely find the right link to OM's Scriptor.............. (yes,very sad)....................

To BBB..........
Those who are programatically (yes, play on words i suppose) illiterate will suffer in this age of time.......... I am among that group........so dont be like me....... :-D

Avatar

Actually my experience is that there's a divide forming.

There are those who understand how and why a program works, and while they know the code ins and outs they often aren't even that good at using the program.  Technically brilliant they often aren't the best source for info on making the program useful in real life situations.

Then there are those who don't have a clue as to what's under the hood, but can be absolute adepts at using it.  The whole thing is magic to them, but they can make it dance and sing.

There are few who bridge the gap nowadays.  We're becoming Morlock and Eloi right before our eyes...

-Av-


bigbadbogie

exactly av -- i am the second class you mentioned - as are most modders

BSer bridges the gap - he made the dll scriptor and several FE missions
Others would merely say it was good humour.


My BZ2 mods:

QF2: Essence to a Thief - Development is underway.

Fleshstorm 2: The Harvest - Released on the 6th of November 2009. Got to www.bz2md.com for details.

QF Mod - My first mod, finished over a year ago. It can be found on BZ2MD.com

OvermindDL1

I worked a tiny bit on the documentation (a tiny bit meaning almost 50 functions and so forth, just a drop in the huge amount there is).  I also, really need to get a new version out, the new one has more capabilities, which are always a good thing. :)

Nielk1

If I ever make missions, I wont be able to beat them... I am one of those good at modding bad at playing. Then again, I don't give myself enough credit.

Click on the image...

Avatar

The mark of a good mission is that it won't play exactly the same each time, so if they catch you napping you're toast even if you were the one making the script.  There should be an ebb and flow, a mix of tactics and styles, and a touch of randomness to make it fun.

:)

-Av-

bigbadbogie

Others would merely say it was good humour.


My BZ2 mods:

QF2: Essence to a Thief - Development is underway.

Fleshstorm 2: The Harvest - Released on the 6th of November 2009. Got to www.bz2md.com for details.

QF Mod - My first mod, finished over a year ago. It can be found on BZ2MD.com

Sonic

Quote from: Avatar on January 23, 2008, 02:41:26 PM
The mark of a good mission is that it won't play exactly the same each time, so if they catch you napping you're toast even if you were the one making the script.  There should be an ebb and flow, a mix of tactics and styles, and a touch of randomness to make it fun.

:)

-Av-

My MPI DLL takes randomness into account which can be damn evil. The Reinforcements routine will randomly spit things out at a random point. The evil of it is its called at a fix time variable, called when the AI's Anti-Siege is called and when the AI's Recycler has taking moderate damage. The results one time was we have 4 Siege Tanks show up from all directions smashing down our defenses, which included Rave Titans mind you.
"Linux is user friendly...
...it's just very selective about who its friends are."