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

Jump to content

  • 119 Pages +
  • « First
  • 61
  • 62
  • 63
  • 64
  • 65
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

EDuke32 Scripting  "CON coding help"

User is offline   Jblade 

#1861

View PostFox, on 18 March 2016 - 06:06 PM, said:

Nope, animatesprites doesn't work with sprites that are not being rendered.

That's why I said move the sprite next to the player like you suggested but keep it's tspr x and y values at its original location. Anyways what I suggested is not what Dan was looking for, the ability to do that would be insanely useful though.

This post has been edited by Jblade: 18 March 2016 - 11:58 PM

0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#1862

My bad. That would not work, moving it through the tsprite structure would have the same result as being in the original location, except that it would waste some memory processing a sprite that's not visible.

This post has been edited by Fox: 19 March 2016 - 12:07 AM

0

#1863

Hey guys. I have two problems.

1. I already created casings that drop on the ground. However, I would like the casings to be visible in first person as they leave the weapon (like the original sprite ones). I know I can modify the angle horizontally that they appear as such, but then the casings drop in front of Duke instead of next to him. I use code such as this:

 ifactor RIFLESHELL
{
move FORWARD
getactor[THISACTOR].ang TEMP
subvar TEMP -412
randvar TEMP2 128
addvarvar TEMP TEMP2
setactor[THISACTOR].ang TEMP
}



I know the fix is probably easy and I'm missing something obvious, but do help a brother out here.

2. Is it possible for the Eggs and Sharks to be counted in the overall tally count BEFORE killing them? (as in, the mid level enemy count that can be turned on in eDuke can show the proper number of enemies instead of an estimate)
0

User is offline   Jblade 

#1864

The best thing to do is to use rotatepoint at the time of spawning it and telling the actor to spawn a little bit to the diagonal right of Duke when firing. I have some ugly code here I've used in the AMC TC:
	move FORWARD
	getactor[THISACTOR].ang TEMP
	subvar TEMP -412
	randvar TEMP2 128
	addvarvar TEMP TEMP2
	setactor[THISACTOR].ang TEMP
	getactor[THISACTOR].owner TEMP8
		setvarvar TEMP3 sprite[TEMP8].x
		addvar TEMP3 256
		getactor[TEMP8].ang TEMP4
                addvar TEMP4 128
		rotatepoint sprite[TEMP8].x sprite[TEMP8].y TEMP3 sprite[TEMP8].y TEMP4 TEMP5 TEMP6
		setactor[THISACTOR].x TEMP5 
		setactor[THISACTOR].y TEMP6
		getactor[TEMP8].z TEMP
		subvar TEMP 8096
		ifspawnedby APLAYER
			{
			getplayer[THISACTOR].horiz TEMP2
			subvar TEMP2 100
			mulvar TEMP2 16
			subvarvar TEMP TEMP2
			}
		setactor[THISACTOR].z TEMP

Hopefully you can get a gist of what needs doing. I'm sure the code could be improved but I have a dozen other things that need working on at the same time.

This post has been edited by Jblade: 29 April 2016 - 12:35 PM

0

#1865

Thanks for the help!
1

#1866

View PostMr. Alias Nameless, on 21 February 2016 - 06:35 AM, said:

Hello everybody. I need a guru. I need to be able to select objects on the screen with the mouse.
I need a function that takes parameters: camerax,cameray,cameraz,camerasect,camerahoriz,cameraang, screenx,screeny (xd,yd) and return x,y,z in build coordinates.
Posted Image
Can somebody help with programming such functions for non classic modes?



I did it!


This post has been edited by Mr. Alias Nameless: 12 August 2016 - 02:23 AM

4

User is offline   Mblackwell 

  • Evil Overlord

#1867

But does it work in other aspect ratios?
0

#1868

View PostMblackwell, on 12 August 2016 - 12:46 PM, said:

But does it work in other aspect ratios?


What do you mean? Screen resolution - yes to all. Aspect setted up by setaspect function - halfway, it is necessary to choose the coefficients for each values of "viewingrange" and "yxaspect". Now I try to find a mathematical relationship.

This post has been edited by Mr. Alias Nameless: 15 August 2016 - 11:47 PM

0

User is offline   stumppy84 

#1869

A quick noob question, I'm trying to code a force-field for the trooper. it works but I cant get the TRANSPORTERSTAR to pallet to 7.. I have tried adding 'spritepal 7' before and after the TRANSPORTERSTAR but neither work..

below the ifwasweapon SHOTSPARK1:
	
sound SOMETHINGHITFORCE
spawn TRANSPORTERSTAR spritepal 7 



This post has been edited by stumppy84: 18 August 2016 - 05:20 PM

0

User is online   Hendricks266 

  • Weaponized Autism

  #1870

Commands like spritepal work only on the current sprite.

espawn TRANSPORTERSTAR
setactor[RETURN].pal 7

0

User is offline   stumppy84 

#1871

Thanks again Hendricks!! :P
0

User is offline   stumppy84 

#1872

How hard is it to code in a shotgun knockback feature? That would knock back the actors. I've looked at other mods but it seems a bit complicated...
0

User is offline   Jblade 

#1873

A simple way to do it would be like this:
ifvarg sprite[THISACTOR].htextra 0 // Is this actor taking damage?
 {
 getactor[THISACTOR].htpicnum TEMP // get the tile number of the attack
  ifvare TEMP SHOTGUN // if it's the shotgun...
   {
   setactor[THISACTOR].xvel -10 // set its backwards velocity by 10
   }
 }

Make sure to define the TEMP gamevar if you haven't already.

That should do it - it's a quick and dirty method but it should work. Then you can go from there and make it a bit more complex. You would put this in the actor code - I can't remember if it has to be before or after a 'ifhitweapon' statement so try both.
0

User is offline   Mblackwell 

  • Evil Overlord

#1874

View PostMr. Alias Nameless, on 15 August 2016 - 11:42 PM, said:

What do you mean? Screen resolution - yes to all. Aspect setted up by setaspect function - halfway, it is necessary to choose the coefficients for each values of "viewingrange" and "yxaspect". Now I try to find a mathematical relationship.


I mean screen resolution, yes. For example setting 16:10 vs 16:9 and 4:3 as well as 5:4
0

User is offline   Micky C 

  • Honored Donor

#1875

View PostMblackwell, on 19 August 2016 - 07:25 AM, said:

I mean screen resolution, yes. For example setting 16:10 vs 16:9 and 4:3 as well as 5:4


Hasn't someone already done code for something like this that works in the software renderer, but is off in the gl renderers due to the different perspective?

It was for drawing boxes around actors from memory.

This post has been edited by Micky C: 19 August 2016 - 07:27 AM

0

User is offline   Mblackwell 

  • Evil Overlord

#1876

Yeah I remember that code, but I can't remember what mod that was for.
0

User is offline   stumppy84 

#1877

View PostJblade, on 19 August 2016 - 03:27 AM, said:

A simple way to do it would be like this:
ifvarg sprite[THISACTOR].htextra 0 // Is this actor taking damage?
 {
 getactor[THISACTOR].htpicnum TEMP // get the tile number of the attack
  ifvare TEMP SHOTGUN // if it's the shotgun...
   {
   setactor[THISACTOR].xvel -10 // set its backwards velocity by 10
   }
 }

Make sure to define the TEMP gamevar if you haven't already.

That should do it - it's a quick and dirty method but it should work. Then you can go from there and make it a bit more complex. You would put this in the actor code - I can't remember if it has to be before or after a 'ifhitweapon' statement so try both.


Thanks Jblade! I'm not 100% about defining the 'TEMP gamevar' but I will try to look around the Wiki a bit and see if its explained there..
0

User is offline   Jblade 

#1878

gamevar TEMP 0 0 - basically the first letter is the variable's starting number, and the second defines what kind of variable. 0 is global, so everything can access it - 1 is per-player which means it's unique for every player and 2 is per-actor which means it's unique for every single actor :P
0

User is offline   stumppy84 

#1879

Thanks! I couldn't really find in the wiki so this is a great help!!
0

User is offline   Danukem 

  • Duke Plus Developer

#1880

View Poststumppy84, on 20 August 2016 - 07:44 AM, said:

Thanks! I couldn't really find in the wiki so this is a great help!!


http://wiki.eduke32.com/wiki/Scripting

You can read the first section on gamevars.

Also, there is an entry here:

http://wiki.eduke32....ar_manipulation
0

#1881

Two bugs found? (using last eduke version, since dunno):

- getting htextra from enemies always returns -1 rather than incurring damage (i also used useractor as additional caution as wiki suggests)

- if adding cstat 256 to dead corpses for being able to shoot them, they use some hardcoded clipping rectangle as high as the living actor (see pic below); maybe i miss something, but I found no way to change it by working on clipdist or various flags.

I know that the first issue can be avoided by constantly checking actor's extra, and the second with separate actors for corpses.
Unfortunately the separate actor solution opens several issues in a project i'm working on, if not solvable via attributes or some strange trick.

Attached thumbnail(s)

  • Attached Image: duke0002.jpg

0

User is offline   Danukem 

  • Duke Plus Developer

#1882

View PostRichardStorm, on 23 August 2016 - 04:05 AM, said:

- getting htextra from enemies always returns -1 rather than incurring damage (i also used useractor as additional caution as wiki suggests)


If that were true it would break just about every one of my mods, and since I have released tested versions of some mods using the latest r5811 snapshot, I have to conclude that you are doing something wrong. Most likely, you are checking htextra after the actor has called ifhitweapon (that command resets htextra to -1).

EDIT: I made an edit to the wiki page to clear that up http://wiki.eduke32.com/wiki/Htextra

This post has been edited by Trooper Dan: 23 August 2016 - 11:37 AM

0

User is online   Hendricks266 

  • Weaponized Autism

  #1883

The idea behind EVENT_PREGAME and EVENT_PREWORLD is to let you get the htextra before any ifhitweapon commands are run. I don't recall if they actually work for that though.
0

#1884

If only the obscure ifhitweapon behavior was on Wiki ages ago, i'd have skipped that question and not played the "dumb"role. Seriously, why and how do you suppose i had that info ?
Anyway, getting htextra at very top of enemy codes (before states etc) works quite well, many thanks.

But still:

Eduke Wiki of Secrets said:

If the actor in question is a useractor enemy, it will not count damage higher than the actor health.

i get the full amount of damage instead, like getting 200+ when shooting a 30hp liztroop with an rpg. What Wiki i miss, again ?


Now, my main interest is that clipping shaping, i should expect another CON secret...

This post has been edited by RichardStorm: 23 August 2016 - 02:38 PM

0

User is offline   Danukem 

  • Duke Plus Developer

#1885

View PostRichardStorm, on 23 August 2016 - 02:37 PM, said:

If only the obscure ifhitweapon behavior was on Wiki ages ago, i'd have skipped that question and not played the "dumb"role. Seriously, why and how do you suppose i had that info ?


I didn't realize that the information was missing from the wiki entry until you asked the question and I checked on it. I would argue that this is an example of the system working well -- someone asks a question, it gets answered, and then the wiki is updated so that other people won't have to ask (in theory).


View PostRichardStorm, on 23 August 2016 - 02:37 PM, said:

But still:

i get the full amount of damage instead, like getting 200+ when shooting a 30hp liztroop with an rpg. What Wiki i miss, again ?


I don't know who wrote that line in the wiki. Maybe it was correct at one time. Anyone with a wiki account can delete that line (maybe I will do that when I get home from work).

View PostRichardStorm, on 23 August 2016 - 02:37 PM, said:

Now, my main interest is that clipping shaping, i should expect another CON secret...


At the risk of being blasted for revealing that I know stuff, here goes... The hittable dimensions of an actor are determined by the tile number that it is defined on, not on the dimensions of the tile it happens to be displaying at a given moment. If an actor is displaying a dead body sprite because of an action command, that will not change the hittable area. What you need to do is use the cactor command to change its picnum to the dead body tile number. Then make the dead body tile number an actor with appropriate code.
0

User is offline   Mblackwell 

  • Evil Overlord

#1886

A fun bit in some old mods I was working on was making the initial sprite slightly smaller than the display version and giving it an offset so only a certain section of the enemy sprite was actually hittable.

Great times!
0

User is offline   Zaxtor 

#1887

Is there such code as to move(teleport) a sprite as we can do to the player?


Like for the player we have
Which can move the player to any areas of the level (at the speed of light) without any use of `move` code.

*
setplayer[THISACTOR].cursectnum (sector ID numbers number)
setplayer[THISACTOR].posx (horizontal distance number)
setplayer[THISACTOR].posy (vertical distance number)
setplayer[THISACTOR].posz (height altitude number)
setplayer[THISACTOR].ang (its angle number)


But is there a version of this code to teleport an individual sprite*
Like a version as the code above but for nonplayer sprites?
0

User is offline   Danukem 

  • Duke Plus Developer

#1888

http://wiki.eduke32.com/wiki/Setsprite
1

User is offline   Zaxtor 

#1889

it worked, thx.
I put the setsprite THISSPRITE and the xyz coordinates etc.
0

User is offline   David B. 

#1890

Working on a mod, I need to skip/deactivate the following menus ; I know about the events scripts but I can't figure out which current_menu port is related and/or if this is even doable :
I havent found enough information about that.

1- "status and crosshair" page (available from "display options" menu) ;
2- "select skill" when loading a new game ; I know this is port 110 but how to skip it ? manipulating the RETURN would lead back to a menu again. Maybe I'm not reasoning in the right way...??

As a subsidiary question : I managed to skip "cheat" menu - and other unused ones - but when I click on them, the main menu is "reloaded" and thus "slides".
I don't want to see that ; I would have liked nothing happens when an user select an "unavailable" page.

This post has been edited by David B.: 30 December 2016 - 09:12 AM

0

Share this topic:


  • 119 Pages +
  • « First
  • 61
  • 62
  • 63
  • 64
  • 65
  • 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