ZDaemon Forum Index ZDaemon
Client/Server DOOM
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CPA_JumpIfScriptResult, CPW_JumpIfScriptResult

 
Post new topic   Reply to topic    ZDaemon Forum Index -> Pending Requests
View previous topic :: View next topic  
Author Message
Body-Guard
Unstoppable!


Joined: 08 Jan 2006
Location: Hungary

PostPosted: Mon Oct 20, 2014 4:26 am    Post subject: CPA_JumpIfScriptResult, CPW_JumpIfScriptResult Reply with quote

Hello,

Before requesting an another feature, I'd like to thanks the work so far on Zdaemon. Especially the recent changes in b03, providing ACS interface for dehacked is possibly one of the biggest milestone for modders at Zdaemon. The idea I bring up now would further extend the possibilities.

1. What is the idea?

In 1.09, ACS_ExecuteWithResult was implemented.
Code:
13. Implemented 2 new action specials: ACS_ExecuteWithResult.....


It basically invokes a script, which can be set a result value (very much like a function). Combining this with dehacked can be used to create frame jumps depending on the script's result value called by ACS_ExecuteWithResult (this would be the topic of the feature request).

2. Syntax

CPA_JumpIfScriptResult (for actor frames), CPW_JumpIfScriptResult (for weapon frames)
Args1 = script number to run
Args2 = argument 1 passed to script
Args3 = argument 2 passed to script
Args4 = argument 3 passed to script
Args5 = argument 4 passed to script
Args6 = the result value the comparison should be made against
Args7 = the frame number to jump to if Args6 equals to the result value of the called script

The first 5 args are basically those of ACS_ExecuteWithResult's. The jump is not executed if the result value does not match Args6.

3. Why is it good?

Because you can execute a conditional frame jump in dehacked and you can express any condition accessible with ACS.

A sketch how you could do reloading weapons with this:

1. Use this codepointer in one of the weapon ready frames
2. the script called by this codepointer sets its own result value depending on how many ammo the player has (eg. using % 5 on Clip ammo returns 0 each time the ammo amount is divideable with 5) -> this means that each time the result is 0, 5 shots have been fired, so use the codepointer to jump to reloading frames.

A sketch how you could alter monster attack pattern depending on its health:

1. Use the codepointer in the monster's attack frame
2. the script called by this codepointer sets its own result value according to hit points the monster currently has (eg. returns 1 if it has less than 50 HP) -> this means that each time the result is 1, jump to a different attack frame.


4. Summary

Apart from the two examples above, the possibilities are only limited by what you can express in ACS, which means A LOT.

Looking forward seeing this implemented sometime, thanks in advance Smile
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Body-Guard
Unstoppable!


Joined: 08 Jan 2006
Location: Hungary

PostPosted: Mon Oct 20, 2014 8:59 am    Post subject: Reply with quote

Delay functions within the script shouldn't cause problems, because as the wiki says, the result has to be decided before any of them are used.
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Aeyesx
Dominating!


Joined: 13 Oct 2012

PostPosted: Tue Oct 21, 2014 11:34 am    Post subject: Reply with quote

Reloading weapons! It's real yay! Twisted Evil
Back to top
View user's profile Send private message Send e-mail
Maikl_Russia
has entered the game!


Joined: 18 Jul 2005
Location: RU

PostPosted: Tue Oct 13, 2015 11:58 am    Post subject: Reply with quote

These CP would have been extremely useful for moding. ++++

Quote:
Args7 = the frame number to jump to if Args6 equals to the result value of the called script

Frame number or thing's state.

Even more: if would be possible via ACS getting the arguments passed to a thing in the map editor - not need A_JumpIf CP ([Dehacked] JumpIfArgs)
Back to top
View user's profile Send private message
Aeyesx
Dominating!


Joined: 13 Oct 2012

PostPosted: Tue Oct 13, 2015 12:30 pm    Post subject: Reply with quote

Nah Maikl_Russia, both needed, don't ask why xD
Back to top
View user's profile Send private message Send e-mail
Maikl_Russia
has entered the game!


Joined: 18 Jul 2005
Location: RU

PostPosted: Tue Oct 13, 2015 1:28 pm    Post subject: Reply with quote

ACS easy to be learned. Wink
And less work for developers.
Back to top
View user's profile Send private message
Aeyesx
Dominating!


Joined: 13 Oct 2012

PostPosted: Tue Oct 13, 2015 1:32 pm    Post subject: Reply with quote

Might be, yet u cannot hack everything with it. + what you said is kinda nonsence >D What would be that good for? Move mapping aspects into ACS?
Back to top
View user's profile Send private message Send e-mail
Maikl_Russia
has entered the game!


Joined: 18 Jul 2005
Location: RU

PostPosted: Tue Oct 13, 2015 1:46 pm    Post subject: Reply with quote

Aeyesx wrote:
Might be, yet u cannot hack everything with it.

It's just a question of the sufficiency of the ACS functions.
Aeyesx wrote:
+ what you said is kinda nonsence >D What would be that good for? Move mapping aspects into ACS?

Why not? ACS much much more powerful than dehacked only.
Back to top
View user's profile Send private message
Aeyesx
Dominating!


Joined: 13 Oct 2012

PostPosted: Tue Oct 13, 2015 1:49 pm    Post subject: Reply with quote

True, lets move everything into ACS, actors definitions, sound definitions, and as you mentioned thing properities and perhaps whole map editor, as its just bunch of points with properties >)

I am giving this +1
Back to top
View user's profile Send private message Send e-mail
Maikl_Russia
has entered the game!


Joined: 18 Jul 2005
Location: RU

PostPosted: Tue Oct 13, 2015 2:17 pm    Post subject: Reply with quote

Aeyesx wrote:
True, lets move everything into ACS, actors definitions, sound definitions, and as you mentioned thing properities and perhaps whole map editor, as its just bunch of points with properties >)

I am giving this +1


!ice_tea to Medis.

The main goal is to less work for developers. Why needs to hardcode new things/actions/etc if it would be possible make with ACS?
"Do not feed a man by a fish, give him a fishing rod and teach to fish." (C) Smile
Back to top
View user's profile Send private message
Body-Guard
Unstoppable!


Joined: 08 Jan 2006
Location: Hungary

PostPosted: Wed Oct 14, 2015 5:27 pm    Post subject: Reply with quote

Maikl_Russia wrote:
Even more: if would be possible via ACS getting the arguments passed to a thing in the map editor - not need A_JumpIf CP ([Dehacked] JumpIfArgs)


While it is true that it is possible to implement a new ACS function to get the map editor arguments of the thing, you would still need to write a script just for the purpose to get the arguments and use it in conjunction with JumpIfScriptResult.

Pro: more flexible, because you can return different script results depending on combinations of map editor thing arguments, instead of just checking for one argument as per the JumpIfArgs request specifies.

Con: most of the time, checking for only one argument is enough, like the case with the example posted in JumpIfArgs topic. If it has to be done with JumpIfScriptResult, one would need to write ACS script as well, instead of just having the ability to explicitly access map editor arguments from dehacked.


Anyway, rather than a new function, several new constants could be introduced to Get/Check/SetActorProperty which refer to the respective map editor thing arguments.

Code:
APROP_ThingArg1....APROP_ThingArg5
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Aeyesx
Dominating!


Joined: 13 Oct 2012

PostPosted: Thu Oct 15, 2015 4:20 pm    Post subject: Reply with quote

I can say only one thing to this

Back to top
View user's profile Send private message Send e-mail
TheCupboard
Generic Title


Joined: 25 Feb 2007
Location: USA

PostPosted: Sat Oct 17, 2015 7:58 am    Post subject: Reply with quote

likes this
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Maikl_Russia
has entered the game!


Joined: 18 Jul 2005
Location: RU

PostPosted: Tue Oct 20, 2015 10:15 pm    Post subject: Reply with quote

Body-Guard wrote:
While it is true that it is possible to implement a new ACS function to get the map editor arguments of the thing, you would still need to write a script just for the purpose to get the arguments and use it in conjunction with JumpIfScriptResult.

Body-Guard, you will need only one script (comparable in difficulty with "Hello, world."). And you know this. Wink

Btw, do not think that I am strongly opposed to JumpIfArgs CP. I just think that JumpIfArgs CP duplicates (in simplified form) CPA_JumpIfScriptResult.
Back to top
View user's profile Send private message
Body-Guard
Unstoppable!


Joined: 08 Jan 2006
Location: Hungary

PostPosted: Wed Oct 21, 2015 8:18 am    Post subject: Reply with quote

It is not about the script being complicated. Why to use acs for a simple task when you have direct access to thing arguments with JumpIfArgs? I understand that JumpIfScriptResult is more general and could cover (and extend functionality of) JumpIfArgs as well, but that would require further ACS extensions from developer side either with a new function to get thing arguments as you said or new constants for ActorProperty functions as I said.

This is roughly the same debate as why to have PlaySound codepointer when you can execute ACS scripts on frames, which then calls ActivatorSound. ACS is more flexible, yes, but overkill for such a simple task.
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    ZDaemon Forum Index -> Pending Requests All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group