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

Jump to content

  • 117 Pages +
  • « First
  • 67
  • 68
  • 69
  • 70
  • 71
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

EDuke32 Scripting  "CON coding help"

User is offline   Darkus 

#2041

Well, I tried this and it seems to work:

onevent EVENT_PROCESSINPUT
  ifvare boting 1
  {
    ifvarg stucktime 5
    { ifvarl player[THISACTOR].quick_kick 1 { setplayer[THISACTOR].quick_kick 15 quote 80 }
    }
  }
endevent


Managed also to make it use some inventory items using the same way, except for the portable medkit. Look like I must code it myself.
1

User is online   Danukem 

  • Duke Plus Developer

#2042

View PostDarkus, on 05 October 2017 - 01:32 PM, said:

Well, I tried this and it seems to work:

onevent EVENT_PROCESSINPUT
  ifvare boting 1
  {
    ifvarg stucktime 5
    { ifvarl player[THISACTOR].quick_kick 1 { setplayer[THISACTOR].quick_kick 15 quote 80 }
    }
  }
endevent


Managed also to make it use some inventory items using the same way, except for the portable medkit. Look like I must code it myself.


So apparently it does work kind of like kickback_pic, except that it counts backwards! This is helpful, thanks.

The medkit is actually the only inventory item that I have coded for my bot, so I didn't notice that some of them could be activated with bits.
0

User is offline   Darkus 

#2043

Is there a way to read the listed flags from Definegametype?
0

User is online   Hendricks266 

  • Weaponized Autism

  #2044

View PostDarkus, on 07 October 2017 - 11:40 AM, said:

Is there a way to read the listed flags from Definegametype?

userdef[].gametypeflags
1

User is offline   Darkus 

#2045

Another problem which I don't know if I'm wrong or EDuke is bugging.

I want the dead players resurrect automatically by pressing the use key.
I made a sample, it works in single player, but it fail in multiplayer:

gamevar botai 0 1

onevent EVENT_GAME
  ifactor APLAYER
  { ifp pdead setvar botai 1 // dead?
	else setvar botai 0
  }
endevent

onevent EVENT_PROCESSINPUT
  ifvare botai 1 setinput[THISACTOR].bits 536870912 // press space
endevent


I tried to replace ifp pdead by ifdead, I have similar results, but it still does not work like it should.
0

User is online   Danukem 

  • Duke Plus Developer

#2046

I'm not sure about why there is a single/multi player difference, but I know I had a similar issue until I realized that I was telling the game to hold space, when I should have been telling it to tap space.

So what I do is this:

ifl sprite[].extra 1
{
	ifvarand botbits 536870912 xorvar botbits 536870912 else
	orvar botbits 536870912
}


Then bits is set to botbits in EVENT_PROCESSINPUT
0

User is offline   Darkus 

#2047

I think it's really a bug, for me EDuke is setting variables to the wrong players. Tapping or pressing the use key seems to have no importance.
For example I started a coop game with 8 players (no bots, only the sample code), I killed all of them to see the results, some randomly resurrect and the others wont (sometimes nobody resurrect). I even was affected by the bug, when suddenly I could no longer shoot at them.

Another example I got, I started my test map with 2 players (first controlled myself and one bot controlled), I followed him, then at one moment, he suddently stopped moving for no reason. When I looked his variables, it was in his 'dead' state, and keeping the use key pressed.

I checked my code and only one line could put him in this state. When I removed this line (ifvarl sprite[].extra 1) the problem was gone.

I have the same results by replacing the line with 'ifdead'.

As for 'ifp pdead', look like it's only affecting the first player. All of these issues are not appearing in single player.
0

User is offline   Darkus 

#2048

Double post: can't edit anymore?

I think I find out the problem:
During the execution of the code, it check the conditions for all the players, but take actions on closest 'living' players.

I tested with this:

onevent EVENT_GAME
  ifactor APLAYER
  { ifaction PEXPLODEAD resetplayer
  }
endevent


Start a 2 players game, blow up the second player, and the player one will keep reseting. Similar thing happen when there are more players, after blowing up some players, the others keep reseting near the dead ones.
2

User is offline   Jenz/Amaka 

#2049

I have five questions :rolleyes:

1st
I've replaced episode starting video with custom one. Sounds work but how do I stop menu music playing during the video?
Here's the code from .def
animsounds START0.ivf { 1 252  50 244 }


.con
onevent EVENT_NEWGAME
    // Only trigger when we come from the skill select menu
    ifvare current_menu 110
    {
        switch VOLUME
            case 0 // episode 1
                redefinequote 254 START0.ivf
                startcutscene 254
                break
            case 1 // episode 2
                redefinequote 254 START0.ivf
                startcutscene 254
                break
            case 2 // episode 3
                redefinequote 254 START0.ivf
                startcutscene 254
                break
        endswitch
    }
endevent


2nd
How to duplicate BLOODPOOL but with different texture? As in, Duplicate working exactly like the BLOODPOOL but with different texture.

3rd
How to make Actors(Palm Trees in this case) that "sort" of work the same as Dolphins in Ep.4. When shot with specific weapon(RPG) it changes to another texture, and when shot again it changes texture again until it reaches final stage when it simply turns to texture that cannot be interacted any further.

4th
I have several new health items that can be picked up by the player but when enemies dies they just simply spawn on floor instead of falling. How do I make it that when enemy dies, the item flies off to random direction? Kinda like how the jibs work.
Currently I simply use SPAWN NewHealthItem1.

5th
How to make custom TV screen breakable?
1

User is online   Hendricks266 

  • Weaponized Autism

  #2050

1. Put "stopallmusic" before startcutscene.

2. Currently we don't have any sort of inheritance, so you'll have to use a trick. First, you'll need to create a per-actor gamevar like "bloodpooltype". Then,

espawn BLOODPOOL
setactorvar[RETURN].bloodpooltype 1 // or 2, or 3, etc. if you have multiple types


Now there are two ways you can do things.

I'm not sure if this first way will work, but it's simpler. Create an action with an offset from BLOODPOOL to your new tilenum, and apply it to BLOODPOOL actors in EVENT_GAME if their bloodpooltype is the right non-zero value.

The second way is to add "setactor[RETURN].mdflags 16" to the code above, and use EVENT_ANIMATESPRITES to "settspr[THISACTOR].tsprpicnum <your new picnum>" on BLOODPOOL actors. If you do this, you may want to make "bloodpooltype" be the picnum itself instead of 1, 2, 3.

3. Doing this is simple in practice, but hard to explain unless you're familiar with the concept of a finite state machine. Basically, your actor will have some kind of state (unrelated to the CON concept of "state" meaning a subroutine) that can be changed, and it will need to do different things based on that state. The simplest way is to create two new actions for your 2nd and 3rd states (you get the first one for free with "ifaction 0"):

action APalmTree2 1
action APalmTree3 2

useractor notenemy MyPalmTree
    ifaction 0
    {
        ifhitweapon
        {
            action APalmTree2
        }
    }
    else ifaction APalmTree2
    {
        ifhitweapon
        {
            action APalmTree3
        }
    }
    else ifaction APalmTree3
    {
        ifhitweapon
        {
            killit
        }
    }
enda


You can also add "ifwasweapon" inside the ifhitweapon if you only want it to respond to a certain one. Similarly, if you would like it to need to take more than a single point of damage to change state, you can add a strength to the actor, use an "ifdead" condition to check when it has been depleted, and use the "strength" command when setting a new action to set the new necessary value.

4. The easiest way to do this is to shoot a custom projectile that you create with defineprojectile. You can create one projectile for each pickup and set each one's PROJ_SPAWNS accordingly, or you can create a single projectile,

eshoot MyMobilePickup
setthisprojectile[RETURN].spawns MyPickupTilenum


and use EVENT_ANIMATESPRITES to set its .tsprpicnum to its projectile spawn.

5. I need to create an EVENT_DAMAGEWALL. Others may tell you to use a hack they have come up with, but you should not.
3

#2051

Hi there! I'm often playing with my friend and I have recently started studying coding and such. I want to make a gun-game mod to play online. I have a couple of question though: Will it work without eduke but instead through hduke or xduke maybe? Is it achievable by just editing the con files? Here's my thoughts: I would first like to make rpg-objects bounce like the freezeblast (this has nothing to do with the mod) - i cant even find the code for the freezebounce. In the mod i was thinking unlimited ammo, which should be hard to get a workaround on, and then a weapon switch on multiplayer kill. So, lets say you start out with the pistol, you get a kill, then you get the shotgun and so on... so what do you say guys?
PS I KNOW that this will be hard, but I love to learn, so just a little hint will be helpful!
0

User is online   Danukem 

  • Duke Plus Developer

#2052

View PostHendricks266, on 12 October 2017 - 08:22 AM, said:

The second way is to add "setactor[RETURN].mdflags 16" to the code above, and use EVENT_ANIMATESPRITES to "settspr[THISACTOR].tsprpicnum <your new picnum>" on BLOODPOOL actors. If you do this, you may want to make "bloodpooltype" be the picnum itself instead of 1, 2, 3.


I can attest that this is generally more readable and reliable than using actions with big offsets, especially if you want to display alternate pictures for a variety of different things in the game, some of which may not work well with actions.
1

User is online   Hendricks266 

  • Weaponized Autism

  #2053

View Postthisbecasper, on 12 October 2017 - 08:41 AM, said:

Hi there! I'm often playing with my friend and I have recently started studying coding and such. I want to make a gun-game mod to play online. I have a couple of question though: Will it work without eduke but instead through hduke or xduke maybe? Is it achievable by just editing the con files? Here's my thoughts: I would first like to make rpg-objects bounce like the freezeblast (this has nothing to do with the mod) - i cant even find the code for the freezebounce. In the mod i was thinking unlimited ammo, which should be hard to get a workaround on, and then a weapon switch on multiplayer kill. So, lets say you start out with the pistol, you get a kill, then you get the shotgun and so on... so what do you say guys?
PS I KNOW that this will be hard, but I love to learn, so just a little hint will be helpful!

Unfortunately, most of your ideas are only possible with EDuke32's advanced scripting capabilities, which are not present in any other port. You should be able to do most of what you want using the OldMP branch.

1. Making RPGs bounce: You'll need to create an entirely custom projectile with defineprojectile and set the BOUNCESOFFWALLS flag on it.

2. Unlimited ammo: Trivial, as simple as setting each player's ammo_amount to the maximum in actor APLAYER.

3. Weapon grants on kills: This one will require some bookkeeping in the right places to count kills and execute code when the value changes, and reset it to zero when you're killed (if I understand correctly).
0

#2054

View PostHendricks266, on 12 October 2017 - 09:29 AM, said:

Unfortunately, most of your ideas are only possible with EDuke32's advanced scripting capabilities, which are not present in any other port. You should be able to do most of what you want using the OldMP branch.

1. Making RPGs bounce: You'll need to create an entirely custom projectile with defineprojectile and set the BOUNCESOFFWALLS flag on it.

2. Unlimited ammo: Trivial, as simple as setting each player's ammo_amount to the maximum in actor APLAYER.

3. Weapon grants on kills: This one will require some bookkeeping in the right places to count kills and execute code when the value changes, and reset it to zero when you're killed (if I understand correctly).


What language is it coded in? if you can say that...
I want to make my own enemy, so how do I insert new files to load from the art files? I guess I need some sort of program to view and edit those files.
Also: what does the these lines do:

action MYENEMY_ANIMATIONS 0 3 1 1 4 // order of the numbers and meaning of the number itself?
move MYENEMY_SPEEDS 64 // the only thing that makes sense to change here is 64 i guess, so moving along

ai AIMYENEMY_BOUNCE MYENEMY_ANIMATIONS MYENEMY_SPEEDS geth randomangle //"AIMYENEMY_BOUNCE" is this defined somewhere to be some sort of move pattern?

This post has been edited by thisbecasper: 13 October 2017 - 03:24 AM

0

#2055

View Postthisbecasper, on 13 October 2017 - 02:44 AM, said:

I want to make my own enemy, so how do I insert new files to load from the art files? I guess I need some sort of program to view and edit those files.

I've found "Build ART Files Editor" so I think im good on this one :rolleyes:
OH! What about a modification to a weapon like this: It shoots 3 bullets at a time in succesion - like an Assault rifle in burst mode, with lets say the pistol dmg and sound. After the burst it cant shoot for like 0,3-0,5 seconds (otherwise it would just be a normal pistol i guess). A nice and almost crucial thing to add is that you should not be able to hold down the shoot button, but instead tap the trigger/button in order to shoot with the weapon continously - is it achievable??? :excl:

This post has been edited by thisbecasper: 13 October 2017 - 04:39 AM

0

User is offline   Mark 

#2056

http://wiki.eduke32.com/wiki/Main_Page
0

#2057

View PostMark., on 13 October 2017 - 04:47 AM, said:


Thank you!
0

#2058

View PostMark., on 13 October 2017 - 04:47 AM, said:



Now i've tried a couple of things in order to achieve an rpg projectile that bounces.

//First try
defineprojectile 1660 PROJ_WORKSLIKE 32774
defineprojectile 1660 PROJ_SPAWNS EXPLOSION2
defineprojectile 1660 PROJ_VEL 1000
defineprojectile 1660 PROJ_EXTRA 300
defineprojectile 1660 PROJ_ISOUND PIPEBOMB_EXPLODE
defineprojectile 1660 PROJ_HITRADIUS 2560
defineprojectile 1660 PROJ_BOUNCES 5
defineprojectile 1660 PROJ_OFFSET 14354
defineprojectile 1660 PROJ_CLIPDIST 24
defineprojectile 1660 PROJ_TRAIL SMALLSMOKE


//Second try
//setprojectile[2605].bounces 32774
//setprojectile[2605].workslike

ofc it wont work because im missing something, but i dont see where. In the DEFS.CON ive changed "define RPG 2605" to "define RPG 1660" for the first try.
0

User is offline   Zaxtor 

#2059

My mod has a projectile that bounces off of walls and makes a trail that hurts you.
Works similar to RPG because when it shoots it autoaim the target (player).
Will bounce a few times and vanish.
Projectile will be destroyed if it hits the player.

For case of RPG you can replace the trail by the "smallsmoke trail"

This post has been edited by Zaxtor: 13 October 2017 - 10:02 AM

0

#2060

View PostZaxtor, on 13 October 2017 - 10:02 AM, said:

My mod has a projectile that bounces off of walls and makes a trail that hurts you.
Works similar to RPG because when it shoots it autoaim the target (player).
Will bounce a few times and vanish.
Projectile will be destroyed if it hits the player.

For case of RPG you can replace the trail by the "smallsmoke trail"


Thank you, but i'd like to learn how to do it myself, and understand why this doesn't work :rolleyes:
0

User is offline   Perro Seco 

#2061

I'm trying to replicate the demo/security camera effect following this example from Eduke32 Wiki.

I made the special camera actor, applied the code from the wiki and it works! But there's a problem: when using the camera I still can see the weapon sprite in screen:

Posted Image

Also, the player is in that red X shooting the weapon (that's why it has the red palette), but I can't see the player's sprite. What could be the problem? Do I need to code something more?
0

User is online   Danukem 

  • Duke Plus Developer

#2062

View PostPerro Seco, on 14 October 2017 - 08:20 AM, said:

I'm trying to replicate the demo/security camera effect following this example from Eduke32 Wiki.

I made the special camera actor, applied the code from the wiki and it works! But there's a problem: when using the camera I still can see the weapon sprite in screen:

Also, the player is in that red X shooting the weapon (that's why it has the red palette), but I can't see the player's sprite. What could be the problem? Do I need to code something more?


The code from the example literally just moves the viewing position and does nothing else. You still have to turn off the hud display, make the player sprite visible (it is normally invisible to the player), etc.
1

User is offline   Perro Seco 

#2063

I managed to hide the weapon sprites, but how can I make the player visible? I thought I would have to do something with its cstat, but using DNDEBUG I see is 257. If you can give me a hint I would be very grateful.
0

User is online   Danukem 

  • Duke Plus Developer

#2064

View PostPerro Seco, on 14 October 2017 - 02:01 PM, said:

I managed to hide the weapon sprites, but how can I make the player visible? I thought I would have to do something with its cstat, but using DNDEBUG I see is 257. If you can give me a hint I would be very grateful.


You could try forcing over_shoulder_on to 1. Normally this would also change the camera position, but since you are already forcing a camera position as well, it might do the job. Don't forget to restore it to the previous value when camera viewing ends. EDIT: To be clear, this isn't necessary the best solution, but I don't remember what is going on with the player sprite that makes it invisible. It might be a tsprite thing.

This post has been edited by Trooper Dan: 14 October 2017 - 03:26 PM

1

#2065

Now i've tried a couple of things in order to achieve an rpg projectile that bounces.

//First try
defineprojectile 1660 PROJ_WORKSLIKE 32774
defineprojectile 1660 PROJ_SPAWNS EXPLOSION2
defineprojectile 1660 PROJ_VEL 1000
defineprojectile 1660 PROJ_EXTRA 300
defineprojectile 1660 PROJ_ISOUND PIPEBOMB_EXPLODE
defineprojectile 1660 PROJ_HITRADIUS 2560
defineprojectile 1660 PROJ_BOUNCES 5
defineprojectile 1660 PROJ_OFFSET 14354
defineprojectile 1660 PROJ_CLIPDIST 24
defineprojectile 1660 PROJ_TRAIL SMALLSMOKE


//Second try
//setprojectile[2605].bounces 32774
//setprojectile[2605].workslike

ofc it wont work because im missing something, but i dont see where. In the DEFS.CON ive changed "define RPG 2605" to "define RPG 1660" for the first try.

bump :')
0

User is online   Danukem 

  • Duke Plus Developer

#2066

View Postthisbecasper, on 14 October 2017 - 11:35 PM, said:


In the DEFS.CON ive changed "define RPG 2605" to "define RPG 1660" for the first try.



Yeah don't do that. Leave the hardcoded RPG alone and make yours into a separate tile number. Make sure you have art on the tile you are using, too.
0

#2067

View PostTrooper Dan, on 15 October 2017 - 10:18 AM, said:

Yeah don't do that. Leave the hardcoded RPG alone and make yours into a separate tile number. Make sure you have art on the tile you are using, too.


How does the weapon (which weapon??) know what projectile to shoot? If I wanted to make the rpg shoot rockets that bounce, how do i do it? I tried it without the change in the DEFS with no luck
0

User is online   Danukem 

  • Duke Plus Developer

#2068

View Postthisbecasper, on 15 October 2017 - 10:36 AM, said:

How does the weapon (which weapon??) know what projectile to shoot? If I wanted to make the rpg shoot rockets that bounce, how do i do it? I tried it without the change in the DEFS with no luck


You can re-declare the gamevar that controls which projectile the weapon fires:

gamevar WEAPON4_SHOOTS 1660 1

http://wiki.eduke32....efined_gamevars
0

#2069

View PostTrooper Dan, on 15 October 2017 - 03:13 PM, said:

You can re-declare the gamevar that controls which projectile the weapon fires:

gamevar WEAPON4_SHOOTS 1660 1

http://wiki.eduke32....efined_gamevars


Thanks! That made me achieve ton of stuff already!
I can't get my burst project to work tho. What I want for now is just a weapon that, with a single tap on the shooting button, shoots a burst of lets say 4 shots in succession and then stops briefly inbetween bursts. I hope to get some clarification on the kickback_pic and totaltime and so. I've read the wikis but i'm missing something... Also: It seems that with this "gamevar WEAPON3_FLAGS xx" that im only adding stuff to the weapon. How do I delete the "WEAPON_RESET" on WEAPON3?

Thanks again for the help!

Last thing: Where are the weapons function defined in the first place? Not in the conf file? I've searched for RPG, WEAPON4, and flags and such, no succes..

This post has been edited by thisbecasper: 15 October 2017 - 05:27 PM

0

User is online   Hendricks266 

  • Weaponized Autism

  #2070

View Postthisbecasper, on 15 October 2017 - 05:12 PM, said:

What I want for now is just a weapon that, with a single tap on the shooting button, shoots a burst of lets say 4 shots in succession and then stops briefly inbetween bursts.

You'll want to set WEAPON3_SHOTSPERBURST to 4, and probably add AMMOPERSHOT to WEAPON3_FLAGS.

View Postthisbecasper, on 15 October 2017 - 05:12 PM, said:

Also: It seems that with this "gamevar WEAPON3_FLAGS xx" that im only adding stuff to the weapon. How do I delete the "WEAPON_RESET" on WEAPON3?

Declaring the gamevar in your con files will erase the ones already there and only set the flags you name.

View Postthisbecasper, on 15 October 2017 - 05:12 PM, said:

Last thing: Where are the weapons function defined in the first place? Not in the conf file? I've searched for RPG, WEAPON4, and flags and such, no succes..

They're hardcoded into the exe.
0

Share this topic:


  • 117 Pages +
  • « First
  • 67
  • 68
  • 69
  • 70
  • 71
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic


All copyrights and trademarks not owned by Voidpoint, LLC are the sole property of their respective owners. Play Ion Fury! ;) © Voidpoint, LLC

Enter your sign in name and password


Sign in options