Hi
I am trying to find a relatively quick way of calling a function defined within fpsstate in game.h and setting up an ICOMMAND for it (to allow access from mapname.cfg). This is to make a fix for a schools workshop. the settings I wish to change are within fpsstate.
However I cannot seen to get COMMAND/ICOMMAND to work within fpsstate. I figure the best way to do this is to call the function (for example respawn()) from outside. any pointers would be gratefully recieved as to the styntax.
Regards
John
Hi! Welcome to the forum for Platinum Arts Sandbox Free 3D Game Maker. I currently have the forums locked as I am attempting to properly update them.
In the meantime please join the new Discord Server!
If you have any questions please e-mail me through the Platinum Arts website.
In the meantime please join the new Discord Server!
If you have any questions please e-mail me through the Platinum Arts website.
help required calling functions from state fpsstate
-
- Member
- Posts: 7
- Joined: November 13th, 2013, 7:58 am
Re: help required calling functions from state fpsstate
they should go into fps.cpp, and you'd access the fpsstate object via a fpsent object, such as player1.
This is not a url, clicking it is pointless
-
- Member
- Posts: 7
- Joined: November 13th, 2013, 7:58 am
Re: help required calling functions from state fpsstate
Thanks for that Hirato,
I got there in the end with help from both yourself and Wind Astella.
For anyone also searching on the topic and wants the single player fps as a magic based rpg without the pickups (you can buy the ammo and health from a menu, and have been renamed with such magic like names as scathe dust and dragons breath ).
an example of this would be
level_trigger_2 = [buymagic;]
The following code in the fps.cpp file will allow you to make the changes by command.
Potion is fairly self explainatory (just replace player1->maxhealth with your value)
Buymagic allows for adding ammo to the renamed weapons. The value 3 in this case represents what used to be rockets, however it can be changed to suit your needs
I got there in the end with help from both yourself and Wind Astella.
For anyone also searching on the topic and wants the single player fps as a magic based rpg without the pickups (you can buy the ammo and health from a menu, and have been renamed with such magic like names as scathe dust and dragons breath ).
an example of this would be
level_trigger_2 = [buymagic;]
The following code in the fps.cpp file will allow you to make the changes by command.
Potion is fairly self explainatory (just replace player1->maxhealth with your value)
Buymagic allows for adding ammo to the renamed weapons. The value 3 in this case represents what used to be rockets, however it can be changed to suit your needs
Code: Select all
void potion(physent *d){ // allows level trigger to control health conditions
if(d==player1 || (d->type==ENT_PLAYER )){
player1->health=player1->maxhealth;
}
}
ICOMMAND(potion, "", (), potion(player1););
void buymagic(physent *d, int gun){ //allows level trigger to change ammo (renamed as spells)
if(d==player1 || (d->type==ENT_PLAYER )){
player1->ammo[gun]=player1->ammo[gun]=100;
}
}
ICOMMAND(buymagic, "", (), buymagic(player1,3);); //change number to change weapon top up in thi case rockets in original script