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

Jump to content

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

EDuke32 Scripting  "CON coding help"

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 offline   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

#2071

View PostHendricks266, on 15 October 2017 - 07:04 PM, said:

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


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


They're hardcoded into the exe.


Thank you once again for the clarification!
0

#2072

Hmm, how do I alter the speed which the pipebomb is thrown at? I think this could be tricky to work with because there has to be a lot of hardcoding involved in those pipes :excl: I want to be able to throw the pipebomb ridicously far :rolleyes:
And how do I add a new weapon? Like for example the expander that exchanges the shrinker when you switch to shrinker once again. I would like a secondary shotgun..

This post has been edited by thisbecasper: 16 October 2017 - 12:45 PM

0

#2073

Is it possible to make the shotgun for example shoot normally when pressing the fire button, but shoot, lets say rockets, when turnaround is pressed instead?
0

User is offline   Hendricks266 

  • Weaponized Autism

  #2074

Untested, but let me know how this goes.

onevent EVENT_TURNAROUND
    setvar WEAPON2_SHOOTS RPG
    setplayer[THISACTOR].kickback_pic 1

    setvar RETURN -1
endevent

onevent EVENT_PRESSEDFIRE
    setvar WEAPON2_SHOOTS SHOTGUN
endevent

0

#2075

View PostHendricks266, on 16 October 2017 - 02:55 PM, said:

Untested, but let me know how this goes.

onevent EVENT_TURNAROUND
    setvar WEAPON2_SHOOTS RPG
    setplayer[THISACTOR].kickback_pic 1

    setvar RETURN -1
endevent

onevent EVENT_PRESSEDFIRE
    setvar WEAPON2_SHOOTS SHOTGUN
endevent



This actually works, although it shoots 7 rockets on top of eachother. This is just a matter of redefining a couple of more things in the first bit of the code I guess. It does only fire in rpg-mode a single time when holding down the fire button, BUT, if you tap the turnaround you can spam the rockets heheh. Thank you for the reply, I learn quite a bit reading code like this :-) Maybe I can continue working on the code myself too..
0

User is offline   Hendricks266 

  • Weaponized Autism

  #2076

Hmm

onevent EVENT_TURNAROUND
    setvar WEAPON2_SHOOTS RPG
    ifvare player[].kickback_pic 0
        setplayer[].kickback_pic 1

    setvar RETURN -1
endevent

onevent EVENT_PRESSEDFIRE
    setvar WEAPON2_SHOOTS SHOTGUN
endevent

0

#2077

View PostHendricks266, on 16 October 2017 - 07:01 PM, said:

Hmm

onevent EVENT_TURNAROUND
    setvar WEAPON2_SHOOTS RPG
    ifvare player[].kickback_pic 0
        setplayer[].kickback_pic 1

    setvar RETURN -1
endevent

onevent EVENT_PRESSEDFIRE
    setvar WEAPON2_SHOOTS SHOTGUN
endevent



"GAME.CON: In event `EVENT_TURNAROUND':
GAME.CON:215: error: symbol `player' is not a game array.
GAME.CON:215: error: parameter `.kickback_pic' is undefined.
GAME.CON:215: error: expected a keyword but found `0'.
GAME.CON:216: error: symbol `kickback_pic' is not a game variable.
GAME.CON:216: error: syntax error."
0

User is offline   Hendricks266 

  • Weaponized Autism

  #2078

How old of an EDuke32 are you using?
0

#2079

View PostHendricks266, on 16 October 2017 - 07:30 PM, said:

How old of an EDuke32 are you using?

EDuke32-OldMP (Maintenance Build) Release 9 20120912
- And that's what's causing it. It works on my "normal" Eduke :-) A bit annoying tho, because the stuff I'm trying to make is for multiplayer purposes only :/

This post has been edited by thisbecasper: 16 October 2017 - 07:35 PM

0

User is offline   Hendricks266 

  • Weaponized Autism

  #2080

define INPUT_TURN_AROUND       268435456

gamevar temp 0 0
gamevar bits 0 1

onevent EVENT_PRESSEDFIRE
    setvar WEAPON2_SHOOTS SHOTGUN
    setvar WEAPON2_SHOTSPERBURST 7
endevent

onevent EVENT_TURNAROUND
    setvar RETURN -1
endevent

onevent EVENT_PROCESSINPUT
    getinput[THISACTOR].bits bits
endevent

onevent EVENT_GAME
    ifactor APLAYER
    {
        ifvarand bits INPUT_TURN_AROUND
        {
            ifvare currentweapon SHOTGUN_WEAPON
            {
                ifvare weaponcount 0
                {
                    getplayer[THISACTOR].ammo_amount SHOTGUN_WEAPON temp
                    ifvarg temp 0
                    {
                        setvar WEAPON2_SHOOTS RPG
                        setvar WEAPON2_SHOTSPERBURST 1

                        setplayer[THISACTOR].kickback_pic 1
                    }
                }
            }
        }
    }
endevent

0

#2081

View PostHendricks266, on 16 October 2017 - 07:45 PM, said:

define INPUT_TURN_AROUND       268435456

gamevar temp 0 0
gamevar bits 0 1

onevent EVENT_PRESSEDFIRE
    setvar WEAPON2_SHOOTS SHOTGUN
    setvar WEAPON2_SHOTSPERBURST 7
endevent

onevent EVENT_TURNAROUND
    setvar RETURN -1
endevent

onevent EVENT_PROCESSINPUT
    getinput[THISACTOR].bits bits
endevent

onevent EVENT_GAME
    ifactor APLAYER
    {
        ifvarand bits INPUT_TURN_AROUND
        {
            ifvare currentweapon SHOTGUN_WEAPON
            {
                ifvare weaponcount 0
                {
                    getplayer[THISACTOR].ammo_amount SHOTGUN_WEAPON temp
                    ifvarg temp 0
                    {
                        setvar WEAPON2_SHOOTS RPG
                        setvar WEAPON2_SHOTSPERBURST 1

                        setplayer[THISACTOR].kickback_pic 1
                    }
                }
            }
        }
    }
endevent



Damn... Thank you so much! Works like a charm.. It even acts exactly as it should now. I just need to know why I need to do this step:

"onevent EVENT_TURNAROUND
setvar RETURN -1
endevent"

- And I guess gamevar bits is used to remember last keypress, if im right?
0

User is offline   Hendricks266 

  • Weaponized Autism

  #2082

Setting RETURN to -1 in EVENT_TURNAROUND disables the Turn Around action from taking place.

The bits gamevar is updated with the current state of the keys at all times.
0

#2083

View PostHendricks266, on 16 October 2017 - 08:05 PM, said:

Setting RETURN to -1 in EVENT_TURNAROUND disables the Turn Around action from taking place.

The bits gamevar is updated with the current state of the keys at all times.


Yep! Just found out myself. I actually made a toggle instead.

define INPUT_TURN_AROUND       268435456

gamevar choice 0 1

onevent EVENT_TURNAROUND
    setvar RETURN -1
endevent

onevent EVENT_TURNAROUND
    ifvare currentweapon SHOTGUN_WEAPON
    {
    	ifvare choice 0
    	{
    		setvar choice 1
    	}
    	else
    	{
    		setvar choice 0
    	} 
    	}
endevent

onevent EVENT_PRESSEDFIRE
	ifvare choice 0
	{
		setvar WEAPON2_SHOOTS SHOTGUN
    	setvar WEAPON2_SHOTSPERBURST 7
	}
	else
	{
		setvar WEAPON2_SHOOTS RPG
        setvar WEAPON2_SHOTSPERBURST 1
	}	    
endevent


Although it doesn't work when I add the RETURN -1 bit. I guess it wont let the next onevent EVENT_TURNAROUND get executed. I think I would have to use the "bits" var like you did! But thanks for the help!

This post has been edited by thisbecasper: 16 October 2017 - 08:22 PM

0

User is online   Danukem 

  • Duke Plus Developer

#2084

View Postthisbecasper, on 16 October 2017 - 08:21 PM, said:

Although it doesn't work when I add the RETURN -1 bit.


It should work. You don't need two different declarations of the same event; I wonder if that's related.

View Postthisbecasper, on 16 October 2017 - 08:21 PM, said:

I guess it wont let the next onevent EVENT_TURNAROUND get executed.


The value of RETURN is not saved; it is constantly getting set to different values by various events and such.
0

#2085

View PostTrooper Dan, on 16 October 2017 - 11:39 PM, said:

It should work. You don't need two different declarations of the same event; I wonder if that's related.


Thanks! That was what caused it.
0

#2086

Hi, just tried it with my friend, and we get an out-of-sync when one of us dies. Heres the code, I hope I can make a getaround:

define INPUT_TURN_AROUND       268435456

gamevar SHOTGUNAMMO 0 1
gamevar choice 0 1

onevent EVENT_TURNAROUND
{
	setvar RETURN -1
    ifvare choice 0
    {
  		setvar choice 1
  		sound SELECT_WEAPON        
      quote 34
    }
    else
  	{
  		setvar choice 0
    		sound SHOTGUN_COCK
        quote 35
    	} 
    }    
endevent

onevent EVENT_PRESSEDFIRE
{	 
	ifvare choice 0
	{
		setvar WEAPON2_SHOOTS SHOTGUN
  	setvar WEAPON2_SHOTSPERBURST 7
    setvar WEAPON2_FIRESOUND SHOTGUN_FIRE
    setvar WEAPON2_FLAGS 1024
	}
	else
	{
		ifvarl SHOTGUNAMMO 10
		{
			setvar choice 0
			quote 40
			sound SHOTGUN_COCK

		}
		setvar WEAPON2_SHOOTS 1092
    setvar WEAPON2_SHOTSPERBURST 10
    setvar WEAPON2_FIRESOUND PISTOL_RICOCHET
   	setvar WEAPON2_FLAGS 17472 				
	}
}

endevent


Also the sound won't update accordingly between "weapon-switch".
0

User is offline   Hendricks266 

  • Weaponized Autism

  #2087

If you're using a switch style, you should update the vars directly in EVENT_TURNAROUND instead of using PRESSEDFIRE.

What is that SHOTGUNAMMO variable? I suspect you don't need it.
0

#2088

View PostHendricks266, on 17 October 2017 - 08:09 AM, said:

If you're using a switch style, you should update the vars directly in EVENT_TURNAROUND instead of using PRESSEDFIRE.

What is that SHOTGUNAMMO variable? I suspect you don't need it.


Thank you for the help. I've got it to work now like this:

gamevar SHOTGUNAMMO 0 1
gamevar choice 0 1
gamevar PWEAPON 0 1

onevent EVENT_TURNAROUND
{
	setvar RETURN -1
	ifvare PWEAPON 2
   	{
    	ifvare choice 0
    	{
    		ifvarl SHOTGUNAMMO 10
    		{
    			quote 36
    			break
    		}
    		setvar choice 1
    		sound SELECT_WEAPON
    		setvar WEAPON2_SHOOTS 1092
       		setvar WEAPON2_SHOTSPERBURST 10
       		setvar WEAPON2_FIRESOUND PISTOL_RICOCHET
       		setvar WEAPON2_FLAGS 17472 	
        	quote 34
    	}
    	else
    	{
    		setvar choice 0
    		sound SHOTGUN_COCK
    		setvar WEAPON2_SHOOTS SHOTGUN
    		setvar WEAPON2_SHOTSPERBURST 7
    		setvar WEAPON2_FIRESOUND SHOTGUN_FIRE
    		setvar WEAPON2_FLAGS 1024
        	quote 35
    	} 
    }
}	    
endevent

onevent EVENT_DOFIRE
{
	ifvare PWEAPON 2
	{
		ifvare choice 1
		{
			ifvarl SHOTGUNAMMO 10
			{
				setvar choice 0
    			sound SHOTGUN_COCK
    			setvar WEAPON2_SHOOTS SHOTGUN
    			setvar WEAPON2_SHOTSPERBURST 7
    			setvar WEAPON2_FIRESOUND SHOTGUN_FIRE
    			setvar WEAPON2_FLAGS 1024
        		quote 40
			}
		}
	}
}
endevent


I think I need the var SHOTGUNAMMO inorder to keep track of current ammo of the shotgun?. Can I do it without the var and without causing an out-of-sync error? I've btw also managed to get rid of the out-of-sync thing - I still don't see the big difference between using a var like I do to keep track of the players current weapon and a call to currentweapon, which was what caused it..

This post has been edited by thisbecasper: 17 October 2017 - 12:11 PM

0

Share this topic:


  • 124 Pages +
  • « First
  • 68
  • 69
  • 70
  • 71
  • 72
  • 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