AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved Change entity class | Orpheu (https://forums.alliedmods.net/showthread.php?t=293365)

edon1337 01-30-2017 09:28

Change entity class | Orpheu
 
Hello. I was wondering,

1. Is it possible changing a player's class? Like if you aim at an entity and press "G" you'll become that entity. I've tried different methods but none worked, the idea came from Garry's Mod.

2. What can Orpheu be used for ? I just can't understand this module, it has weird this such as OrpheuHook, OrpheuFunction etc..

3. Which is the best way to set player model ( Without using extra APIs such as Connor's ) ?

Thank you.

HamletEagle 01-30-2017 10:37

Re: Change entity class | Orpheu
 
1.What would be the purpose for that? It does not make sense.
2.Orpheu/okapi allows you to hook functions from game dlls(engine and mod dll), which can help you do awesome things. You can also play with memory and private data.
Take for example hamsandwich, all it does is to hook some virtual functions from game. View orpheu as an extended hamsandwich, it does not limit you to some predefined functions like ham does. It gives you the power to hook and call almost all functions. The only thing that you need is a signature file so the module can identify the function. OrpheuRegisterHook is the same as RegisterHam, it registers a hook for a specific function. In order get the function based on the signature file, OrpheuGetFunction is used.

For example, let's say you want to force a round end. The classic way is to kill all players, which is a poor and unreliable way. Game uses a function called CHalfLifeMultiplay::CheckWinConditions to determine when a round should end. If we have access to that function, we can call it and end the round. For that, one can use orpheu/okapi.

edon1337 01-30-2017 10:52

Re: Change entity class | Orpheu
 
1. You might want to check this , it actually is pretty cool.
2. Wow, that sounds cool, can you provide an example on how to force round end?

Thank you :)

EFFx 01-30-2017 10:58

Re: Change entity class | Orpheu
 
1. Its not like AMXX.
2. https://forums.alliedmods.net/showthread.php?p=1122356

HamletEagle 01-30-2017 11:21

Re: Change entity class | Orpheu
 
2.It depends in which scenario, see Arkshine plugin for a way to do it properly. You have to create the conditions before calling the function. For example, if you want to end the round in a defuse map, you have to either set m_bTargetBombed(t will win) or m_bBombDefused(ct will win) offsets so the checks from the function are passed and the round will end. You can see the code in the mod source code(multiplay_gamerules.cpp file).

PRoSToTeM@ 01-30-2017 20:27

Re: Change entity class | Orpheu
 
Quote:

Originally Posted by edon1337 (Post 2491117)
1. Is it possible changing an entity's class? Like to transform weapon_ak47 into func_button. I've tried different methods but none worked, the idea came from Garry's Mod.

Why not just delete old entity and create a new one?

edon1337 01-31-2017 07:54

Re: Change entity class | Orpheu
 
@Hamlet Okay thanks, Orpheu looks more complicated compared to other modules.
@Prost Sorry my explanation was wrong, I want you to become the entity you see.

EFFx 01-31-2017 18:30

Re: Change entity class | Orpheu
 
What PRoSToTeM@ said makes sense. You can make a stock for create a new entity.

PHP Code:

stock create_entity(entClass[], Float:entSizeFloat:LastEntityOrigin) .... 

Pick the last entity origin and put it in the new one. It will spawn him where the last entity was.

yas17sin 01-31-2017 21:40

Re: Change entity class | Orpheu
 
@edon1337 yes it is very cool if you can change into something like Gmod.

edon1337 02-01-2017 07:36

Re: Change entity class | Orpheu
 
Quote:

Originally Posted by EFFx (Post 2491651)
What PRoSToTeM@ said makes sense. You can make a stock for create a new entity.

PHP Code:

stock create_entity(entClass[], Float:entSizeFloat:LastEntityOrigin) .... 

Pick the last entity origin and put it in the new one. It will spawn him where the last entity was.

..
Quote:

Originally Posted by edon1337 (Post 2491441)
@Prost Sorry my explanation was wrong, I want you to become the entity you see.



All times are GMT -4. The time now is 20:50.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.