Duke4.net Forums: EDuke32 Scripting - Duke4.net Forums

Jump to content

Hide message Show message
Welcome to the Duke4.net Forums!

Register an account now to get access to all board features. After you've registered and logged in, you'll be able to create topics, post replies, send and receive private messages, disable the viewing of ads and more!

  • 83 Pages +
  • « First
  • 81
  • 82
  • 83
  • You cannot start a new topic
  • You cannot reply to this topic

EDuke32 Scripting  "CON coding help"

User is online   Trooper Dan 

  • Duke Plus Developer
  • 3,267

#2461

Find and replace. For example,

ifai 0
    ai AIBOSS4LAYEGGS


is replaced with

ifai 0
{
    ai AIBOSS4LAYEGGS
    globalsound BOS4_RECOG
}


Everything not being replaced, including the lines that immediately follow, remain as before.
0

User is offline   Mav3r1ck 

  • 39

#2462

I followed your example and encountered a problem. I found that same part of the coding in the Queen's code but when I changed it to what you have suggested something odd happens. Whenever the Queen spots Duke you hear the recog but the Queen instantly disappears for some reason.

Below is before the additional coding.

state boss4code

  ifai 0
    ai AIBOSS4LAYEGGS
  else
    ifaction BOSS4FLINTCH
    {
      ifactioncount 3
        ai AIBOSS4LAYEGGS
    }
  else
    ifai AIBOSS4LAYEGGS
      state boss4layeggs
  else
    ifai AIBOSS4SHOOT
      state boss4shootstate

  ifai AIBOSS4DYING
    state boss4dyingstate
  else
  {
    ifhitweapon
      state checkboss4hitstate
    else
      ifp palive
        ifpdistl 1280
      {
        addphealth -1000
        palfrom 63 63
      }
  }
ends


This is after the additional coding.

state boss4code

  ifai 0
  {
    ai AIBOSS4LAYEGGS
      globalsound BOS4_RECOG
  }
  else
    ifaction BOSS4FLINTCH
    {
      ifactioncount 3
        ai AIBOSS4LAYEGGS
    }
  else
    ifai AIBOSS4LAYEGGS
      state boss4layeggs
  else
    ifai AIBOSS4SHOOT
      state boss4shootstate

  ifai AIBOSS4DYING
    state boss4dyingstate
  else
  {
    ifhitweapon
      state checkboss4hitstate
    else
      ifp palive
        ifpdistl 1280
      {
        addphealth -1000
        palfrom 63 63
      }
  }
ends

0

User is online   Trooper Dan 

  • Duke Plus Developer
  • 3,267

#2463

You can see clearly that all the addition is doing is playing the sound. I can only guess that you changed something else in a part of the code not shown that is making her disappear. None of the code you posted above could make the sprite disappear or delete etc.
0

User is online   conoklast 

  • 25

#2464

View PostTrooper Dan, on 07 November 2018 - 03:38 AM, said:

I believe the easiest solution is to simply spawn the envelopes using the mail command (or spawn paper money with cash -- it will make no difference), and then hack the displayed sprites to look like your leaf sprites. This assumes your leaf art is already in game somewhere. There are several steps needed to make this work, which I can help with if need be. But the basic idea is you use EVENT_ANIMATESPRITES to change what is displayed by the envelope sprite so it shows your leaf tile instead, even though it is still really an envelope.


Hi Dan, I've been sidetracked with other things but I've now done up a simple 5 frame leaf animation and have loaded it into mapster32. In terms of functionality I was planning on using the code you gave me for the damaged wall tiles (onevent EVENT_DAMAGEWALL) So that when a sector with the foliage texture is shot it will generate the leaves. I had a read of the EVENT ANIMATESPRITES wiki but my understanding is pretty limited. Is the first step to create a unique actor for my leaf sprite animation?
0

User is online   Trooper Dan 

  • Duke Plus Developer
  • 3,267

#2465

View Postconoklast, on 03 December 2018 - 03:10 AM, said:

Is the first step to create a unique actor for my leaf sprite animation?


No, I would start by using the mail command to spawn envelopes from the damaged wall using the code I gave you before. Once you confirm that the envelopes spawn and fall in the way that you want, then go about replacing their t-sprites with the sprites you made. If it doesn't work, then you'll just have to code the movement into your own actor by oscillating the xvel of the falling sprite using a sin function. Not super hard either way.
0

User is offline   Mav3r1ck 

  • 39

#2466

View PostTrooper Dan, on 02 December 2018 - 10:42 PM, said:

You can see clearly that all the addition is doing is playing the sound. I can only guess that you changed something else in a part of the code not shown that is making her disappear. None of the code you posted above could make the sprite disappear or delete etc.


I'm not sure if a I did or not. However, I'll delete the Queen's current code and replace it with the original and unaltered coding and use your example to see what happens.

EDIT: Got it working, but I don't remember editing the Queen's code at all. For now, all that's left is the Protector Drone.

state newbeastcode
  state checksquished
  ifai 0
  {
    cstator 257
    ai AINEWBEASTGETENEMY
  }
  else
    ifaction ANEWBEASTLYINGDEAD
  {
    fall
    state newbeastdyingstate
    break
  }
  else
    ifaction ANEWBEASTFROZEN
  {
    ifcount THAWTIME
    {
      ai AINEWBEASTGETENEMY
      spritepal 0
    }
    else
      ifcount FROZENDRIPTIME
    {
      ifactioncount 26
      {
        spawn WATERDRIP
        resetactioncount
      }
    }

    ifhitweapon
    {
      ifwasweapon FREEZEBLAST
      {
        strength 0
        break
      }
      addkills 1

      ifrnd 84
        spawn BLOODPOOL
      lotsofglass 60
      sound GLASS_BREAKING
      killit
    }
    ifp pfacing
      ifpdistl FROZENQUICKKICKDIST
        pkick
    break
  }
  else
    ifai AINEWBEASTJUMPENEMY
      state newbeastjumpstate
  else
  {
    fall
    ifai AINEWBEASTGETENEMY
      state newbeastseekstate
    else
      ifai AINEWBEASTCHARGEENEMY
        state newbeastseekstate
    else
      ifai AINEWBEASTFLINTCH
    {
      ifcount 8
        ai AINEWBEASTGETENEMY
    }

    else
      ifai AINEWBEASTDODGE
        state newbeastdodgestate
    else
      ifai AINEWBEASTSCRATCHENEMY
        state newbeastscratchstate
    else
      ifai AINEWBEASTFLEENEMY
        state newbeastfleestate
    else
      ifai AINEWBEASTTHINK
        state newbeastthinkstate
/*
    else
      ifai AINEWBEASTSHRUNK
        state newbeastshrunkstate
*/
    else
      ifai AINEWBEASTGROW
        state genericgrowcode
    else
      ifai AINEWBEASTDYING
        state newbeastdyingstate
    else
      ifai AINEWBEASTSHOOT
    {
      ifp pshrunk
        ai AINEWBEASTGETENEMY
      else
        ifcount 26
          ai AINEWBEASTGETENEMY
      else
        ifcount 25
          shoot SHRINKER
      else
      {
        ifcount 5
          nullop
        else
          ifcount 4
            sound NEWBEAST_SPIT
      }
    }
  }

  ifhitweapon
    state checknewbeasthit
ends


So do I do the same thing at the top of this code like for what I did with the Queen?

This post has been edited by Mav3r1ck: 03 December 2018 - 03:09 PM

0

User is online   Trooper Dan 

  • Duke Plus Developer
  • 3,267

#2467

View PostMav3r1ck, on 03 December 2018 - 01:57 PM, said:

So do I do the same thing at the top of this code like for what I did with the Queen?


Posted Image
0

User is online   conoklast 

  • 25

#2468

View PostTrooper Dan, on 03 December 2018 - 04:40 AM, said:

No, I would start by using the mail command to spawn envelopes from the damaged wall using the code I gave you before. Once you confirm that the envelopes spawn and fall in the way that you want, then go about replacing their t-sprites with the sprites you made. If it doesn't work, then you'll just have to code the movement into your own actor by oscillating the xvel of the falling sprite using a sin function. Not super hard either way.


I can confirm that the wall tile spawns money that behaves how I'd like it to. I had a go at mimicking the code from the wiki page but my code won't compile. I'll explain my thinking (or lack thereof ;) )

So based on the wiki I need to assign 16 to the mdflags of the MONEY sprite/actor. I had tried renaming TEMP to LEAFVAR (just to make things clearer) but mapster didn't like this; said that it "...was expecting keyword, found "LEAFVAR"

 gamevar TEMP 0 0 
actor MONEY 1 LEAFFALL 0 0
getactor[THISACTOR].mdflags TEMP
orvar TEMP 16
setactor[THISACTOR].mdflags TEMP


Now I read through the ACTOR page on the wiki and after the name and strength values I need to define an action... so I created an action for my falling leaf sprite

define LEAF1 7642
useractor notenemy LEAF1 cstator 2305 ifaction 0 action LEAFFALL enda

action LEAFFALL 0 6 1 1 1 // my leaf sprite has 6 frames of animation



I then tried combining this with your previous code you had given me;

 damageeventtilerange 7653 7655 // 


onevent EVENT_DAMAGEWALL



ife wall[RETURN].picnum FOLIAGE1
{ money 7 
 gettspr[MONEY].tsprcstat TEMP
  ifvarand TEMP 2
      xorvar TEMP 2
  settspr[LEAF1].tsprcstat TEMP }
   
endevent 


I've no doubt made several errors, so if you can point me in the right direction it would be much appreciated.

This post has been edited by conoklast: 04 December 2018 - 12:15 AM

0

User is online   Trooper Dan 

  • Duke Plus Developer
  • 3,267

#2469

What follows is very hackish but it should get the job done.

IMPORTANT: Set your 6 frame leaf animation to animate from the art file (or using animtilerange if you aren't using .art files). That way, you can just set the money sprite to the leaf picnum and it will animate.

gamevar HACKTIME 0 0
gamevar spriteid 0 0
define LEAF1 7642
damageeventtilerange 7653 7655

onevent EVENT_DAMAGEWALL

ife wall[RETURN].picnum FOLIAGE1
{ 
  set HACKTIME YES
  money 7 
  set HACKTIME NO
}
   
endevent 

appendevent EVENT_EGS
  ifactor MONEY 
    ife HACKTIME YES
      seta[].mdflags 16
endevent

appendevent EVENT_ANIMATESPRITES

  gettspr[].tsprowner spriteid
  ife sprite[spriteid].picnum MONEY settspr[].tsprpicnum LEAF1 

endevent


1

User is online   conoklast 

  • 25

#2470

Works a treat;

Link to youtube vid (embedding doesn't seem to work)

The only minor issue is that the leaves convert back to the money sprite as they touch the ground.

This post has been edited by conoklast: 04 December 2018 - 03:51 AM

0

User is online   Trooper Dan 

  • Duke Plus Developer
  • 3,267

#2471

View Postconoklast, on 04 December 2018 - 03:46 AM, said:

Works a treat;

Link to youtube vid (embedding doesn't seem to work)

The only minor issue is that the leaves convert back to the money sprite as they touch the ground.


That link is not working but I will take your word for it. As for hitting the ground, I'm sure they are changing into a different picnum there (the middle tile of the money falling animation, which is tile 1234). What you could do is set a per-actor var on them in EVENT_EGS which will act as a flag for later. In EVENT_GAME you check any sprites of picnum 1234 that have the flag, and then change them to a leaf picnum which shows it on the ground.
0

User is online   conoklast 

  • 25

#2472

View PostTrooper Dan, on 04 December 2018 - 04:28 AM, said:

That link is not working but I will take your word for it. As for hitting the ground, I'm sure they are changing into a different picnum there (the middle tile of the money falling animation, which is tile 1234). What you could do is set a per-actor var on them in EVENT_EGS which will act as a flag for later. In EVENT_GAME you check any sprites of picnum 1234 that have the flag, and then change them to a leaf picnum which shows it on the ground.


Link to youtube vid

The link should work now - I figured you might be interested seeing as you're the one providing all the code. I will try to implement the per-actor VAR by myself and will see how I go.
0

User is online   Commando Nukem 

  • Judge Mental
  • 2,404

#2473

View Postconoklast, on 04 December 2018 - 12:31 PM, said:

Link to youtube vid

The link should work now - I figured you might be interested seeing as you're the one providing all the code. I will try to implement the per-actor VAR by myself and will see how I go.


It doesn't.

OPEN MAW PRODUCTIONS
Facebook Youtube and Twitter
0

User is online   conoklast 

  • 25

#2474

Yep l had the vid marked as private instead of unlisted. Hopefully it will work now.
1

User is offline   Mav3r1ck 

  • 39

#2475

So I got some more scripting questions.

1. I was able to properly code in an Overlord Sentry using Hendricks266 tutorial from the Eduke32 wikia. Though I noticed that it's missile firing position was off on the Overlord Sentry and from what I understand this will cause it to shoot itself at certain angles and even kill itself. How do I fix this?

2. I want to make an indestructible corpse/invisible corpse. How can I do this?
0

User is online   Trooper Dan 

  • Duke Plus Developer
  • 3,267

#2476

View PostMav3r1ck, on 05 December 2018 - 04:49 PM, said:

So I got some more scripting questions.

1. I was able to properly code in an Overlord Sentry using Hendricks266 tutorial from the Eduke32 wikia. Though I noticed that it's missile firing position was off on the Overlord Sentry and from what I understand this will cause it to shoot itself at certain angles and even kill itself. How do I fix this?


I'm pretty sure it will not shoot itself if you are using a relatively recent EDuke32. Verify that it does before worrying about it. If the position of the rockets bothers you, there are fixes but you will need to be more specific about the positioning.

View PostMav3r1ck, on 05 December 2018 - 04:49 PM, said:

2. I want to make an indestructible corpse/invisible corpse. How can I do this?


All you have to do is change cstat on the corpse.

https://wiki.eduke32.com/wiki/Cstat

EDIT: I should add, if the corpse is coded to be destroyed when hit with splash damage ("ifhitweapon RPG ...") then obviously you should remove that code for the corpse in question.


This post has been edited by Trooper Dan: 05 December 2018 - 05:26 PM

0

User is offline   Mav3r1ck 

  • 39

#2477

View PostTrooper Dan, on 05 December 2018 - 05:16 PM, said:

I'm pretty sure it will not shoot itself if you are using a relatively recent EDuke32. Verify that it does before worrying about it. If the position of the rockets bothers you, there are fixes but you will need to be more specific about the positioning.


Hmm, the firing position does bother a little. The rockets spawn above the Overlord Sentry. I also understand that when monsters are scaled the projectiles will match the scaled monster.

View PostTrooper Dan, on 05 December 2018 - 05:16 PM, said:

All you have to do is change cstat on the corpse.

https://wiki.eduke32.com/wiki/Cstat

EDIT: I should add, if the corpse is coded to be destroyed when hit with splash damage ("ifhitweapon RPG ...") then obviously you should remove that code for the corpse in question.


The code below is what I have for an experiment.

    ifwasweapon RPG
    {
      sound PRED_DYING
      sound SQUISHED
      state troop_body_jibs
      state standard_jibs
      cstat 0
      iffloordistl 8
      sound THUD
      ifrnd 64
        spawn BLOODPOOL
      state rf
      strength 0
      move TROOPSTOPPED
      action ATROOPDEAD
      cstator 32768


This will allow me to blow up the Trooper but it will leave an invisible corpse behind and will respawn in the spot where it died. The goal is to attempt to replicate Doom's Nightmare difficulty respawning and by that I mean to have the monsters respawn regardless of what weapon you kill them with. So far it's been successful but the issue I'm facing is that if you shoot an explosive at the invisible corpse it will explode with guts until the monster respawns. I'm trying to get it to where it doesn't do this.
0

User is online   Trooper Dan 

  • Duke Plus Developer
  • 3,267

#2478

There might be hardcoded positioning specific to BOSS3. If that's the case, you could probably remedy that using "cactor COMMANDER" right before "shoot RPG" then immediately after use "cactor BOSS3". If my suspision is correct that will make the RPG spawn lower. It will also probably reduce the damage quite a bit, and if that's a problem there is a solution for that as well.

As for the invisible corpse problem, I would define a new move, let's say "move JIBRESPAWN" and then when killed by RPG or RADIUSEXPLOSION, you have the enemies use that move instead of "move TROOPSTOPPED" or whatever that particular actor uses. Then, in the actor's code where the corpse is checking for explosions, add the line "ifmove JIBRESPAWN break" before any of the code that makes them spawn jibs. But also make sure that the "ifrespawn" check happens before the break, otherwise they will be stuck invisible forever. You migth have to move some code around to make it work.
0

User is offline   Mav3r1ck 

  • 39

#2479

View PostTrooper Dan, on 06 December 2018 - 02:47 AM, said:

There might be hardcoded positioning specific to BOSS3. If that's the case, you could probably remedy that using "cactor COMMANDER" right before "shoot RPG" then immediately after use "cactor BOSS3". If my suspision is correct that will make the RPG spawn lower. It will also probably reduce the damage quite a bit, and if that's a problem there is a solution for that as well.


Hmm, I can give it a shot and see what happens.

View PostTrooper Dan, on 06 December 2018 - 02:47 AM, said:

As for the invisible corpse problem, I would define a new move, let's say "move JIBRESPAWN" and then when killed by RPG or RADIUSEXPLOSION, you have the enemies use that move instead of "move TROOPSTOPPED" or whatever that particular actor uses. Then, in the actor's code where the corpse is checking for explosions, add the line "ifmove JIBRESPAWN break" before any of the code that makes them spawn jibs. But also make sure that the "ifrespawn" check happens before the break, otherwise they will be stuck invisible forever. You migth have to move some code around to make it work.


This gave me an idea.

state standard_jibs
  guts JIBS2 4
  guts JIBS3 8
  guts JIBS4 12
  guts JIBS5 8
  guts JIBS6 12
  ifrnd 6
  {
    guts JIBS1 1
    spawn BLOODPOOL
  }         // a badly drawn spine

  state jib_sounds
ends


The above is a modified jibs code (love the idea of more jibs when blowing something up) in my external GAME.CON that spawns more guts when blowing monsters up. That being said, what if I can duplicate this code and remove all the parts that spawn jibs and add it to the invisible corpse part as a dummy state for the jibs and then whenever I shoot the invisible corpse, no jibs will spawn. Could that method work instead?

This post has been edited by Mav3r1ck: 06 December 2018 - 04:15 PM

0

User is online   Trooper Dan 

  • Duke Plus Developer
  • 3,267

#2480

View PostMav3r1ck, on 06 December 2018 - 04:08 PM, said:

what if I can duplicate this code and remove all the parts that spawn jibs


I'm sorry but that broke me. The entire state does nothing but spawn jibs until the very last line which plays sounds.
0

Share this topic:


  • 83 Pages +
  • « First
  • 81
  • 82
  • 83
  • You cannot start a new topic
  • You cannot reply to this topic


All copyrights and trademarks are property of their respective owners. Instead of reading this text, you could be playing Ion Maiden! ;) © 2018 Voidpoint, LLC

Enter your sign in name and password


Sign in options