
EDuke32 Scripting "CON coding help"
#2029 Posted 19 August 2017 - 09:43 PM
Hendricks266, on 19 August 2017 - 04:56 PM, said:
255 (the default) plus 524288.
Oops I had added 256 instead of 255.
#2030 Posted 21 August 2017 - 04:39 AM
Was gonna pic the arctic still pic, didn't work but scrapped it.
Ending is pretty long tho so is ok.
#2031 Posted 25 August 2017 - 07:21 PM
it says (except the ability to look up/down with the mouse)
is there a locking code to temporarily lock mouse movements too?
#2032 Posted 26 August 2017 - 04:33 AM
"you should setplayer[THISACTOR].weapon_pos 1 and also setplayer[THISACTOR].jumping_counter 0
and maybe setinput[].horz 0 maybe even setinput[].bits 0
should keep the player from doing anything when lockplayer is active
firing a gun or jumping
looking up and down
etc"
#2033 Posted 26 August 2017 - 01:24 PM
i tried with horz and bits (inside player) no workin
like setinput[THISACTOR].horz 0
and other so nothing happens
This post has been edited by Zaxtor: 26 August 2017 - 01:24 PM
#2034 Posted 28 August 2017 - 06:56 PM
http://wiki.eduke32.com/wiki/On_crane
...is the thing set by "lockplayer". So you can probably check in EVENT_PROCESSINPUT if that is set and then do your canceling.
#2035 Posted 29 August 2017 - 02:22 PM
mouse auto aiming looks around but when I lockplayer etc, can still look and down but not around so is only up and down I need to disable.
So mouse aiming up and down is what I need to disable, it somewhat disabled diagonal, sideway etc not up and down.
it reenable looking around with mouse, weap etc after event / cutscene are over
only up and down cant figure how to disable, iv tried everything
This post has been edited by Zaxtor: 29 August 2017 - 02:22 PM
#2037 Posted 29 August 2017 - 06:04 PM
#2038 Posted 29 August 2017 - 06:40 PM
http://wiki.eduke32....NT_PROCESSINPUT
onevent EVENT_PROCESSINPUT
getinput[THISACTOR].avel turning
getinput[THISACTOR].horz mouselook
ifvarn turning 0 setinput[THISACTOR].avel 0
ifvarn mouselook 0 setinput[THISACTOR].horz 0
endevent
(actually atm using 2 comps to do that)
1 to go online, post and read etc
and other to work on duke mod v2 etc
cuz Im at my aunt on vacation and helping with her yard etc. and my comp does not support wireless internet (wifi etc)
so I use her laptop for net etc
so makes things slightly harder
This post has been edited by Zaxtor: 29 August 2017 - 06:41 PM
#2039 Posted 05 October 2017 - 11:44 AM
With this code, I can make my bot jump, crouch down, and press use, but for unknown reason, I can't make it use the quick kick:
onevent EVENT_PROCESSINPUT ifvare boting 1 { ifvarg stucktime 5 { getinput[THISACTOR].bits temp1 ifvaror temp1 4194304 { orvar temp1 4194304 setinput[THISACTOR].bits temp1 } } } endevent
It's also the same thing for some commands, like activating inventory items.
#2040 Posted 05 October 2017 - 12:36 PM
Darkus, on 05 October 2017 - 11:44 AM, said:
Yeah, I have the same problem. A lot of the actions cannot be activated by setting the input bits. The most frustrating case is weapon switching, since forcing it by setting other structs can lead to glitches.
I tried setting quick_kick to 1, hoping that it would work like setting kickback_pic to 1 and cause the sequence to continue automatically. But it didn't -- you can try it and see.
#2041 Posted 05 October 2017 - 01:32 PM
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.
#2042 Posted 06 October 2017 - 09:14 AM
Darkus, on 05 October 2017 - 01:32 PM, said:
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.
#2043 Posted 07 October 2017 - 11:40 AM
#2044 Posted 07 October 2017 - 12:51 PM
Darkus, on 07 October 2017 - 11:40 AM, said:
userdef[].gametypeflags
#2045 Posted 08 October 2017 - 12:33 PM
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.
#2046 Posted 08 October 2017 - 06:30 PM
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
#2047 Posted 09 October 2017 - 12:06 PM
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.
#2048 Posted 09 October 2017 - 01:58 PM
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.
#2049 Posted 12 October 2017 - 06:07 AM

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?
#2050 Posted 12 October 2017 - 08:22 AM
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.
#2051 Posted 12 October 2017 - 08:41 AM
PS I KNOW that this will be hard, but I love to learn, so just a little hint will be helpful!
#2052 Posted 12 October 2017 - 09:23 AM
Hendricks266, on 12 October 2017 - 08:22 AM, said:
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.
#2053 Posted 12 October 2017 - 09:29 AM
thisbecasper, on 12 October 2017 - 08:41 AM, said:
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).
#2054 Posted 13 October 2017 - 02:44 AM
Hendricks266, on 12 October 2017 - 09:29 AM, said:
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
#2055 Posted 13 October 2017 - 04:27 AM
thisbecasper, on 13 October 2017 - 02:44 AM, said:
I've found "Build ART Files Editor" so I think im good on this one

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

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