EDuke32 Scripting "CON coding help"
#2095 Posted 17 October 2017 - 01:00 PM
But there will be a difference once dynamicremap is implemented for weapons.
This post has been edited by Fox: 17 October 2017 - 01:01 PM
#2096 Posted 17 October 2017 - 07:48 PM
#2097 Posted 17 October 2017 - 11:05 PM
thisbecasper, on 17 October 2017 - 07:48 PM, said:
Here's your basic kill count: http://wiki.eduke32....i/Actors_killed
If you want a system where the player can lose kills, then you'll need to make your own counter.
#2098 Posted 18 October 2017 - 01:35 AM
Trooper Dan, on 17 October 2017 - 11:05 PM, said:
If you want a system where the player can lose kills, then you'll need to make your own counter.
Sorry, I'm talking multiplayer only - Idk if that's the same counter?
#2099 Posted 18 October 2017 - 02:48 AM
thisbecasper, on 18 October 2017 - 01:35 AM, said:
I think I've found what I've been looking for by looking at the pages related to the one you linked, so thanks!
#2100 Posted 18 October 2017 - 05:28 AM
#2101 Posted 18 October 2017 - 10:31 AM
gamevar killcount 0 0
gamevar temp 0 0
state getkillcount
getplayer[THISACTOR].frag killcount
getplayer[THISACTOR].fraggedself temp
subvarvar killcount temp
endsCall state getkillcount before any code section that needs it, and it will populate the killcount variable.
#2102 Posted 18 October 2017 - 10:45 AM
Hendricks266, on 18 October 2017 - 10:31 AM, said:
I think he had come to that same conclusion, if his last post was any indication. When I posted, I had no idea he was working on a multiplayer mod, which is why I thought he might need his own counter.
#2103 Posted 18 October 2017 - 03:30 PM
Hendricks266, on 18 October 2017 - 10:31 AM, said:
gamevar killcount 0 0
gamevar temp 0 0
state getkillcount
getplayer[THISACTOR].frag killcount
getplayer[THISACTOR].fraggedself temp
subvarvar killcount temp
endsCall state getkillcount before any code section that needs it, and it will populate the killcount variable.
This works! I have yet to understand how all of this works... Although I think im slowly understanding bits and pieces, so THANK YOU. Three more questions if I may...: How do I place a sprite or character in the dead center of the screen? Is there a way to make sure a character is drawn in the middle between the crosshair and hud regardless of aspect ratio and resolution? How do I place a quote in a specifik spot on the screen when I have the, let's say, the shotgun equipped (The quote should be displayed as long as the shotgun is equipped)? (It's only the part of being able to draw a quote to the screen that has be troubled)
This post has been edited by thisbecasper: 18 October 2017 - 03:32 PM
#2104 Posted 18 October 2017 - 04:58 PM
If that sprite will be _part_ of the crosshair, I believe putting that part in EVENT_DISPLAYCROSSHAIR instead will turn it off along with the crosshair, if disabled.
#2105 Posted 19 October 2017 - 10:42 AM
#2106 Posted 19 October 2017 - 11:24 AM
thisbecasper, on 19 October 2017 - 10:42 AM, said:
Thanks for letting us know, it's likely a quick fix. You can always try Google Cache or archive.org.
#2107 Posted 19 October 2017 - 11:25 AM
#2109 Posted 19 October 2017 - 12:04 PM
- How come I can't upvote replies? "You've reached maximum amount of upvotes" it says. (Haven't upvoted anything yet)
This post has been edited by thisbecasper: 19 October 2017 - 12:08 PM
#2110 Posted 19 October 2017 - 12:39 PM
thisbecasper, on 19 October 2017 - 12:04 PM, said:
You'll get that permission once you reach 50 posts. You're close.
#2111 Posted 19 October 2017 - 12:48 PM
Fox, on 05 August 2009 - 06:38 AM, said:
You still have the code for a heatseeking weapon??
#2112 Posted 19 October 2017 - 02:12 PM
#2113 Posted 19 October 2017 - 02:42 PM
Fox, on 19 October 2017 - 02:12 PM, said:
I would still be interested in seeing how one manages to shoot a projectile that follows the closest player or the originally aimed at (if possible), but if you cba, it's all cool
Something completely different:
I want to do something to the player (in this example I just set the rpg max ammo to 60), when the player kills another player actor. I thought it would work like this:
gamevar killer 0 1
actor APLAYER ...
(...)
ifdead
{
getplayer[THISACTOR].wackedbyactor killer
setplayer[killer].max_ammo_amount 4 60
Buuuuuuut it doesn't...
#2114 Posted 19 October 2017 - 04:43 PM
ifdead
{
getplayer[THISACTOR].wackedbyactor temp
getactor[temp].picnum temp2
ifvare temp2 APLAYER
{
getactor[temp].yvel temp2
setplayer[temp2].max_ammo_amount RPG_WEAPON 60
}
#2115 Posted 20 October 2017 - 01:56 AM
Hendricks266, on 19 October 2017 - 04:43 PM, said:
ifdead
{
getplayer[THISACTOR].wackedbyactor temp
getactor[temp].picnum temp2
ifvare temp2 APLAYER
{
getactor[temp].yvel temp2
setplayer[temp2].max_ammo_amount RPG_WEAPON 60
}It works, but it was intended to increment different variables so that with each kill, your weapon got stronger or something:
ifdead
{
getplayer[THISACTOR].wackedbyactor killer
getactor[killer].picnum tempkiller
ifvare tempkiller APLAYER
{
getactor[killer].yvel tempkiller
addvar rpgammo 10
setplayer[tempkiller].max_ammo_amount RPG_WEAPON rpgammo
}
Right now I think it perfoms the "addvar rpgammo 10" many many times, because the ifdead maybe works like whiledead also? If I get a kill with this code i get 1410-something maxammo. I only want it to do once everytime a player dies. And how do I alter another players variable? Becuase in fact, I'd want to set the killers maxammo to the originally maxammo plus (the times the killer have gotten a kill) * (10)..
This post has been edited by thisbecasper: 20 October 2017 - 02:17 AM
#2116 Posted 20 October 2017 - 10:02 AM
#2117 Posted 20 October 2017 - 01:24 PM
Trooper Dan, on 20 October 2017 - 10:02 AM, said:
I can see the point in making states here, although I simply can't make it to work...
state updatevalue
{
getplayer[THISACTOR].wackedbyactor killer
getactor[killer].picnum tempkiller
ifvare tempkiller APLAYER
{
ifhitweapon
{
addvar rpgsammo 10
}
getactor[killer].yvel tempkiller
setplayer[tempkiller].max_ammo_amount RPG_WEAPON rpgsammo
}
}
ends
---
ifdead
{
state updatevalue
I am drawing the rpgsammo through digitalnumberz so I can keep track of it as I'm killing players and dying to players. No matter what it wont increment, and it also just sets the maxammo to whatever the value the variable was declared with in the first place. Actually I'm doubting that I'm using ifhitweapon correct, because when I place the two lines below into the if-statement together with "addvar rpgsammo 10", it wont even set maxammoamount
This post has been edited by thisbecasper: 20 October 2017 - 02:17 PM
#2118 Posted 20 October 2017 - 02:58 PM
state updatevalue
getplayer[THISACTOR].wackedbyactor killer
getactor[killer].picnum tempkiller
ifvare tempkiller APLAYER
{
addvar rpgsammo 10
getactor[killer].yvel tempkiller
setplayer[tempkiller].max_ammo_amount RPG_WEAPON rpgsammo
}
endsifhitweapon
{
ifdead
{
state updatevalueIf this doesn't work, there may be something that prevents setting max_ammo_amount from working, and in thta case I'll look into it.
#2119 Posted 20 October 2017 - 04:32 PM
Hendricks266, on 20 October 2017 - 02:58 PM, said:
state updatevalue
getplayer[THISACTOR].wackedbyactor killer
getactor[killer].picnum tempkiller
ifvare tempkiller APLAYER
{
addvar rpgsammo 10
getactor[killer].yvel tempkiller
setplayer[tempkiller].max_ammo_amount RPG_WEAPON rpgsammo
}
endsifhitweapon
{
ifdead
{
state updatevalueIf this doesn't work, there may be something that prevents setting max_ammo_amount from working, and in thta case I'll look into it.
Now I've tried what you suggested, and thanks for that btw!, but it still won't work. It sets the maxammo to the variable plus the value you add, in this case 10 - but only once. I'm drawing the value of the var rpgsammo on my screen and it doesn't update when 10 is added. It remains whatever I declare it to. Summing up: After a kill the actual max_ammo_amount and rpgsammo doesn't match, and the max_ammo_amount wont increment on kills past the first one.
This post has been edited by thisbecasper: 20 October 2017 - 04:34 PM
#2120 Posted 20 October 2017 - 04:44 PM
state updatevalue
getplayer[THISACTOR].wackedbyactor killer
getactor[killer].picnum tempkiller
ifvare tempkiller APLAYER
{
getactor[killer].yvel tempkiller
getplayer[tempkiller].max_ammo_amount RPG_WEAPON temp
addvar temp 10
setplayer[tempkiller].max_ammo_amount RPG_WEAPON temp
}
ends
#2121 Posted 21 October 2017 - 08:33 AM
Hendricks266, on 20 October 2017 - 04:44 PM, said:
state updatevalue
getplayer[THISACTOR].wackedbyactor killer
getactor[killer].picnum tempkiller
ifvare tempkiller APLAYER
{
getactor[killer].yvel tempkiller
getplayer[tempkiller].max_ammo_amount RPG_WEAPON temp
addvar temp 10
setplayer[tempkiller].max_ammo_amount RPG_WEAPON temp
}
endsI only got it to work when put under ifwasweapon RPG - I don't know how to make it work if put under ifhitweapon under ifdead or reverse. Anyway - Something comepletely different: Is it possible to draw an ingame menu with options that perform lines of code when pressed when chosen, and if it is, is it difficult? I'm thinking of an upgrade system, but you'll have to use menu to upgrade the weapons.
This post has been edited by thisbecasper: 21 October 2017 - 08:41 AM
#2122 Posted 21 October 2017 - 12:20 PM
onevent EVENT_DISPLAYREST
//Healthbar
getactor[THISACTOR].extra health
getplayer[THISACTOR].MAX_PLAYER_HEALTH maxhp
setvar xvar 0
whilevarn maxhp 0
{
rotatesprite xvar 185 65536 0 3163 0 0 49 0 0 xdim ydim
addvar xvar 1 // move to the right
subvar maxhp 1 // next hitpoint
}
setvar xvar 0
setvar yvar 100
whilevarn health 0
{
ifvarg health 100
{
rotatesprite yvar 185 65536 0 3163 0 2 16 0 0 xdim ydim // draws atomic health
addvar yvar 1 // move to the right
subvar health 1 // next hitpoint
}
else
{
rotatesprite xvar 185 65536 0 3163 0 0 16 0 0 xdim ydim // draws regular health
addvar xvar 1 // move to the right
subvar health 1 // next hitpoint
}
}
endevent
This code crashes the game unfortunately. There has to be fix for this...
Quote
Nvm, think I've found something on it now.
Is there a way to achieve the ID of the player you are hitting, or even better, looking at?
This post has been edited by thisbecasper: 21 October 2017 - 12:43 PM
#2123 Posted 21 October 2017 - 12:23 PM
Trooper Dan, on 14 October 2017 - 03:22 PM, said:
Also, when playing demos using the cam, I get the "out of sync" warning. Reading in the wiki, looks like this is caused by manipulation of constantly updated gamevars, but the only gamevars I manipulated here were the ones from the above mentioned tutorial. Would that cause a sync problem?
#2124 Posted 21 October 2017 - 01:32 PM
thisbecasper, on 21 October 2017 - 12:20 PM, said:
onevent EVENT_DISPLAYREST
//Healthbar
getactor[THISACTOR].extra health
getplayer[THISACTOR].MAX_PLAYER_HEALTH maxhp
setvar xvar 0
whilevarn maxhp 0
{
rotatesprite xvar 185 65536 0 3163 0 0 49 0 0 xdim ydim
addvar xvar 1 // move to the right
subvar maxhp 1 // next hitpoint
}
setvar xvar 0
setvar yvar 100
whilevarn health 0
{
ifvarg health 100
{
rotatesprite yvar 185 65536 0 3163 0 2 16 0 0 xdim ydim // draws atomic health
addvar yvar 1 // move to the right
subvar health 1 // next hitpoint
}
else
{
rotatesprite xvar 185 65536 0 3163 0 0 16 0 0 xdim ydim // draws regular health
addvar xvar 1 // move to the right
subvar health 1 // next hitpoint
}
}
endevent
Fixed.
Now my only questions are: How do you alter another player's gamevar. And is there a way to achieve the ID of the player you are hitting, or even better, looking at?
This post has been edited by thisbecasper: 21 October 2017 - 02:08 PM

Help
Duke4.net
DNF #1
Duke 3D #1


